RESOLVED FIXED92833
REGRESSION(r102741): [Forms] In selects, when disabled, browser skips first option if not in optgroup, then selects first option in optgroup
https://bugs.webkit.org/show_bug.cgi?id=92833
Summary REGRESSION(r102741): [Forms] In selects, when disabled, browser skips first o...
yosin
Reported 2012-07-31 20:46:53 PDT
The select element should pick up not "disable" option element for selected option when there is no "selected" option. HTMLSelectElement::recalcListItems() does this by checking HTMLOptionElement::option(). It seems implementation of HTMLOPtionElement::option() isn't matched to HTML5 specification[1]: An option element is disabled if its disabled attribute is present or if it is a child of an optgroup element whose disabled attribute is present. However, current implementation checks "disabled" attribute regardless element tag name: bool HTMLOptionElement::disabled() const { return ownElementDisabled() || (parentNode() && parentNode()->isHTMLElement() && static_cast<HTMLElement*>(parentNode())->disabled()); } In sample URI[2], the parent element is the "select" element having "disabled" attribute. So, HTMLOptionElement::disable() return true rather than false. This is the reason we pick up the first "option" element in the first "optgroup" element. = References = [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-option-element [2] http://jsfiddle.net/UZBKd/
Attachments
Patch 1 (89.60 KB, patch)
2012-08-01 23:11 PDT, yosin
no flags
Patch 2 (89.83 KB, patch)
2012-08-02 00:02 PDT, yosin
no flags
yosin
Comment 1 2012-07-31 20:53:18 PDT
This bug is imported from http://crbug.com/139823 The sample URI, http://jsfiddle.net/UZBKd/, should display "1" as other browsers, FireFox, IE, and Opera.
yosin
Comment 2 2012-08-01 23:11:39 PDT
yosin
Comment 3 2012-08-01 23:14:13 PDT
Comment on attachment 155978 [details] Patch 1 Could you review this patch? Thanks in advance.
Kent Tamura
Comment 4 2012-08-01 23:55:30 PDT
Comment on attachment 155978 [details] Patch 1 View in context: https://bugs.webkit.org/attachment.cgi?id=155978&action=review Need ChangeLog improvement > Source/WebCore/ChangeLog:9 > + This patch changes implementation of HTMLOptionElement::disabled() to > + follow HTML5 specification, the option element is disabled if option This is confusing. It's unclear that what part of the HTML5 specification it is. You should write ":disabled pseudo class" or add a link to the concept "disabled" [1] because "disabled" IDL attribute is different from it. [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#concept-option-disabled > Source/WebCore/ChangeLog:15 > + Before this patch, HTMLSelectElement::recalcListItems() didn't pick What do you mean by 'pick'?
yosin
Comment 5 2012-08-02 00:02:51 PDT
yosin
Comment 6 2012-08-02 00:03:56 PDT
Comment on attachment 155986 [details] Patch 2 Could you review this patch? Thanks in advance. = Changes since the last review = * Update Source/WebCore/ChangeLog as suggested.
Kent Tamura
Comment 7 2012-08-02 00:12:56 PDT
Comment on attachment 155986 [details] Patch 2 looks good.
yosin
Comment 8 2012-08-02 00:22:58 PDT
Comment on attachment 155986 [details] Patch 2 Clearing flags on attachment: 155986 Committed r124416: <http://trac.webkit.org/changeset/124416>
yosin
Comment 9 2012-08-02 00:23:04 PDT
All reviewed patches have been landed. Closing bug.
Dean Jackson
Comment 10 2012-08-08 15:22:45 PDT
This causes fast/forms/basic-selects.html to fail on Mac ports. I see the commit log says "Note: We need to rebaseline for all ports expect for Chromium-Linux.". Did this ever happen?
yosin
Comment 11 2012-08-08 20:50:03 PDT
(In reply to comment #10) > This causes fast/forms/basic-selects.html to fail on Mac ports. > > I see the commit log says "Note: We need to rebaseline for all ports expect for Chromium-Linux.". Did this ever happen? No, I updated for Chromium ports, but not for others. Could you update expected texts and images for Mac port? Thanks in advance.
Note You need to log in before you can comment on or make changes to this bug.