Implement selectedOptions attribute of HTMLSelectElement.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 01:05:27 +0000 (01:05 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 01:05:27 +0000 (01:05 +0000)
commit0fcb5663d5032b82e1a5c7d78f615af403e5f702
tree6304d0548f5b4bf26a7e8f401490415c97073a50
parentc01022e7ae0a9070406dd32a205bab4da9dff9ae
Implement selectedOptions attribute of HTMLSelectElement.
https://bugs.webkit.org/show_bug.cgi?id=80631

Reviewed by Ryosuke Niwa.

Source/WebCore:

Add a new collection as a member of HTMLSelectElement which is
used to store the selected elements. Extend HTMLCollection to
support the new collection type needed by this feature. Make sure
that we invalidate the collection when the select state of an
option changes as the select state change does not trigger a dom
tree version change.

Reference : http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#dom-select-selectedoptions

Test: fast/dom/HTMLSelectElement/select-selectedOptions.html

* html/CollectionType.h:
* html/HTMLCollection.cpp:
(WebCore::shouldIncludeChildren):
(WebCore::HTMLCollection::clearCache):
(WebCore):
(WebCore::HTMLCollection::isAcceptableElement):
* html/HTMLCollection.h:
(HTMLCollection):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::setSelectedState):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::selectedOptions):
(WebCore):
(WebCore::HTMLSelectElement::invalidateSelectedItems):
(WebCore::HTMLSelectElement::setRecalcListItems):
* html/HTMLSelectElement.h:
(WebCore):
(HTMLSelectElement):
* html/HTMLSelectElement.idl:

LayoutTests:

New tests to cover the feature.

* fast/dom/HTMLSelectElement/select-selectedOptions-expected.txt: Added.
* fast/dom/HTMLSelectElement/select-selectedOptions.html: Added.
* fast/dom/htmlcollection-non-html-expected.txt:
* fast/dom/htmlcollection-non-html.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLSelectElement/select-selectedOptions-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLSelectElement/select-selectedOptions.html [new file with mode: 0644]
LayoutTests/fast/dom/htmlcollection-non-html-expected.txt
LayoutTests/fast/dom/htmlcollection-non-html.html
Source/WebCore/ChangeLog
Source/WebCore/html/CollectionType.h
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLCollection.h
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLSelectElement.idl