Changeset 207276 in webkit


Ignore:
Timestamp:
Oct 12, 2016 9:13:49 PM (8 years ago)
Author:
Chris Dumez
Message:

Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements
https://bugs.webkit.org/show_bug.cgi?id=163358

Reviewed by Kent Tamura.

Source/WebCore:

Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements.
As per the specification, we only want optgroup elements that are direct
children of the select element. This also matches the behavior of Chrome.

Test: fast/dom/HTMLSelectElement/nested-optgroup.html

  • html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::recalcListItems):

LayoutTests:

Add layout test coverage.

  • fast/dom/HTMLSelectElement/nested-optgroup-expected.txt: Added.
  • fast/dom/HTMLSelectElement/nested-optgroup.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207275 r207276  
     12016-10-12  Chris Dumez  <cdumez@apple.com>
     2
     3        Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements
     4        https://bugs.webkit.org/show_bug.cgi?id=163358
     5
     6        Reviewed by Kent Tamura.
     7
     8        Add layout test coverage.
     9
     10        * fast/dom/HTMLSelectElement/nested-optgroup-expected.txt: Added.
     11        * fast/dom/HTMLSelectElement/nested-optgroup.html: Added.
     12
    1132016-10-12  Zalan Bujtas  <zalan@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r207275 r207276  
     12016-10-12  Chris Dumez  <cdumez@apple.com>
     2
     3        Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements
     4        https://bugs.webkit.org/show_bug.cgi?id=163358
     5
     6        Reviewed by Kent Tamura.
     7
     8        Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements.
     9        As per the specification, we only want optgroup elements that are direct
     10        children of the select element. This also matches the behavior of Chrome.
     11
     12        Test: fast/dom/HTMLSelectElement/nested-optgroup.html
     13
     14        * html/HTMLSelectElement.cpp:
     15        (WebCore::HTMLSelectElement::recalcListItems):
     16
    1172016-10-12  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r207010 r207276  
    771771        HTMLElement& current = downcast<HTMLElement>(*currentElement);
    772772
    773         // optgroup tags may not nest. However, both FireFox and IE will
    774         // flatten the tree automatically, so we follow suit.
    775         // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6)
    776         if (is<HTMLOptGroupElement>(current)) {
     773        // Only consider optgroup elements that are direct children of the select element.
     774        if (is<HTMLOptGroupElement>(current) && current.parentNode() == this) {
    777775            m_listItems.append(&current);
    778776            if (Element* nextElement = ElementTraversal::firstWithin(current)) {
Note: See TracChangeset for help on using the changeset viewer.