Closed Bug 280017 Opened 20 years ago Closed 20 years ago

Let remaining controls implement nsIContextControl

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

Attachments

(1 file, 2 obsolete files)

Right now, only repeat, group and switch set their context through. All elements
that have a node binding should set context, coincidently :) that should be the
same elements that inherit from nsXFormsControl so it should be possible to put
in nsXFormsControlStub.
Status: NEW → ASSIGNED
Attached patch Patch v1 (obsolete) — Splinter Review
This patch makes nsIXFormsControl inherit nsIXFormsContextControl, and
implements it in nsXFormsControlStub, thus setting up the context for all
nsIXFormsControl-controls.

I believe it is rather crucial to have in the beta, as wrong contexts could
break a lot of forms.
Attachment #172814 - Flags: review?(aaronr)
Attachment #172814 - Flags: review?(aaronr) → review?(smaug)
Comment on attachment 172814 [details] [diff] [review]
Patch v1

>+NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsControlStub,
>+                             nsXFormsXMLVisualStub,
>+                             nsIXFormsContextControl,
>+                             nsIXFormsControl);

Remove ';'

>+  nsXFormsSwitchElement() : mAddingChildren(PR_FALSE) {};
And here


>+NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsSwitchElement,
>+                             nsXFormsControlStub,
>+                             nsIXFormsSwitchElement);
And here

> + * @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)
Would it be difficult to fix this now?

The changes to Switch element (mAddingChildren) look right though they are not
related to this bug.
Attachment #172814 - Flags: review?(smaug) → review+
(In reply to comment #2)
> > + * @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)
> Would it be difficult to fix this now?

You never know before you attack it, and I've learned my lesson with "the patch
from hell" :) So, I'd rather do a new bug on that. I'll create a new one, and
include a ref to it in the code.
Attached patch Patch with smaug's comments (obsolete) — Splinter Review
* removed the ';''s
* added a ref. to the bug with the "lone model" attribute bug 280366
* updated to current CVS
Attachment #172814 - Attachment is obsolete: true
Attachment #172827 - Flags: superreview?(bryner)
Attachment #172827 - Flags: superreview?(bryner)
Attachment #172827 - Attachment is obsolete: true
Attachment #173067 - Flags: superreview?(bryner)
Comment on attachment 173067 [details] [diff] [review]
Updated to current CVS

>--- xforms/nsXFormsControlStub.cpp	2005-02-01 09:47:24.204850760 +0100
>+++ xforms.contextcontrol/nsXFormsControlStub.cpp	2005-02-01 11:08:56.882741648 +0100
>+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

I would return the error code if this QI fails.  Or, if it should never fail,
add an NS_ASSERTION(*aContextNode).

Looks fine otherwise.
Attachment #173067 - Flags: superreview?(bryner) → superreview+
Fixed Brian's comment and checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 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: