Changeset 207181 in webkit


Ignore:
Timestamp:
Oct 11, 2016 5:25:55 PM (8 years ago)
Author:
Chris Dumez
Message:

select.options may return too many option elements
https://bugs.webkit.org/show_bug.cgi?id=163296

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import html/infrastructure web-platform-tests from upstream.

  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/contains.json: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection-expected.txt: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection-expected.txt: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection.html: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection-expected.txt: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist-expected.txt: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist.html: Added.
  • web-platform-tests/html/infrastructure/common-dom-interfaces/collections/w3c-import.log: Added.
  • web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/contains.json: Added.
  • web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/w3c-import.log: Added.
  • web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/contains.json: Added.
  • web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/w3c-import.log: Added.
  • web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign-expected.txt: Added.
  • web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign.html: Added.
  • web-platform-tests/html/infrastructure/conformance-requirements/extensibility/w3c-import.log: Added.
  • web-platform-tests/html/infrastructure/terminology/plugins/sample.txt: Added.
  • web-platform-tests/html/infrastructure/terminology/plugins/text-plain-expected.txt: Added.
  • web-platform-tests/html/infrastructure/terminology/plugins/text-plain.html: Added.
  • web-platform-tests/html/infrastructure/terminology/plugins/w3c-import.log: Added.

Source/WebCore:

select.options may return too many option elements. We're only supposed
to return the option element children of the select element, and the
option element children of all the optgroup element children of the
select element, in tree order:

Firefox and Chrome agrees with the specification. However, WebKit was
returning all the option elements that are descendants of the select
element.

Test: imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html

  • html/HTMLOptionsCollection.h:
Location:
trunk
Files:
31 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r207170 r207181  
     12016-10-11  Chris Dumez  <cdumez@apple.com>
     2
     3        select.options may return too many option elements
     4        https://bugs.webkit.org/show_bug.cgi?id=163296
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Import html/infrastructure web-platform-tests from upstream.
     9
     10        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/contains.json: Added.
     11        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection-expected.txt: Added.
     12        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html: Added.
     13        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection-expected.txt: Added.
     14        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection.html: Added.
     15        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection-expected.txt: Added.
     16        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html: Added.
     17        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist-expected.txt: Added.
     18        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/radionodelist.html: Added.
     19        * web-platform-tests/html/infrastructure/common-dom-interfaces/collections/w3c-import.log: Added.
     20        * web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/contains.json: Added.
     21        * web-platform-tests/html/infrastructure/common-microsyntaxes/dates-and-times/w3c-import.log: Added.
     22        * web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/contains.json: Added.
     23        * web-platform-tests/html/infrastructure/common-microsyntaxes/numbers/w3c-import.log: Added.
     24        * web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign-expected.txt: Added.
     25        * web-platform-tests/html/infrastructure/conformance-requirements/extensibility/foreign.html: Added.
     26        * web-platform-tests/html/infrastructure/conformance-requirements/extensibility/w3c-import.log: Added.
     27        * web-platform-tests/html/infrastructure/terminology/plugins/sample.txt: Added.
     28        * web-platform-tests/html/infrastructure/terminology/plugins/text-plain-expected.txt: Added.
     29        * web-platform-tests/html/infrastructure/terminology/plugins/text-plain.html: Added.
     30        * web-platform-tests/html/infrastructure/terminology/plugins/w3c-import.log: Added.
     31
    1322016-10-10  Ryosuke Niwa  <rniwa@webkit.org>
    233
  • trunk/Source/WebCore/ChangeLog

    r207177 r207181  
     12016-10-11  Chris Dumez  <cdumez@apple.com>
     2
     3        select.options may return too many option elements
     4        https://bugs.webkit.org/show_bug.cgi?id=163296
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        select.options may return too many option elements. We're only supposed
     9        to return the option element children of the select element, and the
     10        option element children of all the optgroup element children of the
     11        select element, in tree order:
     12        - https://html.spec.whatwg.org/#dom-select-options
     13        - https://html.spec.whatwg.org/#concept-select-option-list
     14
     15        Firefox and Chrome agrees with the specification. However, WebKit was
     16        returning all the option elements that are descendants of the select
     17        element.
     18
     19        Test: imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html
     20
     21        * html/HTMLOptionsCollection.h:
     22
    1232016-10-11  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/html/HTMLOptionsCollection.h

    r204717 r207181  
    7171inline bool HTMLOptionsCollection::elementMatches(Element& element) const
    7272{
    73     return element.hasTagName(HTMLNames::optionTag);
     73    if (!element.hasTagName(HTMLNames::optionTag))
     74        return false;
     75
     76    if (element.parentNode() == &selectElement())
     77        return true;
     78
     79    ASSERT(element.parentNode());
     80    return element.parentNode()->hasTagName(HTMLNames::optgroupTag) && element.parentNode()->parentNode() == &selectElement();
    7481}
    7582
Note: See TracChangeset for help on using the changeset viewer.