Last Comment Bug 313118 - Disabled controls should match more than :disabled
: Disabled controls should match more than :disabled
Status: RESOLVED FIXED
: fixed1.8.0.5, fixed1.8.1
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Allan Beaufour
: Stephen Pride
:
Mentors:
http://www.w3.org/TR/2006/REC-xforms-...
: 330396 (view as bug list)
Depends on: 331911
Blocks: 329376
  Show dependency treegraph
 
Reported: 2005-10-20 04:45 PDT by Allan Beaufour
Modified: 2016-07-15 14:46 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Testcase (2.09 KB, application/xhtml+xml)
2006-04-05 09:07 PDT, Allan Beaufour
no flags Details
Patch (45.88 KB, patch)
2006-04-17 08:48 PDT, Allan Beaufour
doronr: review+
bugs: review+
Details | Diff | Splinter Review

Description Allan Beaufour 2005-10-20 04:45:19 PDT
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.
Comment 1 Allan Beaufour 2005-10-20 04:48:19 PDT
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.
Comment 2 Allan Beaufour 2006-04-05 09:07:32 PDT
Created attachment 217298 [details]
Testcase
Comment 3 Allan Beaufour 2006-04-06 05:10:06 PDT
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.
Comment 4 Allan Beaufour 2006-04-17 08:48:56 PDT
Created attachment 218694 [details] [diff] [review]
Patch

* 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
Comment 5 Allan Beaufour 2006-04-17 10:01:49 PDT
Upload is still not handling this properly, but let's fix that as part of bug 329376.
Comment 6 Olli Pettay [:smaug] (way behind * queues, especially ni? queue) 2006-04-19 01:09:37 PDT
Comment on attachment 218694 [details] [diff] [review]
Patch

looks good, r=me
Comment 7 Allan Beaufour 2006-04-19 01:24:16 PDT
Fixed on trunk
Comment 8 Allan Beaufour 2006-04-19 01:25:05 PDT
*** Bug 330396 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.