Closed Bug 313118 Opened 19 years ago Closed 18 years ago

Disabled controls should match more than :disabled

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

(Keywords: fixed1.8.0.5, fixed1.8.1)

Attachments

(2 files)

from bug 271720 nsXFormsControlStubBase::ResetBoundNode() does:
    nsCOMPtr<nsIXTFElementWrapper> xtfWrap(do_QueryInterface(mElement));
    NS_ENSURE_STATE(xtfWrap);
    xtfWrap->SetIntrinsicState(NS_EVENT_STATE_DISABLED);

to disable a node. That's actually wrong. That only makes it match :disabled,
and _no_ other pseudo classes. We need to make it match the other pseudo classes
too I guess.

We need a nsXFormsUtils::DisableControl(nsIDOMElement *aElement). Upload (bug
275453) needs it too.
From the spec:
"The binding expression is evaluated to ensure that it points to a node that
exists. If this is not the case then the form control should behave in the same
manner as if it had bound to a model item with the relevant model item property
resolved to false."

It only mentions the relevant MIP.
Attached file Testcase
Hmm, this is more tricky than I originally thought. A control can have these states:
1) Not attached to model (no model in doc. or wrong @model)
2) Attached to model, but have no node binding
3) Attached to model, but have node binding pointing to /dev/null
4) Bound to model and have bound node
(and there is also the special case where the relevant property can be overriden by the control, if is bound to a node of the wrong type. For upload, that's bug 329376)

1) is a fatal error, and can be ignored
4) is clearly defined

But 2) and 3) needs a definition of what are the "standard" states for a control. For 2) it should be enabled, and 3) it should be disabled, but for the rest of the states? My guess is: read-write, optional, and valid, as these are the default MIP states if nothing else is defined.
Depends on: 331911
Status: NEW → ASSIGNED
Attached patch PatchSplinter Review
* nsXFormsControlStub::ResetBoundNode() disables the control if it has a valid binding pointing to /dev/null. It uses mAppearDisabled for this.

* The model now always sets the states, no matter if there is a bound node or not, to handle default state.

* nsXFormsControlStub::Refresh() triggers nsIModelElementPrivate->SetStates(), instead of the model doing so. (should take care of bug 300591 comment 4)

* Bind() returns NS_OK_XFORMS_DEFERRED if the binding was deferred

* nsXFormsOutputElement() is greatly simplified, and now stores the string result during Bind(), which is more accurate. (this cleanup also fixes bug 330396)

* nsXFormsUtils::EvaluateXPath now returns nsresult, to actually catch errors
Attachment #218694 - Flags: review?(doronr)
Attachment #218694 - Flags: review?(doronr) → review+
Attachment #218694 - Flags: review?(Olli.Pettay)
Upload is still not handling this properly, but let's fix that as part of bug 329376.
Blocks: 329376
Comment on attachment 218694 [details] [diff] [review]
Patch

looks good, r=me
Attachment #218694 - Flags: review?(Olli.Pettay) → review+
Fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
*** Bug 330396 has been marked as a duplicate of this bug. ***
Keywords: fixed1.8.1
Keywords: fixed1.8.0.5
Whiteboard: xf-to-branch
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: