Last Comment Bug 313118 - Disabled controls should match more than :disabled
: Disabled controls should match more than :disabled
: 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
: 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: ---

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 User image Allan Beaufour 2005-10-20 04:45:19 PDT
from bug 271720 nsXFormsControlStubBase::ResetBoundNode() does:
    nsCOMPtr<nsIXTFElementWrapper> xtfWrap(do_QueryInterface(mElement));

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 User image 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 User image Allan Beaufour 2006-04-05 09:07:32 PDT
Created attachment 217298 [details]
Comment 3 User image 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 User image Allan Beaufour 2006-04-17 08:48:56 PDT
Created attachment 218694 [details] [diff] [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
Comment 5 User image 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 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2006-04-19 01:09:37 PDT
Comment on attachment 218694 [details] [diff] [review]

looks good, r=me
Comment 7 User image Allan Beaufour 2006-04-19 01:24:16 PDT
Fixed on trunk
Comment 8 User image 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.