Closed Bug 598329 Opened 15 years ago Closed 15 years ago

Disabled XUL widgets are displayed as if they were enabled

Categories

(Core :: Widget, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla2.0b7
Tracking Status
blocking2.0 --- beta7+

People

(Reporter: dao, Assigned: mounir)

References

Details

(Keywords: regression)

Attachments

(4 files, 1 obsolete file)

Attached image screenshot
No description provided.
blocking2.0: --- → ?
Actually this affects all sorts of widgets.
Summary: Disabled XUL toolbarbuttons react on mouseover as if they were enabled → Disabled XUL widgets react on mouseover as if they were enabled
Severity: normal → major
Summary: Disabled XUL widgets react on mouseover as if they were enabled → Disabled XUL widgets are displayed as if they were enabled
It looks like you inverted both screenshots, don't you?
Looks like part 4 of bug 557087 has to be the cause. I changed how widget was checking the disabled state of the elements using the content states instead of the disabled attribute. However, it looks like XUL elements behave differently... I can re-create a disabled method which will use NS_EVENT_STATE_DISABLED for HTML elements and something else for XUL ones but I guess if we do that, XUL elements will not look disabled when inside a disabled fieldset. But I guess we do not really care?
Attachment #477133 - Attachment description: more states, correct pre bug 557087 → more states, broken post bug 557087
Attachment #477134 - Attachment description: more states, broken post bug 557087 → more states, correct pre bug 557087
Attached patch Patch v1Splinter Review
Attachment #477356 - Flags: review?
Attachment #477356 - Flags: review? → review?(dao)
Status: NEW → ASSIGNED
Comment on attachment 477356 [details] [diff] [review] Patch v1 I'm not the right person to review this.
Attachment #477356 - Flags: review?(dao) → review?(roc)
+ // For XML/XUL elements, an attribute must be equal to the literal + // string "true" to be counted as true. An empty string should _not_ + // be counted as true. + return content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, + NS_LITERAL_STRING("true"), eCaseMatters); I don't think we should do this for all XML elements. Creating behaviour for the "disabled" attribute for all elements in all namespaces seems wrong. Let's just do this for XUL and check NS_EVENT_STATE_DISABLED for the other elements. Or maybe it would be even better for NS_EVENT_STATE_DISABLED state to be supported on XUL elements?
(In reply to comment #10) > + // For XML/XUL elements, an attribute must be equal to the literal > + // string "true" to be counted as true. An empty string should _not_ > + // be counted as true. > + return content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, > + NS_LITERAL_STRING("true"), eCaseMatters); > > I don't think we should do this for all XML elements. Creating behaviour for > the "disabled" attribute for all elements in all namespaces seems wrong. This is what CheckBoolAttr was doing. This new method very similar to CheckBookAttr except that it's looking at the content states instead of the attribute when the element an HTML element. Before, IsDisabled() was just calling CheckBoolAttr() with nsWidgetAtoms::disabled. > Let's just do this for XUL and check NS_EVENT_STATE_DISABLED for the other > elements. Or maybe it would be even better for NS_EVENT_STATE_DISABLED state to > be supported on XUL elements? Actually, I thought it would be hard to do that but given that you mentioned it I had a look at nsXULElement.cpp and it "seems" simple. I will try tomorrow.
Attached patch Patch v2 (obsolete) — Splinter Review
So, this patch is adding NS_EVENT_STATE_DISABLED and NS_EVENT_STATE_ENABLED to XUL elements when they can be disabled. Thank you for the suggestion roc :)
Attachment #477356 - Attachment is obsolete: true
Attachment #478119 - Flags: review?(hyatt)
Attachment #477356 - Flags: review?(roc)
Comment on attachment 478119 [details] [diff] [review] Patch v2 hyatt hasn't reviewed any Mozilla code for a long time :-)
Attachment #478119 - Flags: review?(hyatt) → review?(jst)
Boris, this patch is adding a QI in the IntrinsicState() method of nsXULElement. Do you think we should prevent that because it's too expensive? The other solutions would be to have an hardcoded list of XUL elements which can be disabled or having nsIDOMXULControlElement informs the element it can now be disabled. It might be others... that's the first time I touch content/xul/.
It'd be really nice to not have to QI there every time, yes... especially since that's not compatible with the direction I'd like to move states. ;) It looks like disabled == "is xul control and @disabled=='true'" right? And enabled == "is xul control and not disabled"? And of course whether we QI to XUL control depends on our XBL bindings, which depend on our style, which depends on whether we match :disabled, right? Given that, I think that trying to base :disabled/:enabled matching on the "is xul control" QI is just broken, pending XBL2 existing. Note that your code in this patch doesn't handle dynamic changes to the disabled state correctly, for example... So I'd prefer to not change the intrinsic state for XUL for now, use the "Let's just do this for XUL and check NS_EVENT_STATE_DISABLED for the other elements." approach for the moment, and then once we have xbl2 we can make the xul control stuff actually reflect its disabled state into the intrinsic state (via new API, if needed).
Comment on attachment 478119 [details] [diff] [review] Patch v2 I don't think this is a good approach as things stand. Too easy to shoot yourself with the resulting footgun.
Attachment #478119 - Flags: review?(jst) → review-
Comment on attachment 477356 [details] [diff] [review] Patch v1 Asking back a review for this patch per bz comment.
Attachment #477356 - Attachment is obsolete: false
Attachment #477356 - Flags: review?(roc)
Attachment #478119 - Attachment is obsolete: true
Given that this is a very visual regression I think we should take this for beta7.
blocking2.0: beta8+ → beta7+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing]
Target Milestone: --- → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: