Changeset 96721 in webkit
- Timestamp:
- Oct 5, 2011 10:41:52 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96719 r96721 1 2011-10-05 Sachin Puranik <jcqt43@motorola.com> 2 3 Spec change - option.label should be reflected like option.value 4 https://bugs.webkit.org/show_bug.cgi?id=68684 5 6 Reviewed by Darin Adler. 7 8 IDL "Label" attribute of option element should return textContent IDL attribute 9 if conetent attribute "Label" is unavailable. Changed the tests to match 10 above said behaviour. Added new tests. 11 12 * fast/forms/option-label-trim-html-spaces-expected.txt: Html space triming test. 13 * fast/forms/option-label-trim-html-spaces.html: Html space triming test. 14 * fast/forms/option-value-and-label-changed-by-js-expected.txt: Attribute change from JS. 15 * fast/forms/option-value-and-label-changed-by-js.html: Attribute change from JS. 16 * fast/forms/option-value-and-label-expected.txt: Changed test case as per new spec. 17 * fast/forms/option-value-and-label.html: Changed test case as per new spec. 18 1 19 2011-10-05 Ilya Tikhonovsky <loislo@chromium.org> 2 20 -
trunk/LayoutTests/fast/forms/option-value-and-label-changed-by-js.html
r96720 r96721 10 10 11 11 <select> 12 <option id="o1"> text</option>13 <option id="o2" value="value"> text</option>14 <option id="o3" label="label"> text</option>12 <option id="o1"> text </option> 13 <option id="o2" value="value"> text </option> 14 <option id="o3" label="label"> text </option> 15 15 <option id="o4" value="value" label="label">text</option> 16 16 </select> … … 20 20 21 21 var o1 = document.getElementById('o1'); 22 shouldBe('o1.value', '"text"'); 23 shouldBe('o1.label', '""'); 22 o1.label = "newLabel" 23 o1.value = "newValue" 24 shouldBe('o1.value', '"newValue"'); 25 shouldBe('o1.label', '"newLabel"'); 24 26 25 27 var o2 = document.getElementById('o2'); 26 shouldBe('o2.value', '"value"'); 27 shouldBe('o2.label', '""'); 28 o2.label = "newLabel" 29 o2.value = "newValue" 30 shouldBe('o2.value', '"newValue"'); 31 shouldBe('o2.label', '"newLabel"'); 28 32 29 33 var o3 = document.getElementById('o3'); 30 shouldBe('o3.value', '"text"'); 31 shouldBe('o3.label', '"label"'); 34 o3.label = "newLabel" 35 o3.value = "newValue" 36 shouldBe('o3.value', '"newValue"'); 37 shouldBe('o3.label', '"newLabel"'); 32 38 33 39 var o4 = document.getElementById('o4'); 34 shouldBe('o4.value', '"value"'); 35 shouldBe('o4.label', '"label"'); 40 o4.label = "newLabel" 41 o4.value = "newValue" 42 shouldBe('o4.value', '"newValue"'); 43 shouldBe('o4.label', '"newLabel"'); 36 44 37 45 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/option-value-and-label-expected.txt
r46524 r96721 5 5 6 6 PASS o1.value is "text" 7 PASS o1.label is " "7 PASS o1.label is "text" 8 8 PASS o2.value is "value" 9 PASS o2.label is " "9 PASS o2.label is "text" 10 10 PASS o3.value is "text" 11 11 PASS o3.label is "label" -
trunk/LayoutTests/fast/forms/option-value-and-label.html
r46524 r96721 21 21 var o1 = document.getElementById('o1'); 22 22 shouldBe('o1.value', '"text"'); 23 shouldBe('o1.label', '" "');23 shouldBe('o1.label', '"text"'); 24 24 25 25 var o2 = document.getElementById('o2'); 26 26 shouldBe('o2.value', '"value"'); 27 shouldBe('o2.label', '" "');27 shouldBe('o2.label', '"text"'); 28 28 29 29 var o3 = document.getElementById('o3'); -
trunk/Source/WebCore/ChangeLog
r96720 r96721 1 2011-10-05 Sachin Puranik <jcqt43@motorola.com> 2 3 Spec change - option.label should be reflected like option.value 4 https://bugs.webkit.org/show_bug.cgi?id=68684 5 6 Reviewed by Darin Adler. 7 8 Incorporating the recent change in spec for label attribute of 9 option element. While retrieving the "Label" IDL attribute return 10 the "Label" content attribute if present , else return the 11 value of textContent attribute. 12 13 Tests: fast/forms/option-label-trim-html-spaces.html 14 fast/forms/option-value-and-label-changed-by-js.html 15 16 * dom/OptionElement.cpp: 17 (WebCore::OptionElement::normalizeText):style fixes 18 * dom/OptionElement.h: make collectOptionInnerText() protected. 19 * html/HTMLOptionElement.cpp: 20 (WebCore::HTMLOptionElement::label): return innerText if label attribute un-available. 21 (WebCore::HTMLOptionElement::setLabel):setLabel() implementation. 22 * html/HTMLOptionElement.h: add setLabel declaration. 23 * html/HTMLOptionElement.idl: Change reflect to ConvertNullToNullString in idl 24 1 25 2011-10-05 Rémi Duraffort <remi.duraffort@st.com> 2 26 -
trunk/Source/WebCore/dom/OptionElement.cpp
r95901 r96721 25 25 #include "Element.h" 26 26 #include "HTMLNames.h" 27 #include "HTMLOptionElement.h" 27 28 #include "HTMLParserIdioms.h" 28 #include "HTMLOptionElement.h"29 29 #include "OptionGroupElement.h" 30 30 #include "ScriptElement.h" … … 101 101 text = text.stripWhiteSpace(isHTMLSpace); 102 102 103 // We want to collapse our whitespace too. 103 // We want to collapse our whitespace too. This will match other browsers. 104 104 text = text.simplifyWhiteSpace(isHTMLSpace); 105 105 -
trunk/Source/WebCore/dom/OptionElement.h
r95901 r96721 49 49 static String collectOptionTextRespectingGroupLabel(const OptionElementData&, const Element*); 50 50 static String collectOptionValue(const OptionElementData&, const Element*); 51 static String collectOptionInnerText(const Element*); 51 52 private: 52 static String collectOptionInnerText(const Element*);53 53 static String normalizeText(const Document*, const String&); 54 54 }; -
trunk/Source/WebCore/html/HTMLOptionElement.cpp
r94659 r96721 6 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 7 7 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. 8 9 * 9 10 * This library is free software; you can redistribute it and/or … … 32 33 #include "ExceptionCode.h" 33 34 #include "HTMLNames.h" 35 #include "HTMLParserIdioms.h" 34 36 #include "HTMLSelectElement.h" 35 37 #include "NodeRenderStyle.h" … … 217 219 String HTMLOptionElement::label() const 218 220 { 219 return m_data.label(); 221 String label = m_data.label(); 222 if (!label.isNull()) 223 return label; 224 225 label = collectOptionInnerText(this).stripWhiteSpace(isHTMLSpace); 226 label = label.simplifyWhiteSpace(isHTMLSpace); 227 228 return label; 229 } 230 231 void HTMLOptionElement::setLabel(const String& label) 232 { 233 setAttribute(labelAttr, label); 220 234 } 221 235 -
trunk/Source/WebCore/html/HTMLOptionElement.h
r91404 r96721 59 59 60 60 String label() const; 61 void setLabel(const String&); 61 62 62 63 bool ownElementDisabled() const { return HTMLFormControlElement::disabled(); } … … 93 94 }; 94 95 95 } // namespace96 } // namespace 96 97 97 98 #endif -
trunk/Source/WebCore/html/HTMLOptionElement.idl
r89269 r96721 33 33 readonly attribute long index; 34 34 attribute [Reflect] boolean disabled; 35 attribute [ Reflect] DOMString label;35 attribute [ConvertNullToNullString] DOMString label; 36 36 attribute boolean selected; 37 37 attribute [ConvertNullToNullString] DOMString value;
Note: See TracChangeset
for help on using the changeset viewer.