Disabled controls should match more than :disabled

RESOLVED FIXED

Status

Core Graveyard
XForms
RESOLVED FIXED
12 years ago
a year ago

People

(Reporter: Allan Beaufour, Assigned: Allan Beaufour)

Tracking

({fixed1.8.0.5, fixed1.8.1})

Trunk
fixed1.8.0.5, fixed1.8.1
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments)

2.09 KB, application/xhtml+xml
Details
45.88 KB, patch
Doron Rosenberg (IBM)
: review+
smaug
: review+
Details | Diff | Splinter Review
(Assignee)

Description

12 years ago
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.
(Assignee)

Comment 1

12 years ago
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.
(Assignee)

Updated

11 years ago
(Assignee)

Comment 2

11 years ago
Created attachment 217298 [details]
Testcase
(Assignee)

Comment 3

11 years ago
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
(Assignee)

Updated

11 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 4

11 years ago
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
Attachment #218694 - Flags: review?(doronr)

Updated

11 years ago
Attachment #218694 - Flags: review?(doronr) → review+
(Assignee)

Updated

11 years ago
Attachment #218694 - Flags: review?(Olli.Pettay)
(Assignee)

Comment 5

11 years ago
Upload is still not handling this properly, but let's fix that as part of bug 329376.
Blocks: 329376

Comment 6

11 years ago
Comment on attachment 218694 [details] [diff] [review]
Patch

looks good, r=me
Attachment #218694 - Flags: review?(Olli.Pettay) → review+
(Assignee)

Comment 7

11 years ago
Fixed on trunk
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
(Assignee)

Comment 8

11 years ago
*** Bug 330396 has been marked as a duplicate of this bug. ***
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.1
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.0.5
(Assignee)

Updated

11 years ago
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.