Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1127)

Side by Side Diff: Source/core/html/ColorInputType.cpp

Issue 14859003: Remove the compile time flag for DATALIST Element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebasing after r150849 Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #if ENABLE(INPUT_TYPE_COLOR) 32 #if ENABLE(INPUT_TYPE_COLOR)
33 #include "core/html/ColorInputType.h" 33 #include "core/html/ColorInputType.h"
34 34
35 #include "CSSPropertyNames.h" 35 #include "CSSPropertyNames.h"
36 #include "RuntimeEnabledFeatures.h"
36 #include "bindings/v8/ScriptController.h" 37 #include "bindings/v8/ScriptController.h"
37 #include "core/dom/MouseEvent.h" 38 #include "core/dom/MouseEvent.h"
38 #include "core/dom/shadow/ElementShadow.h" 39 #include "core/dom/shadow/ElementShadow.h"
39 #include "core/dom/shadow/ShadowRoot.h" 40 #include "core/dom/shadow/ShadowRoot.h"
40 #include "core/html/HTMLDataListElement.h" 41 #include "core/html/HTMLDataListElement.h"
41 #include "core/html/HTMLDivElement.h" 42 #include "core/html/HTMLDivElement.h"
42 #include "core/html/HTMLInputElement.h" 43 #include "core/html/HTMLInputElement.h"
43 #include "core/html/HTMLOptionElement.h" 44 #include "core/html/HTMLOptionElement.h"
44 #include "core/html/InputTypeNames.h" 45 #include "core/html/InputTypeNames.h"
45 #include "core/page/Chrome.h" 46 #include "core/page/Chrome.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return element()->document()->view()->contentsToRootView(element()->pixelSna ppedBoundingBox()); 213 return element()->document()->view()->contentsToRootView(element()->pixelSna ppedBoundingBox());
213 } 214 }
214 215
215 Color ColorInputType::currentColor() 216 Color ColorInputType::currentColor()
216 { 217 {
217 return valueAsColor(); 218 return valueAsColor();
218 } 219 }
219 220
220 bool ColorInputType::shouldShowSuggestions() const 221 bool ColorInputType::shouldShowSuggestions() const
221 { 222 {
222 #if ENABLE(DATALIST_ELEMENT) 223 if (RuntimeEnabledFeatures::dataListElementEnabled())
223 return element()->fastHasAttribute(listAttr); 224 return element()->fastHasAttribute(listAttr);
224 #else 225
225 return false; 226 return false;
226 #endif
227 } 227 }
228 228
229 Vector<Color> ColorInputType::suggestions() const 229 Vector<Color> ColorInputType::suggestions() const
230 { 230 {
231 Vector<Color> suggestions; 231 Vector<Color> suggestions;
232 #if ENABLE(DATALIST_ELEMENT) 232 if (RuntimeEnabledFeatures::dataListElementEnabled()) {
233 HTMLDataListElement* dataList = element()->dataList(); 233 HTMLDataListElement* dataList = element()->dataList();
234 if (dataList) { 234 if (dataList) {
235 RefPtr<HTMLCollection> options = dataList->options(); 235 RefPtr<HTMLCollection> options = dataList->options();
236 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); i++) { 236 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement (options->item(i)); i++) {
237 if (!element()->isValidValue(option->value())) 237 if (!element()->isValidValue(option->value()))
238 continue; 238 continue;
239 Color color(option->value()); 239 Color color(option->value());
240 if (!color.isValid()) 240 if (!color.isValid())
241 continue; 241 continue;
242 suggestions.append(color); 242 suggestions.append(color);
243 }
243 } 244 }
244 } 245 }
245 #endif
246 return suggestions; 246 return suggestions;
247 } 247 }
248 248
249 } // namespace WebCore 249 } // namespace WebCore
250 250
251 #endif // ENABLE(INPUT_TYPE_COLOR) 251 #endif // ENABLE(INPUT_TYPE_COLOR)
OLDNEW
« no previous file with comments | « Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp ('k') | Source/core/html/HTMLDataListElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698