Bug 619996, part c: stop using QueryInterface on nsHTMLOptionElement::GetSelect's return value; r=bz

This commit is contained in:
Ms2ger 2011-04-12 14:32:00 +02:00
parent 038d6657ef
commit 65df88b847

View File

@ -49,9 +49,7 @@
#include "nsIForm.h"
#include "nsIDOMText.h"
#include "nsIDOMNode.h"
#include "nsGenericElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsISelectElement.h"
#include "nsISelectControlFrame.h"
// Notify/query select frame for selected state
@ -136,8 +134,7 @@ nsHTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm)
NS_ENSURE_ARG_POINTER(aForm);
*aForm = nsnull;
nsCOMPtr<nsIDOMHTMLSelectElement> selectControl =
do_QueryInterface(GetSelect());
nsHTMLSelectElement* selectControl = GetSelect();
if (selectControl) {
selectControl->GetForm(aForm);
@ -202,7 +199,7 @@ nsHTMLOptionElement::SetSelected(PRBool aValue)
{
// Note: The select content obj maintains all the PresState
// so defer to it to get the answer
nsCOMPtr<nsISelectElement> selectInt = do_QueryInterface(GetSelect());
nsHTMLSelectElement* selectInt = GetSelect();
if (selectInt) {
PRInt32 index;
GetIndex(&index);
@ -231,8 +228,7 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
*aIndex = -1; // -1 indicates the index was not found
// Get our containing select content object.
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement =
do_QueryInterface(GetSelect());
nsHTMLSelectElement* selectElement = GetSelect();
if (selectElement) {
// Get the options from the select object.
@ -289,9 +285,9 @@ nsHTMLOptionElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
}
// We just changed out selected state (since we look at the "selected"
// attribute when mSelectedChanged is false. Let's tell our select about
// attribute when mSelectedChanged is false). Let's tell our select about
// it.
nsCOMPtr<nsISelectElement> selectInt = do_QueryInterface(GetSelect());
nsHTMLSelectElement* selectInt = GetSelect();
if (!selectInt) {
return NS_OK;
}