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

Unified Diff: Source/core/html/ColorInputType.cpp

Issue 23236002: Prepare for color input datalist support on Android (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added labels Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/ColorInputType.cpp
diff --git a/Source/core/html/ColorInputType.cpp b/Source/core/html/ColorInputType.cpp
index 6c2c716f3464a467a4505c56071b1901bda1d342..4df97a8baa02523b7a77486a41531fd21790d129 100644
--- a/Source/core/html/ColorInputType.cpp
+++ b/Source/core/html/ColorInputType.cpp
@@ -244,4 +244,24 @@ Vector<Color> ColorInputType::suggestions() const
return suggestions;
}
+Vector<String> ColorInputType::suggestionLabels() const
+{
+ Vector<String> suggestionLabels;
+ if (RuntimeEnabledFeatures::dataListElementEnabled()) {
+ HTMLDataListElement* dataList = element()->dataList();
+ if (dataList) {
+ RefPtr<HTMLCollection> options = dataList->options();
+ for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); i++) {
+ if (!element()->isValidValue(option->value()))
+ continue;
+ StyleColor color(option->value());
+ if (!color.isValid())
+ continue;
+ suggestionLabels.append(option->label());
+ }
+ }
+ }
+ return suggestionLabels;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698