Changeset 60232 in webkit
- Timestamp:
- May 26, 2010 6:12:40 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 26 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r60230 r60232 1 2010-05-26 yael aharon <yael.aharon@nokia.com> 2 3 Reviewed by Kent Tamura. 4 5 Support the labels attribute in labelable form controls 6 https://bugs.webkit.org/show_bug.cgi?id=38713 7 8 Update result for HTMLSelectElement, since it now includes the new attribute "labels" 9 * fast/dom/domListEnumeration-expected.txt: 10 * fast/dom/script-tests/domListEnumeration.js: 11 12 * fast/forms/labels-add-htmlFor-label-expected.txt: Added. 13 * fast/forms/labels-add-htmlFor-label.html: Added. 14 * fast/forms/labels-add-parent-label-expected.txt: Added. 15 * fast/forms/labels-add-parent-label.html: Added. 16 * fast/forms/labels-change-htmlFor-attribute-expected.txt: Added. 17 * fast/forms/labels-change-htmlFor-attribute.html: Added. 18 * fast/forms/labels-item-index-expected.txt: Added. 19 * fast/forms/labels-item-index.html: Added. 20 * fast/forms/labels-remove-htmlFor-attribute-expected.txt: Added. 21 * fast/forms/labels-remove-htmlFor-attribute.html: Added. 22 * fast/forms/labels-remove-htmlFor-label-expected.txt: Added. 23 * fast/forms/labels-remove-htmlFor-label.html: Added. 24 * fast/forms/labels-remove-parent-label-expected.txt: Added. 25 * fast/forms/labels-remove-parent-label.html: Added. 26 * fast/forms/labels-set-htmlFor-attribute-expected.txt: Added. 27 * fast/forms/labels-set-htmlFor-attribute.html: Added. 28 * fast/forms/script-tests/labels-add-htmlFor-label.js: Added. 29 * fast/forms/script-tests/labels-add-parent-label.js: Added. 30 * fast/forms/script-tests/labels-change-htmlFor-attribute.js: Added. 31 * fast/forms/script-tests/labels-item-index.js: Added. 32 * fast/forms/script-tests/labels-remove-htmlFor-attribute.js: Added. 33 * fast/forms/script-tests/labels-remove-htmlFor-label.js: Added. 34 * fast/forms/script-tests/labels-remove-parent-label.js: Added. 35 * fast/forms/script-tests/labels-set-htmlFor-attribute.js: Added. 36 1 37 2010-05-24 Jeremy Orlow <jorlow@chromium.org> 2 38 -
trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt
r51172 r60232 42 42 43 43 [object HTMLSelectElement] 44 PASS resultArray.length is 14 144 PASS resultArray.length is 142 45 45 PASS resultArray[0].i is '0' 46 46 PASS resultArray[0].item is document.getElementsByTagName('option')[0] -
trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js
r51172 r60232 142 142 var htmlSelectElement = document.getElementsByTagName('select')[0]; 143 143 resultArray = iterateList(htmlSelectElement); 144 shouldBe("resultArray.length", "14 1");144 shouldBe("resultArray.length", "142"); 145 145 shouldBe("resultArray[0].i", "'0'"); 146 146 shouldBe("resultArray[0].item", "document.getElementsByTagName('option')[0]"); -
trunk/WebCore/CMakeLists.txt
r60180 r60232 987 987 html/HTMLViewSourceDocument.cpp 988 988 html/ImageData.cpp 989 html/LabelsNodeList.cpp 989 990 html/PreloadScanner.cpp 990 991 html/StepRange.cpp -
trunk/WebCore/ChangeLog
r60231 r60232 1 2010-05-26 yael aharon <yael.aharon@nokia.com> 2 3 Reviewed by Kent Tamura. 4 5 Support the labels attribute in labelable form controls 6 https://bugs.webkit.org/show_bug.cgi?id=38713 7 8 Added a new cache type in NodeRareData to store the new cache type. 9 This cache is created on demand. 10 11 Added the "labels" attribute to all form controls that support this attribute. 12 13 Tests: fast/forms/labels-add-htmlFor-label.html 14 fast/forms/labels-add-parent-label.html 15 fast/forms/labels-change-htmlFor-attribute.html 16 fast/forms/labels-item-index.html 17 fast/forms/labels-remove-htmlFor-attribute.html 18 fast/forms/labels-remove-htmlFor-label.html 19 fast/forms/labels-remove-parent-label.html 20 fast/forms/labels-set-htmlFor-attribute.html 21 22 * CMakeLists.txt: 23 * GNUmakefile.am: 24 * WebCore.gypi: 25 * WebCore.pro: 26 * WebCore.vcproj/WebCore.vcproj: 27 * WebCore.xcodeproj/project.pbxproj: 28 * dom/Node.cpp: 29 (WebCore::Node::notifyLocalNodeListsLabelChanged): 30 (WebCore::Node::removeCachedLabelsNodeList): 31 (WebCore::NodeListsNodeData::invalidateCaches): 32 (WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes): 33 (WebCore::NodeListsNodeData::isEmpty): 34 * dom/Node.h: 35 * dom/NodeRareData.h: 36 (WebCore::NodeListsNodeData::NodeListsNodeData): 37 * html/HTMLButtonElement.idl: 38 * html/HTMLFormControlElement.cpp: 39 (WebCore::HTMLFormControlElement::isLabelable): 40 (WebCore::HTMLFormControlElement::labels): 41 * html/HTMLFormControlElement.h: 42 * html/HTMLInputElement.idl: 43 * html/HTMLLabelElement.cpp: 44 (WebCore::HTMLLabelElement::parseMappedAttribute): 45 * html/HTMLLabelElement.h: 46 * html/HTMLMeterElement.idl: 47 * html/HTMLProgressElement.idl: 48 * html/HTMLSelectElement.idl: 49 * html/HTMLTextAreaElement.idl: 50 * html/LabelsNodeList.cpp: Added. 51 (WebCore::LabelsNodeList::LabelsNodeList): 52 (WebCore::LabelsNodeList::~LabelsNodeList): 53 (WebCore::LabelsNodeList::nodeMatches): 54 * html/LabelsNodeList.h: Added. 55 (WebCore::LabelsNodeList::create): 56 1 57 2010-05-26 Xan Lopez <xlopez@igalia.com> 2 58 -
trunk/WebCore/GNUmakefile.am
r60230 r60232 1257 1257 WebCore/html/ImageData.cpp \ 1258 1258 WebCore/html/ImageData.h \ 1259 WebCore/html/LabelsNodeList.cpp \ 1260 WebCore/html/LabelsNodeList.h \ 1259 1261 WebCore/html/MediaError.h \ 1260 1262 WebCore/html/PreloadScanner.cpp \ -
trunk/WebCore/WebCore.gypi
r60230 r60232 1650 1650 'html/ImageData.cpp', 1651 1651 'html/ImageData.h', 1652 'html/LabelsNodeList.cpp', 1653 'html/LabelsNodeList.h', 1652 1654 'html/MediaError.h', 1653 1655 'html/PreloadScanner.cpp', -
trunk/WebCore/WebCore.pro
r60230 r60232 696 696 html/HTMLViewSourceDocument.cpp \ 697 697 html/ImageData.cpp \ 698 html/LabelsNodeList.cpp \ 698 699 html/PreloadScanner.cpp \ 699 700 html/StepRange.cpp \ … … 1426 1427 html/HTMLViewSourceDocument.h \ 1427 1428 html/ImageData.h \ 1429 html/LabelsNodeList.h \ 1428 1430 html/PreloadScanner.h \ 1429 1431 html/StepRange.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r60230 r60232 35234 35234 </File> 35235 35235 <File 35236 RelativePath="..\html\LabelsNodeList.cpp" 35237 > 35238 </File> 35239 <File 35240 RelativePath="..\html\LabelsNodeList.h" 35241 > 35242 </File> 35243 <File 35236 35244 RelativePath="..\html\MediaError.h" 35237 35245 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r60230 r60232 2590 2590 A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A454424C119B3687009BE912 /* RenderMeter.cpp */; }; 2591 2591 A454424F119B3687009BE912 /* RenderMeter.h in Headers */ = {isa = PBXBuildFile; fileRef = A454424D119B3687009BE912 /* RenderMeter.h */; }; 2592 A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */; }; 2593 A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A456FA2511AD4A830020B420 /* LabelsNodeList.h */; }; 2592 2594 A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */; }; 2593 2595 A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */; }; … … 8156 8158 A454424C119B3687009BE912 /* RenderMeter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMeter.cpp; sourceTree = "<group>"; }; 8157 8159 A454424D119B3687009BE912 /* RenderMeter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMeter.h; sourceTree = "<group>"; }; 8160 A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelsNodeList.cpp; sourceTree = "<group>"; }; 8161 A456FA2511AD4A830020B420 /* LabelsNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelsNodeList.h; sourceTree = "<group>"; }; 8158 8162 A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIPhone.h; path = iphone/KeyEventCodesIPhone.h; sourceTree = "<group>"; }; 8159 8163 A59E3C1D11580F510072928E /* KeyEventIPhone.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventIPhone.mm; path = iphone/KeyEventIPhone.mm; sourceTree = "<group>"; }; … … 13606 13610 A77979140D6B9D0C003851B9 /* ImageData.h */, 13607 13611 A77979150D6B9D0C003851B9 /* ImageData.idl */, 13612 A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, 13613 A456FA2511AD4A830020B420 /* LabelsNodeList.h */, 13608 13614 E446139B0CD6331000FADA75 /* MediaError.h */, 13609 13615 E446139C0CD6331000FADA75 /* MediaError.idl */, … … 19333 19339 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, 19334 19340 CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, 19341 A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */, 19335 19342 ); 19336 19343 runOnlyForDeploymentPostprocessing = 0; … … 21622 21629 E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 21623 21630 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, 21631 A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */, 21624 21632 ); 21625 21633 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/dom/Node.cpp
r60201 r60232 54 54 #include "InspectorTimelineAgent.h" 55 55 #include "KeyboardEvent.h" 56 #include "LabelsNodeList.h" 56 57 #include "Logging.h" 57 58 #include "MouseEvent.h" … … 897 898 } 898 899 900 void Node::notifyLocalNodeListsLabelChanged() 901 { 902 if (!hasRareData()) 903 return; 904 NodeRareData* data = rareData(); 905 if (!data->nodeLists()) 906 return; 907 908 if (data->nodeLists()->m_labelsNodeListCache) 909 data->nodeLists()->m_labelsNodeListCache->invalidateCache(); 910 } 911 899 912 void Node::removeCachedClassNodeList(ClassNodeList* list, const String& className) 900 913 { … … 928 941 ASSERT_UNUSED(list, list == data->m_tagNodeListCache.get(name.impl())); 929 942 data->m_tagNodeListCache.remove(name.impl()); 943 } 944 945 void Node::removeCachedLabelsNodeList(DynamicNodeList* list) 946 { 947 ASSERT(rareData()); 948 ASSERT(rareData()->nodeLists()); 949 ASSERT_UNUSED(list, list->hasOwnCaches()); 950 951 NodeListsNodeData* data = rareData()->nodeLists(); 952 data->m_labelsNodeListCache = 0; 930 953 } 931 954 … … 2207 2230 { 2208 2231 m_childNodeListCaches->reset(); 2232 2233 if (m_labelsNodeListCache) 2234 m_labelsNodeListCache->invalidateCache(); 2209 2235 TagNodeListCache::const_iterator tagCacheEnd = m_tagNodeListCache.end(); 2210 2236 for (TagNodeListCache::const_iterator it = m_tagNodeListCache.begin(); it != tagCacheEnd; ++it) … … 2222 2248 for (NameNodeListCache::iterator it = m_nameNodeListCache.begin(); it != nameCacheEnd; ++it) 2223 2249 it->second->invalidateCache(); 2250 if (m_labelsNodeListCache) 2251 m_labelsNodeListCache->invalidateCache(); 2224 2252 } 2225 2253 … … 2249 2277 return false; 2250 2278 } 2279 2280 if (m_labelsNodeListCache) 2281 return false; 2251 2282 2252 2283 return true; -
trunk/WebCore/dom/Node.h
r59072 r60232 528 528 void notifyNodeListsAttributeChanged(); 529 529 void notifyLocalNodeListsAttributeChanged(); 530 void notifyLocalNodeListsLabelChanged(); 530 531 void removeCachedClassNodeList(ClassNodeList*, const String&); 531 532 void removeCachedNameNodeList(NameNodeList*, const String&); 532 533 void removeCachedTagNodeList(TagNodeList*, const QualifiedName&); 534 void removeCachedLabelsNodeList(DynamicNodeList*); 533 535 534 536 PassRefPtr<NodeList> getElementsByTagName(const String&); -
trunk/WebCore/dom/NodeRareData.h
r59058 r60232 52 52 TagNodeListCache m_tagNodeListCache; 53 53 54 RefPtr<DynamicNodeList> m_labelsNodeListCache; 55 54 56 static PassOwnPtr<NodeListsNodeData> create() 55 57 { … … 63 65 private: 64 66 NodeListsNodeData() 65 : m_childNodeListCaches(DynamicNodeList::Caches::create()) 67 : m_childNodeListCaches(DynamicNodeList::Caches::create()), m_labelsNodeListCache(0) 66 68 { 67 69 } -
trunk/WebCore/html/HTMLButtonElement.idl
r52921 r60232 36 36 void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); 37 37 void click(); 38 readonly attribute NodeList labels; 38 39 }; 39 40 -
trunk/WebCore/html/HTMLFormControlElement.cpp
r59773 r60232 31 31 #include "ChromeClient.h" 32 32 #include "Document.h" 33 #include "ElementRareData.h" 33 34 #include "Event.h" 34 35 #include "EventHandler.h" … … 40 41 #include "HTMLParser.h" 41 42 #include "HTMLTokenizer.h" 43 #include "LabelsNodeList.h" 42 44 #include "Page.h" 43 45 #include "RenderBox.h" … … 407 409 // FIXME: Add meterTag and outputTag to the list once we support them. 408 410 return hasTagName(buttonTag) || hasTagName(inputTag) || hasTagName(keygenTag) 411 #if ENABLE(METER_TAG) 412 || hasTagName(meterTag) 413 #endif 409 414 #if ENABLE(PROGRESS_TAG) 410 415 || hasTagName(progressTag) 411 416 #endif 412 417 || hasTagName(selectTag) || hasTagName(textareaTag); 418 } 419 420 PassRefPtr<NodeList> HTMLFormControlElement::labels() 421 { 422 if (!isLabelable()) 423 return 0; 424 if (!document()) 425 return 0; 426 427 NodeRareData* data = Node::ensureRareData(); 428 if (!data->nodeLists()) { 429 data->setNodeLists(NodeListsNodeData::create()); 430 document()->addNodeListCache(); 431 } 432 433 return LabelsNodeList::create(this); 413 434 } 414 435 -
trunk/WebCore/html/HTMLFormControlElement.h
r59773 r60232 124 124 125 125 bool isLabelable() const; 126 PassRefPtr<NodeList> labels(); 126 127 127 128 protected: -
trunk/WebCore/html/HTMLInputElement.idl
r53893 r60232 96 96 97 97 readonly attribute FileList files; 98 readonly attribute NodeList labels; 98 99 }; 99 100 -
trunk/WebCore/html/HTMLLabelElement.cpp
r59248 r60232 174 174 } 175 175 176 void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) 177 { 178 if (attribute->name() == forAttr) { 179 // htmlFor attribute change affects other nodes than this. 180 // Clear the caches to ensure that the labels caches are cleared. 181 if (document()) 182 document()->notifyLocalNodeListsLabelChanged(); 183 } else 184 HTMLElement::parseMappedAttribute(attribute); 185 } 186 176 187 } // namespace -
trunk/WebCore/html/HTMLLabelElement.h
r59248 r60232 52 52 String accessKey() const; 53 53 void setAccessKey(const String&); 54 54 55 55 String htmlFor() const; 56 56 void setHtmlFor(const String&); … … 59 59 60 60 private: 61 virtual void parseMappedAttribute(Attribute*); 62 61 63 String m_formElementID; 62 64 }; -
trunk/WebCore/html/HTMLMeterElement.idl
r59541 r60232 35 35 setter raises(DOMException); 36 36 readonly attribute HTMLFormElement form; 37 readonly attribute NodeList labels; 37 38 }; 38 39 } -
trunk/WebCore/html/HTMLProgressElement.idl
r58687 r60232 28 28 readonly attribute double position; 29 29 readonly attribute HTMLFormElement form; 30 readonly attribute NodeList labels; 30 31 }; 31 32 -
trunk/WebCore/html/HTMLSelectElement.idl
r52921 r60232 69 69 Node item(in [IsIndex] unsigned long index); 70 70 Node namedItem(in DOMString name); 71 readonly attribute NodeList labels; 71 72 }; 72 73 -
trunk/WebCore/html/HTMLTextAreaElement.idl
r52921 r60232 51 51 attribute long selectionEnd; 52 52 void setSelectionRange(in long start, in long end); 53 readonly attribute NodeList labels; 53 54 }; 54 55
Note: See TracChangeset
for help on using the changeset viewer.