Changeset 115704 in webkit
- Timestamp:
- Apr 30, 2012 7:53:15 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r115700 r115704 1 2012-04-30 Keishi Hattori <keishi@webkit.org> 2 3 datalist: Inconsistent behavior of HTMLInputElement::list 4 https://bugs.webkit.org/show_bug.cgi?id=84351 5 6 Reviewed by Kent Tamura. 7 8 * fast/forms/datalist/input-list-expected.txt: 9 * fast/forms/datalist/input-list.html: Added tests for all input types. 10 * platform/chromium/fast/forms/datalist/input-list-expected.txt: Added. 11 1 12 2012-04-30 Koji Ishii <kojiishi@gmail.com> 2 13 -
trunk/LayoutTests/fast/forms/datalist/input-list-expected.txt
r113137 r115704 7 7 PASS input.list is null 8 8 PASS input.list is null 9 PASS input.list is document.getElementById("dl1")10 PASS input.list is null11 9 PASS datalist.className is "former" 10 PASS document.getElementById("text").list is document.getElementById("dl1") 11 PASS document.getElementById("search").list is document.getElementById("dl1") 12 PASS document.getElementById("url").list is document.getElementById("dl1") 13 PASS document.getElementById("telephone").list is document.getElementById("dl1") 14 PASS document.getElementById("email").list is document.getElementById("dl1") 15 PASS document.getElementById("datetime").list is document.getElementById("dl1") 16 PASS document.getElementById("date").list is document.getElementById("dl1") 17 PASS document.getElementById("month").list is document.getElementById("dl1") 18 PASS document.getElementById("week").list is document.getElementById("dl1") 19 PASS document.getElementById("time").list is document.getElementById("dl1") 20 PASS document.getElementById("datetime-local").list is document.getElementById("dl1") 21 PASS document.getElementById("number").list is document.getElementById("dl1") 22 PASS document.getElementById("range").list is document.getElementById("dl1") 23 PASS document.getElementById("color").list is document.getElementById("dl1") 24 PASS document.getElementById("hidden").list is null 25 PASS document.getElementById("password").list is null 26 PASS document.getElementById("checkbox").list is null 27 PASS document.getElementById("radio").list is null 28 PASS document.getElementById("file").list is null 29 PASS document.getElementById("submit").list is null 30 PASS document.getElementById("image").list is null 31 PASS document.getElementById("reset").list is null 32 PASS document.getElementById("button").list is null 12 33 PASS successfullyParsed is true 13 34 14 35 TEST COMPLETE 15 36 -
trunk/LayoutTests/fast/forms/datalist/input-list.html
r114990 r115704 8 8 <div id="console"></div> 9 9 10 <!-- No list attribute --> 11 <input type="text" id="i1"> 12 <!-- Empty list --> 13 <input type="text" id="i2" list=""> 14 <!-- Non-existent ID --> 15 <input type="text" id="i3" list="nonexist"> 16 <!-- Normal case --> 17 <input type="text" id="i4" list="dl1"> 18 <!-- Unsupported type --> 19 <input type="password" id="i5" list="dl1"> 20 <!-- ID confilict --> 21 <Input type="text" id="i6" list="dl2"> 10 <div style="display:none"> 11 <!-- No list attribute --> 12 <input type="text" id="i1"> 13 <!-- Empty list --> 14 <input type="text" id="i2" list=""> 15 <!-- Non-existent ID --> 16 <input type="text" id="i3" list="nonexist"> 17 <!-- ID confilict --> 18 <input type="text" id="i4" list="dl2"> 19 <!-- supported type --> 20 <input type="text" id="text" list="dl1"> 21 <input type="search" id="search" list="dl1"> 22 <input type="url" id="url" list="dl1"> 23 <input type="telephone" id="telephone" list="dl1"> 24 <input type="email" id="email" list="dl1"> 25 <input type="datetime" id="datetime" list="dl1"> 26 <input type="date" id="date" list="dl1"> 27 <input type="month" id="month" list="dl1"> 28 <input type="week" id="week" list="dl1"> 29 <input type="time" id="time" list="dl1"> 30 <input type="datetime-local" id="datetime-local" list="dl1"> 31 <input type="number" id="number" list="dl1"> 32 <input type="range" id="range" list="dl1"> 33 <input type="color" id="color" list="dl1"> 34 <!-- Unsupported type --> 35 <input type="hidden" id="hidden" list="dl1"> 36 <input type="password" id="password" list="dl1"> 37 <input type="checkbox" id="checkbox" list="dl1"> 38 <input type="radio" id="radio" list="dl1"> 39 <input type="file" id="file" list="dl1"> 40 <input type="submit" id="submit" list="dl1"> 41 <input type="image" id="image" list="dl1"> 42 <input type="reset" id="reset" list="dl1"> 43 <input type="button" id="button" list="dl1"> 44 </div> 22 45 23 46 <datalist id="dl1"> … … 44 67 shouldBeNull('input.list'); 45 68 46 input = document.getElementById('i4');47 shouldBe(' input.list', 'document.getElementById("dl1")');69 var datalist = document.getElementById('i4').list; 70 shouldBe('datalist.className', '"former"'); 48 71 49 input = document.getElementById('i5'); 50 shouldBeNull('input.list'); 72 shouldBe('document.getElementById("text").list', 'document.getElementById("dl1")'); 73 shouldBe('document.getElementById("search").list', 'document.getElementById("dl1")'); 74 shouldBe('document.getElementById("url").list', 'document.getElementById("dl1")'); 75 shouldBe('document.getElementById("telephone").list', 'document.getElementById("dl1")'); 76 shouldBe('document.getElementById("email").list', 'document.getElementById("dl1")'); 77 shouldBe('document.getElementById("datetime").list', 'document.getElementById("dl1")'); 78 shouldBe('document.getElementById("date").list', 'document.getElementById("dl1")'); 79 shouldBe('document.getElementById("month").list', 'document.getElementById("dl1")'); 80 shouldBe('document.getElementById("week").list', 'document.getElementById("dl1")'); 81 shouldBe('document.getElementById("time").list', 'document.getElementById("dl1")'); 82 shouldBe('document.getElementById("datetime-local").list', 'document.getElementById("dl1")'); 83 shouldBe('document.getElementById("number").list', 'document.getElementById("dl1")'); 84 shouldBe('document.getElementById("range").list', 'document.getElementById("dl1")'); 85 shouldBe('document.getElementById("color").list', 'document.getElementById("dl1")'); 51 86 52 var datalist = document.getElementById('i6').list; 53 shouldBe('datalist.className', '"former"'); 87 shouldBeNull('document.getElementById("hidden").list'); 88 shouldBeNull('document.getElementById("password").list'); 89 shouldBeNull('document.getElementById("checkbox").list'); 90 shouldBeNull('document.getElementById("radio").list'); 91 shouldBeNull('document.getElementById("file").list'); 92 shouldBeNull('document.getElementById("submit").list'); 93 shouldBeNull('document.getElementById("image").list'); 94 shouldBeNull('document.getElementById("reset").list'); 95 shouldBeNull('document.getElementById("button").list'); 96 54 97 </script> 55 98 <script src="../../../fast/js/resources/js-test-post.js"></script> -
trunk/Source/WebCore/ChangeLog
r115701 r115704 1 2012-04-30 Keishi Hattori <keishi@webkit.org> 2 3 datalist: Inconsistent behavior of HTMLInputElement::list 4 https://bugs.webkit.org/show_bug.cgi?id=84351 5 6 Each platform will have a different set of input types that support the datalist UI. 7 This patch makes shouldRespectListAttribute ask the RenderTheme if it supports datalist UI for that input type. 8 Thus making it possible to do feature detection with JS. 9 10 Reviewed by Kent Tamura. 11 12 * WebCore.gypi: Added RenderThemeChromiumCommon.{cpp,h} 13 * html/ColorInputType.cpp: 14 (WebCore::ColorInputType::shouldRespectListAttribute): 15 (WebCore): 16 * html/ColorInputType.h: 17 (ColorInputType): 18 * html/InputType.cpp: 19 (WebCore::InputType::themeSupportsDataListUI): Static method used by TextFieldInputType, RangeInputType, and ColorInputType. 20 (WebCore): 21 * html/InputType.h: 22 (InputType): 23 * html/RangeInputType.cpp: 24 (WebCore::RangeInputType::shouldRespectListAttribute): 25 * html/TextFieldInputType.cpp: 26 (WebCore::TextFieldInputType::shouldRespectListAttribute): 27 * rendering/RenderTheme.h: 28 (RenderTheme): 29 (WebCore::RenderTheme::supportsDataListUI): Returns true if the platform can show the datalist suggestions for a given input type. 30 * rendering/RenderThemeChromiumCommon.cpp: Added. 31 (WebCore): 32 (WebCore::RenderThemeChromiumCommon::supportsDataListUI): 33 * rendering/RenderThemeChromiumCommon.h: Added. 34 (WebCore): 35 (RenderThemeChromiumCommon): 36 * rendering/RenderThemeChromiumMac.h: 37 (RenderThemeChromiumMac): 38 * rendering/RenderThemeChromiumMac.mm: 39 (WebCore::RenderThemeChromiumMac::supportsDataListUI): 40 (WebCore): 41 * rendering/RenderThemeChromiumSkia.cpp: 42 (WebCore::RenderThemeChromiumMac::supportsDataListUI): 43 (WebCore): 44 * rendering/RenderThemeChromiumSkia.h: 45 (RenderThemeChromiumSkia): 46 1 47 2012-04-30 Levi Weintraub <leviw@chromium.org> 2 48 -
trunk/Source/WebCore/WebCore.gypi
r115600 r115704 4864 4864 'rendering/RenderThemeChromiumAndroid.cpp', 4865 4865 'rendering/RenderThemeChromiumAndroid.h', 4866 'rendering/RenderThemeChromiumCommon.cpp', 4867 'rendering/RenderThemeChromiumCommon.h', 4866 4868 'rendering/RenderThemeChromiumLinux.cpp', 4867 4869 'rendering/RenderThemeChromiumLinux.h', -
trunk/Source/WebCore/html/ColorInputType.cpp
r112658 r115704 156 156 } 157 157 158 bool ColorInputType::shouldRespectListAttribute() 159 { 160 return InputType::themeSupportsDataListUI(this); 161 } 162 158 163 void ColorInputType::didChooseColor(const Color& color) 159 164 { -
trunk/Source/WebCore/html/ColorInputType.h
r112658 r115704 59 59 virtual void handleDOMActivateEvent(Event*) OVERRIDE; 60 60 virtual void detach() OVERRIDE; 61 virtual bool shouldRespectListAttribute() OVERRIDE; 61 62 62 63 Color valueAsColor() const; -
trunk/Source/WebCore/html/InputType.cpp
r114360 r115704 55 55 #include "RegularExpression.h" 56 56 #include "RenderObject.h" 57 #include "RenderTheme.h" 57 58 #include "ResetInputType.h" 58 59 #include "RuntimeEnabledFeatures.h" … … 141 142 } 142 143 144 bool InputType::themeSupportsDataListUI(InputType* type) 145 { 146 Document* document = type->element()->document(); 147 RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme(); 148 return theme->supportsDataListUI(type->formControlType()); 149 } 150 143 151 bool InputType::isTextField() const 144 152 { -
trunk/Source/WebCore/html/InputType.h
r114360 r115704 80 80 static PassOwnPtr<InputType> createText(HTMLInputElement*); 81 81 virtual ~InputType(); 82 83 static bool themeSupportsDataListUI(InputType*); 82 84 83 85 virtual const AtomicString& formControlType() const = 0; -
trunk/Source/WebCore/html/RangeInputType.cpp
r108976 r115704 314 314 bool RangeInputType::shouldRespectListAttribute() 315 315 { 316 return true;316 return InputType::themeSupportsDataListUI(this); 317 317 } 318 318 -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r114360 r115704 386 386 bool TextFieldInputType::shouldRespectListAttribute() 387 387 { 388 return true;388 return InputType::themeSupportsDataListUI(this); 389 389 } 390 390 -
trunk/Source/WebCore/rendering/RenderTheme.h
r115097 r115704 131 131 // A method asking if the theme's controls actually care about redrawing when hovered. 132 132 virtual bool supportsHover(const RenderStyle*) const { return false; } 133 134 // A method asking if the platform is able to show datalist suggestions for a given input type. 135 virtual bool supportsDataListUI(const AtomicString&) const { return false; } 133 136 134 137 // Text selection colors. -
trunk/Source/WebCore/rendering/RenderThemeChromiumMac.h
r113030 r115704 25 25 #define RenderThemeChromiumMac_h 26 26 27 #import "RenderThemeChromiumCommon.h" 27 28 #import "RenderThemeMac.h" 28 29 … … 32 33 public: 33 34 static PassRefPtr<RenderTheme> create(); 35 36 virtual bool supportsDataListUI(const AtomicString& type) const OVERRIDE; 34 37 35 38 protected: -
trunk/Source/WebCore/rendering/RenderThemeChromiumMac.mm
r113030 r115704 72 72 } 73 73 74 bool RenderThemeChromiumMac::supportsDataListUI(const AtomicString& type) const 75 { 76 return RenderThemeChromiumCommon::supportsDataListUI(type); 77 } 78 74 79 bool RenderThemeChromiumMac::usesTestModeFocusRingColor() const 75 80 { -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp
r115672 r115704 126 126 } 127 127 128 bool RenderThemeChromiumSkia::supportsDataListUI(const AtomicString& type) const 129 { 130 return RenderThemeChromiumCommon::supportsDataListUI(type); 131 } 132 128 133 Color RenderThemeChromiumSkia::platformActiveSelectionBackgroundColor() const 129 134 { -
trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h
r115097 r115704 30 30 31 31 #include "RenderTheme.h" 32 #include "RenderThemeChromiumCommon.h" 32 33 33 34 namespace WebCore { … … 51 52 // A method asking if the theme is able to draw the focus ring. 52 53 virtual bool supportsFocusRing(const RenderStyle*) const; 54 55 virtual bool supportsDataListUI(const AtomicString& type) const OVERRIDE; 53 56 54 57 // The platform selection color.
Note: See TracChangeset
for help on using the changeset viewer.