From 9fc0546e03fd60fde45d5affcb0885f012616d41 Mon Sep 17 00:00:00 2001 From: "allan%beaufour.dk" Date: Wed, 9 Feb 2005 09:57:31 +0000 Subject: [PATCH] Remaining controls implement nsIXFormsContextControl, through nsXFormsControlStub, bug 280017, r=smaug, sr=bryner --- extensions/xforms/nsIXFormsControl.idl | 4 +- .../xforms/nsXFormsContextContainer.cpp | 12 +-- extensions/xforms/nsXFormsControlStub.cpp | 41 +++++++++ extensions/xforms/nsXFormsControlStub.h | 11 ++- extensions/xforms/nsXFormsGroupElement.cpp | 92 +------------------ extensions/xforms/nsXFormsInputElement.cpp | 5 +- extensions/xforms/nsXFormsLabelElement.cpp | 6 -- extensions/xforms/nsXFormsOutputElement.cpp | 6 -- extensions/xforms/nsXFormsRepeatElement.cpp | 11 +-- extensions/xforms/nsXFormsSelectElement.cpp | 5 +- extensions/xforms/nsXFormsSwitchElement.cpp | 87 ++++-------------- extensions/xforms/nsXFormsTriggerElement.cpp | 6 -- extensions/xforms/nsXFormsUploadElement.cpp | 5 +- extensions/xforms/nsXFormsUtils.cpp | 10 +- 14 files changed, 91 insertions(+), 210 deletions(-) diff --git a/extensions/xforms/nsIXFormsControl.idl b/extensions/xforms/nsIXFormsControl.idl index dc78402c33ba..e608759e3efa 100644 --- a/extensions/xforms/nsIXFormsControl.idl +++ b/extensions/xforms/nsIXFormsControl.idl @@ -36,7 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsISupports.idl" +#include "nsIXFormsContextControl.idl" interface nsIArray; interface nsIDOMNode; @@ -46,7 +46,7 @@ interface nsIDOMElement; * Interface implemented by all XForms form control classes. */ [uuid(8377c845-5d55-4eee-9a76-0f86751dcbc8)] -interface nsIXFormsControl : nsISupports +interface nsIXFormsControl : nsIXFormsContextControl { /** * This tells the form control to update its node binding based on the diff --git a/extensions/xforms/nsXFormsContextContainer.cpp b/extensions/xforms/nsXFormsContextContainer.cpp index c0e615e12d18..922c58b07aa3 100644 --- a/extensions/xforms/nsXFormsContextContainer.cpp +++ b/extensions/xforms/nsXFormsContextContainer.cpp @@ -67,16 +67,13 @@ * @see http://www.w3.org/TR/xforms/sliceF.html#id2645142 * @see http://bugzilla.mozilla.org/show_bug.cgi?id=271724 */ -class nsXFormsContextContainer : public nsXFormsControlStub, - public nsIXFormsContextControl +class nsXFormsContextContainer : public nsXFormsControlStub { protected: /** The HTML representation for the node */ nsCOMPtr mHTMLElement; public: - NS_DECL_ISUPPORTS_INHERITED - // nsIXTFXMLVisual overrides NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper); @@ -94,15 +91,8 @@ public: // nsIXFormsContextControl NS_DECL_NSIXFORMSCONTEXTCONTROL - }; -NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsContextContainer, - nsXFormsXMLVisualStub, - nsIXFormsControl, - nsIXFormsContextControl) - - // nsIXTFXMLVisual NS_IMETHODIMP nsXFormsContextContainer::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) diff --git a/extensions/xforms/nsXFormsControlStub.cpp b/extensions/xforms/nsXFormsControlStub.cpp index 33bea2ebf3e9..b9a74325344b 100644 --- a/extensions/xforms/nsXFormsControlStub.cpp +++ b/extensions/xforms/nsXFormsControlStub.cpp @@ -79,6 +79,11 @@ nsXFormsHintHelpListener::HandleEvent(nsIDOMEvent* aEvent) return NS_OK; } +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsControlStub, + nsXFormsXMLVisualStub, + nsIXFormsContextControl, + nsIXFormsControl) + NS_IMETHODIMP nsXFormsControlStub::GetBoundNode(nsIDOMNode **aBoundNode) { @@ -374,3 +379,39 @@ nsXFormsControlStub::AttributeSet(nsIAtom *aName, const nsAString &aValue) return NS_OK; } + +// nsIXFormsContextControl + +NS_IMETHODIMP +nsXFormsControlStub::SetContextNode(nsIDOMNode *aContextNode) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXFormsControlStub::GetContext(nsAString &aModelID, + nsIDOMNode **aContextNode, + PRInt32 *aContextPosition, + PRInt32 *aContextSize) +{ + NS_ENSURE_ARG(aContextSize); + NS_ENSURE_ARG(aContextPosition); + + *aContextPosition = 1; + *aContextSize = 1; + + if (mBoundNode && aContextNode) { + CallQueryInterface(mBoundNode, aContextNode); // addrefs + NS_ASSERTION(*aContextNode, "could not QI context node from bound node?"); + } + + /// + /// @todo expensive to run this + nsCOMPtr model = do_QueryInterface(mModel); + if (model) { + model->GetAttribute(NS_LITERAL_STRING("id"), aModelID); + } + + return NS_OK; +} + diff --git a/extensions/xforms/nsXFormsControlStub.h b/extensions/xforms/nsXFormsControlStub.h index a501ba0ac3be..78fad8968015 100644 --- a/extensions/xforms/nsXFormsControlStub.h +++ b/extensions/xforms/nsXFormsControlStub.h @@ -64,13 +64,17 @@ class nsIXTFXMLVisualWrapper; * It also inherits from nsXFormsXMLVisualStub, and overrides a couple of its * functions. * - * @todo nsIXFormsContextControl-stub should probably also be included here - * (mBoundNode is in fact also the context) (XXX) + * @bug If a control has a model attribute, but no binding attributes we fail + * to set this as the context for children. We need to return the contextnode + * from EvaluateNodeBinding in that case, and return that in GetContext(). (XXX) + * @see http://bugzilla.mozilla.org/show_bug.cgi?id=280366 */ class nsXFormsControlStub : public nsIXFormsControl, public nsXFormsXMLVisualStub { public: + NS_DECL_ISUPPORTS_INHERITED + /** The standard notification flags set on nsIXTFElement */ const PRUint32 kStandardNotificationMask; /** @@ -99,6 +103,9 @@ public: NS_IMETHOD ParentChanged(nsIDOMElement *aNewParent); NS_IMETHOD WillSetAttribute(nsIAtom *aName, const nsAString &aValue); NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aValue); + + // nsIXFormsContextControl + NS_DECL_NSIXFORMSCONTEXTCONTROL /** Constructor */ nsXFormsControlStub() : diff --git a/extensions/xforms/nsXFormsGroupElement.cpp b/extensions/xforms/nsXFormsGroupElement.cpp index b192d1fdd06f..51d579232f8a 100644 --- a/extensions/xforms/nsXFormsGroupElement.cpp +++ b/extensions/xforms/nsXFormsGroupElement.cpp @@ -51,7 +51,6 @@ #include "nsIXTFXMLVisualWrapper.h" #include "nsXFormsControlStub.h" -#include "nsIXFormsContextControl.h" #include "nsIModelElementPrivate.h" #include "nsXFormsUtils.h" @@ -67,34 +66,19 @@ * @todo If a \ is the first element child for \ it is the * label for the entire group * - * @todo "Setting the input focus on a group results in the focus being set to - * the first form control in the navigation order within that group." - * (spec. 9.1.1) - * - * @bug If a group only has a model attribute, the group fails to set this for - * children, as it is impossible to distinguish between a failure and absence - * of binding attributes when calling ProcessNodeBinding(). + * @todo With some small adjustments we could let nsXFormsContextContainer + * implement group, and get rid of this class (XXX). */ -class nsXFormsGroupElement : public nsXFormsControlStub, - public nsIXFormsContextControl +class nsXFormsGroupElement : public nsXFormsControlStub { protected: /** Tries to focus a child form control.*/ - PRBool TryFocusChildControl(nsIDOMNode* aParent); + PRBool TryFocusChildControl(nsIDOMNode *aParent); /** The UI HTML element used to represent the tag */ nsCOMPtr mHTMLElement; - /** The current ID of the model node is bound to */ - nsString mModelID; - public: - NS_DECL_ISUPPORTS_INHERITED - - // Constructor - nsXFormsGroupElement(); - ~nsXFormsGroupElement(); - // nsIXTFXMLVisual overrides NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper); @@ -106,31 +90,10 @@ public: NS_IMETHOD OnDestroyed(); // nsIXFormsControl - NS_IMETHOD Bind(); NS_IMETHOD Refresh(); - NS_IMETHOD TryFocus(PRBool* aOK); - - // nsIXFormsContextControl - NS_DECL_NSIXFORMSCONTEXTCONTROL + NS_IMETHOD TryFocus(PRBool *aOK); }; -NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsGroupElement, - nsXFormsXMLVisualStub, - nsIXFormsControl, - nsIXFormsContextControl) - -MOZ_DECL_CTOR_COUNTER(nsXFormsGroupElement) - -nsXFormsGroupElement::nsXFormsGroupElement() -{ - MOZ_COUNT_CTOR(nsXFormsGroupElement); -} - -nsXFormsGroupElement::~nsXFormsGroupElement() -{ - MOZ_COUNT_DTOR(nsXFormsGroupElement); -} - // nsIXTFXMLVisual NS_IMETHODIMP nsXFormsGroupElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) @@ -182,22 +145,6 @@ nsXFormsGroupElement::OnDestroyed() // nsIXFormsControl -NS_IMETHODIMP -nsXFormsGroupElement::Bind() -{ - mModelID.Truncate(); - - // Re-evaluate what instance node this element is bound to. - ResetBoundNode(); - - // Get model ID - nsCOMPtr modelElement = do_QueryInterface(mModel); - NS_ENSURE_TRUE(modelElement, NS_ERROR_FAILURE); - modelElement->GetAttribute(NS_LITERAL_STRING("id"), mModelID); - - return NS_OK; -} - NS_IMETHODIMP nsXFormsGroupElement::Refresh() { @@ -250,35 +197,6 @@ nsXFormsGroupElement::TryFocus(PRBool* aOK) return NS_OK; } -// nsIXFormsContextControl -NS_IMETHODIMP -nsXFormsGroupElement::SetContextNode(nsIDOMNode *aContextNode) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -nsresult -nsXFormsGroupElement::GetContext(nsAString& aModelID, - nsIDOMNode **aContextNode, - PRInt32 *aContextPosition, - PRInt32 *aContextSize) -{ -#ifdef DEBUG_XF_GROUP - printf("nsXFormsGroupElement::GetContext()\n"); -#endif - NS_ENSURE_ARG(aContextSize); - NS_ENSURE_ARG(aContextPosition); - - *aContextPosition = 1; - *aContextSize = 1; - - if (mBoundNode && aContextNode) - CallQueryInterface(mBoundNode, aContextNode); // addrefs - aModelID = mModelID; - - return NS_OK; -} - // Factory NS_HIDDEN_(nsresult) NS_NewXFormsGroupElement(nsIXTFElement **aResult) diff --git a/extensions/xforms/nsXFormsInputElement.cpp b/extensions/xforms/nsXFormsInputElement.cpp index 0c37ea4d73dc..8a08509a29e2 100644 --- a/extensions/xforms/nsXFormsInputElement.cpp +++ b/extensions/xforms/nsXFormsInputElement.cpp @@ -111,9 +111,8 @@ private: PRBool mIncremental; }; -NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputElement, - nsXFormsXMLVisualStub, - nsIXFormsControl, +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsInputElement, + nsXFormsControlStub, nsIDOMFocusListener, nsIDOMEventListener) diff --git a/extensions/xforms/nsXFormsLabelElement.cpp b/extensions/xforms/nsXFormsLabelElement.cpp index 4fa0de9caea9..21b834adb342 100644 --- a/extensions/xforms/nsXFormsLabelElement.cpp +++ b/extensions/xforms/nsXFormsLabelElement.cpp @@ -55,8 +55,6 @@ class nsXFormsLabelElement : public nsXFormsControlStub { public: - NS_DECL_ISUPPORTS_INHERITED - // nsIXFormsControl NS_IMETHOD Refresh(); @@ -79,10 +77,6 @@ private: nsCOMPtr mInnerSpan; }; -NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsLabelElement, - nsXFormsXMLVisualStub, - nsIXFormsControl) - NS_IMETHODIMP nsXFormsLabelElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) { diff --git a/extensions/xforms/nsXFormsOutputElement.cpp b/extensions/xforms/nsXFormsOutputElement.cpp index 5f0a5dc4622a..4fb802cb892c 100755 --- a/extensions/xforms/nsXFormsOutputElement.cpp +++ b/extensions/xforms/nsXFormsOutputElement.cpp @@ -68,8 +68,6 @@ class nsXFormsOutputElement : public nsXFormsControlStub { public: - NS_DECL_ISUPPORTS_INHERITED - // nsIXTFXMLVisual overrides NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper); @@ -93,10 +91,6 @@ private: PRBool mHasBinding; }; -NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsOutputElement, - nsXFormsXMLVisualStub, - nsIXFormsControl) - // nsIXTFXMLVisual NS_IMETHODIMP diff --git a/extensions/xforms/nsXFormsRepeatElement.cpp b/extensions/xforms/nsXFormsRepeatElement.cpp index 462eeefe59e5..464c04fe673f 100644 --- a/extensions/xforms/nsXFormsRepeatElement.cpp +++ b/extensions/xforms/nsXFormsRepeatElement.cpp @@ -143,8 +143,6 @@ protected: const PRUint16 aType); public: - NS_DECL_ISUPPORTS_INHERITED - // nsIXTFXMLVisual overrides NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper); @@ -166,11 +164,6 @@ public: nsXFormsRepeatElement() : mAddingChildren(PR_FALSE) {}; }; -NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsRepeatElement, - nsXFormsXMLVisualStub, - nsIXFormsControl) - - // nsIXTFXMLVisual NS_IMETHODIMP nsXFormsRepeatElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) @@ -450,7 +443,9 @@ nsXFormsRepeatElement::TryFocus(PRBool* aOK) * only live here until this is implemented there. (XXX) */ nsresult -nsXFormsRepeatElement::GetIntAttr(const nsAString& aName, PRInt32* aVal, const PRUint16 aType) +nsXFormsRepeatElement::GetIntAttr(const nsAString &aName, + PRInt32 *aVal, + const PRUint16 aType) { nsresult rv = NS_OK; diff --git a/extensions/xforms/nsXFormsSelectElement.cpp b/extensions/xforms/nsXFormsSelectElement.cpp index 028f31cf9e4c..25ca04f170c8 100644 --- a/extensions/xforms/nsXFormsSelectElement.cpp +++ b/extensions/xforms/nsXFormsSelectElement.cpp @@ -95,9 +95,8 @@ private: nsVoidArray mOptions; }; -NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsSelectElement, - nsXFormsXMLVisualStub, - nsIXFormsControl, +NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsSelectElement, + nsXFormsControlStub, nsIDOMEventListener) // nsIXTFXMLVisual diff --git a/extensions/xforms/nsXFormsSwitchElement.cpp b/extensions/xforms/nsXFormsSwitchElement.cpp index 07689c0e0d1d..d6c655ac0f7a 100644 --- a/extensions/xforms/nsXFormsSwitchElement.cpp +++ b/extensions/xforms/nsXFormsSwitchElement.cpp @@ -55,29 +55,25 @@ #include "nsIModelElementPrivate.h" #include "nsIXFormsSwitchElement.h" #include "nsIXFormsCaseElement.h" -#include "nsIXFormsContextControl.h" /** * Implementation of the XForms \ element. * * @see http://www.w3.org/TR/xforms/slice9.html#id2631571 - * - * The implementation of the context control is based on - * nsXFormsGroupElement. */ class nsXFormsSwitchElement : public nsIXFormsSwitchElement, - public nsIXFormsContextControl, public nsXFormsControlStub { public: - nsXFormsSwitchElement(); + nsXFormsSwitchElement() : mAddingChildren(PR_FALSE) {} NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD ChildInserted(nsIDOMNode *aChild, PRUint32 aIndex); NS_IMETHOD ChildAppended(nsIDOMNode *aChild); NS_IMETHOD WillRemoveChild(PRUint32 aIndex); + NS_IMETHOD BeginAddingChildren(); NS_IMETHOD DoneAddingChildren(); NS_IMETHOD OnDestroyed(); @@ -88,11 +84,8 @@ public: NS_DECL_NSIXFORMSSWITCHELEMENT // nsIXFormsControl - NS_IMETHOD Bind(); NS_IMETHOD Refresh(); - NS_DECL_NSIXFORMSCONTEXTCONTROL - private: /** * http://www.w3.org/TR/xforms/slice9.html#ui-case @@ -120,19 +113,13 @@ private: nsCOMPtr mVisual; nsCOMPtr mSelected; - PRBool mDoneAddingChildren; - nsString mModelID; + PRBool mAddingChildren; }; -nsXFormsSwitchElement::nsXFormsSwitchElement() : mDoneAddingChildren(PR_FALSE) -{ -} -NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsSwitchElement, - nsXFormsXMLVisualStub, - nsIXFormsSwitchElement, - nsIXFormsControl, - nsIXFormsContextControl) +NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsSwitchElement, + nsXFormsControlStub, + nsIXFormsSwitchElement) NS_IMETHODIMP nsXFormsSwitchElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) @@ -141,6 +128,7 @@ nsXFormsSwitchElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper) NS_ENSURE_SUCCESS(rv, rv); aWrapper->SetNotificationMask(kStandardNotificationMask | + nsIXTFElement::NOTIFY_BEGIN_ADDING_CHILDREN | nsIXTFElement::NOTIFY_DONE_ADDING_CHILDREN | nsIXTFElement::NOTIFY_CHILD_APPENDED | nsIXTFElement::NOTIFY_CHILD_INSERTED | @@ -183,7 +171,7 @@ nsXFormsSwitchElement::OnDestroyed() NS_IMETHODIMP nsXFormsSwitchElement::ChildInserted(nsIDOMNode *aChild, PRUint32 aIndex) { - if (mDoneAddingChildren) + if (!mAddingChildren) CaseChanged(aChild, PR_FALSE); return NS_OK; } @@ -191,7 +179,7 @@ nsXFormsSwitchElement::ChildInserted(nsIDOMNode *aChild, PRUint32 aIndex) NS_IMETHODIMP nsXFormsSwitchElement::ChildAppended(nsIDOMNode *aChild) { - if (mDoneAddingChildren) + if (!mAddingChildren) CaseChanged(aChild, PR_FALSE); return NS_OK; } @@ -199,7 +187,7 @@ nsXFormsSwitchElement::ChildAppended(nsIDOMNode *aChild) NS_IMETHODIMP nsXFormsSwitchElement::WillRemoveChild(PRUint32 aIndex) { - if (mDoneAddingChildren) { + if (!mAddingChildren) { nsCOMPtr list; mElement->GetChildNodes(getter_AddRefs(list)); if (list) { @@ -211,6 +199,13 @@ nsXFormsSwitchElement::WillRemoveChild(PRUint32 aIndex) return NS_OK; } +NS_IMETHODIMP +nsXFormsSwitchElement::BeginAddingChildren() +{ + mAddingChildren = PR_TRUE; + return NS_OK; +} + NS_IMETHODIMP nsXFormsSwitchElement::DoneAddingChildren() { @@ -218,29 +213,13 @@ nsXFormsSwitchElement::DoneAddingChildren() return NS_OK; Init(); - mDoneAddingChildren = PR_TRUE; + mAddingChildren = PR_FALSE; Refresh(); return NS_OK; } // nsIXFormsControl -NS_IMETHODIMP -nsXFormsSwitchElement::Bind() -{ - mModelID.Truncate(); - - // Re-evaluate what instance node this element is bound to. - ResetBoundNode(); - - // Get model ID - nsCOMPtr modelElement = do_QueryInterface(mModel); - NS_ENSURE_TRUE(modelElement, NS_ERROR_FAILURE); - modelElement->GetAttribute(NS_LITERAL_STRING("id"), mModelID); - - return NS_OK; -} - NS_IMETHODIMP nsXFormsSwitchElement::Refresh() { @@ -249,36 +228,6 @@ nsXFormsSwitchElement::Refresh() // nsXFormsSwitchElement -NS_IMETHODIMP -nsXFormsSwitchElement::SetContextNode(nsIDOMNode *aContextNode) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -nsresult -nsXFormsSwitchElement::GetContext(nsAString& aModelID, - nsIDOMNode **aContextNode, - PRInt32 *aContextPosition, - PRInt32 *aContextSize) -{ - NS_ENSURE_ARG(aContextSize); - NS_ENSURE_ARG(aContextPosition); - - /** @todo Not too elegant to call Process() here, but DoneAddingChildren is, - * logically, called on children before us. We need a notification - * that goes from the document node and DOWN, where the controls - * should Refresh(). - */ - *aContextPosition = 1; - *aContextSize = 1; - - if (mBoundNode && aContextNode) - CallQueryInterface(mBoundNode, aContextNode); // addrefs - aModelID = mModelID; - - return NS_OK; -} - void nsXFormsSwitchElement::Init(nsIDOMElement* aDeselected) { diff --git a/extensions/xforms/nsXFormsTriggerElement.cpp b/extensions/xforms/nsXFormsTriggerElement.cpp index 6fb34b44f1bf..53a4b128f488 100644 --- a/extensions/xforms/nsXFormsTriggerElement.cpp +++ b/extensions/xforms/nsXFormsTriggerElement.cpp @@ -52,8 +52,6 @@ class nsXFormsTriggerElement : public nsXFormsControlStub { public: - NS_DECL_ISUPPORTS_INHERITED - // nsIXTFXMLVisual overrides NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper); @@ -69,10 +67,6 @@ protected: nsCOMPtr mButton; }; -NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsTriggerElement, - nsXFormsXMLVisualStub, - nsIXFormsControl) - // nsIXTFXMLVisual NS_IMETHODIMP diff --git a/extensions/xforms/nsXFormsUploadElement.cpp b/extensions/xforms/nsXFormsUploadElement.cpp index 234398942c39..7282db6a354c 100644 --- a/extensions/xforms/nsXFormsUploadElement.cpp +++ b/extensions/xforms/nsXFormsUploadElement.cpp @@ -102,9 +102,8 @@ private: nsCOMPtr mInput; }; -NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsUploadElement, - nsXFormsXMLVisualStub, - nsIXFormsControl, +NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsUploadElement, + nsXFormsControlStub, nsIDOMFocusListener, nsIDOMEventListener) diff --git a/extensions/xforms/nsXFormsUtils.cpp b/extensions/xforms/nsXFormsUtils.cpp index c03b86d77482..192800aed2ca 100644 --- a/extensions/xforms/nsXFormsUtils.cpp +++ b/extensions/xforms/nsXFormsUtils.cpp @@ -316,7 +316,6 @@ nsXFormsUtils::GetModel(nsIDOMElement *aElement, PRUint32 aElementFlags) { - nsCOMPtr model; nsCOMPtr contextNode; nsCOMPtr bind; @@ -820,12 +819,15 @@ nsXFormsUtils::FindParentContext(nsIDOMElement *aElement, nsAutoString contextModelID; while (curNode) { nsCOMPtr contextControl = do_QueryInterface(curNode); - nsCOMPtr cElement = do_QueryInterface(curNode); - if (contextControl && cElement) { + + if (contextControl) { PRInt32 cSize; PRInt32 cPosition; nsCOMPtr tempNode; - rv = contextControl->GetContext(contextModelID, getter_AddRefs(tempNode), &cPosition, &cSize); + rv = contextControl->GetContext(contextModelID, + getter_AddRefs(tempNode), + &cPosition, + &cSize); NS_ENSURE_SUCCESS(rv, rv); // If the call failed, it means that we _have_ a parent which sets the // context but it is invalid, ie. the XPath expression could have