Support the labels attribute in labelable form controls
https://bugs.webkit.org/show_bug.cgi?id=38713
Reviewed by Kent Tamura.
WebCore:
Added a new cache type in NodeRareData to store the new cache type.
This cache is created on demand.
Added the "labels" attribute to all form controls that support this attribute.
Tests: fast/forms/labels-add-htmlFor-label.html
fast/forms/labels-add-parent-label.html
fast/forms/labels-change-htmlFor-attribute.html
fast/forms/labels-item-index.html
fast/forms/labels-remove-htmlFor-attribute.html
fast/forms/labels-remove-htmlFor-label.html
fast/forms/labels-remove-parent-label.html
fast/forms/labels-set-htmlFor-attribute.html
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/Node.cpp:
(WebCore::Node::notifyLocalNodeListsLabelChanged):
(WebCore::Node::removeCachedLabelsNodeList):
(WebCore::NodeListsNodeData::invalidateCaches):
(WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes):
(WebCore::NodeListsNodeData::isEmpty):
* dom/Node.h:
* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::NodeListsNodeData):
* html/HTMLButtonElement.idl:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isLabelable):
(WebCore::HTMLFormControlElement::labels):
* html/HTMLFormControlElement.h:
* html/HTMLInputElement.idl:
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::parseMappedAttribute):
* html/HTMLLabelElement.h:
* html/HTMLMeterElement.idl:
* html/HTMLProgressElement.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTextAreaElement.idl:
* html/LabelsNodeList.cpp: Added.
(WebCore::LabelsNodeList::LabelsNodeList):
(WebCore::LabelsNodeList::~LabelsNodeList):
(WebCore::LabelsNodeList::nodeMatches):
* html/LabelsNodeList.h: Added.
(WebCore::LabelsNodeList::create):
LayoutTests:
Update result for HTMLSelectElement, since it now includes the new attribute "labels"
* fast/dom/domListEnumeration-expected.txt:
* fast/dom/script-tests/domListEnumeration.js:
* fast/forms/labels-add-htmlFor-label-expected.txt: Added.
* fast/forms/labels-add-htmlFor-label.html: Added.
* fast/forms/labels-add-parent-label-expected.txt: Added.
* fast/forms/labels-add-parent-label.html: Added.
* fast/forms/labels-change-htmlFor-attribute-expected.txt: Added.
* fast/forms/labels-change-htmlFor-attribute.html: Added.
* fast/forms/labels-item-index-expected.txt: Added.
* fast/forms/labels-item-index.html: Added.
* fast/forms/labels-remove-htmlFor-attribute-expected.txt: Added.
* fast/forms/labels-remove-htmlFor-attribute.html: Added.
* fast/forms/labels-remove-htmlFor-label-expected.txt: Added.
* fast/forms/labels-remove-htmlFor-label.html: Added.
* fast/forms/labels-remove-parent-label-expected.txt: Added.
* fast/forms/labels-remove-parent-label.html: Added.
* fast/forms/labels-set-htmlFor-attribute-expected.txt: Added.
* fast/forms/labels-set-htmlFor-attribute.html: Added.
* fast/forms/script-tests/labels-add-htmlFor-label.js: Added.
* fast/forms/script-tests/labels-add-parent-label.js: Added.
* fast/forms/script-tests/labels-change-htmlFor-attribute.js: Added.
* fast/forms/script-tests/labels-item-index.js: Added.
* fast/forms/script-tests/labels-remove-htmlFor-attribute.js: Added.
* fast/forms/script-tests/labels-remove-htmlFor-label.js: Added.
* fast/forms/script-tests/labels-remove-parent-label.js: Added.
* fast/forms/script-tests/labels-set-htmlFor-attribute.js: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60232 268f45cc-cd09-0410-ab3c-d52691b4dbfc
49 files changed