Closed Bug 280366 Opened 20 years ago Closed 19 years ago

Context is not set properly if parent only has model attribute

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

Attachments

(2 files)

The problem is that mBoundNode which is also used as context node, is only set
if there are node binding attributes (@ref / @bind).
Attached file Testcase
*** Bug 299274 has been marked as a duplicate of this bug. ***
Attached patch PatchSplinter Review
* Also triggers ResetBoundNode() routine if there is a model attribute
* If a control is not bound but has a model, GetContext() returns the document
element of the model's default instance document as the context node.
Attachment #189879 - Flags: review?(aaronr)
Have you forgotten this Aaron?
Comment on attachment 189879 [details] [diff] [review]
Patch


Ooops!	I did forget to review this patch.  Sorry!

>Index: nsXFormsControlStub.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsControlStub.cpp,v


>@@ -647,19 +661,17 @@
>                                               const nsAString &aValue)
> {
>   if (aName == nsXFormsAtoms::model ||
>       aName == nsXFormsAtoms::bind ||
>       aName == nsXFormsAtoms::ref) {
>     if (mModel)
>       mModel->RemoveFormControl(this);
> 
>-    if (aName != nsXFormsAtoms::model) {
>-      AddRemoveSNBAttr(aName, aValue);
>-    }
>+    AddRemoveSNBAttr(aName, aValue);
>   }
> }

I don't get why you want to increment mBindAttrsCount for an element that only
has a model attribute and thus allow it to go through the ProcessNodeBinding()
stuff.	To assign it a mModel and put the control on the control list for
mModel?

rest of the patch looks alright.
(In reply to comment #5)
> (From update of attachment 189879 [details] [diff] [review] [edit])
> I don't get why you want to increment mBindAttrsCount for an element that only
> has a model attribute and thus allow it to go through the ProcessNodeBinding()
> stuff.	To assign it a mModel and put the control on the control list for
> mModel?

Because of bug 299274. "somebody" finds it useful to go through the process of
finding the model if there's only a mode attribute.
Status: NEW → ASSIGNED
Comment on attachment 189879 [details] [diff] [review]
Patch

Ugh, that stinks that we'll have to go through the whole binding process
knowing that we'll never have a chance to find a bound node.  I guess if this
turns out to be a semi common case we'll have to think about optimizing it
somehow.
Attachment #189879 - Flags: review?(aaronr) → review+
Attachment #189879 - Flags: review?(smaug)
Comment on attachment 189879 [details] [diff] [review]
Patch

Could you use -p with diff.
But anyway, r=me
Attachment #189879 - Flags: review?(smaug) → review+
Checked in on trunk
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: