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

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: Fixed 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..50f3db031a2a3bbfedc89efaf25c93baf3593f4d 100644
--- a/Source/core/html/ColorInputType.cpp
+++ b/Source/core/html/ColorInputType.cpp
@@ -52,6 +52,9 @@ namespace WebCore {
using namespace HTMLNames;
+// Upper limit of number of datalist suggestions shown.
+static const unsigned maxSuggestions = 10000;
+
static bool isValidColorString(const String& value)
{
if (value.isEmpty())
@@ -224,9 +227,9 @@ bool ColorInputType::shouldShowSuggestions() const
return false;
}
-Vector<Color> ColorInputType::suggestions() const
+Vector<ColorSuggestion> ColorInputType::suggestions() const
{
- Vector<Color> suggestions;
+ Vector<ColorSuggestion> suggestions;
if (RuntimeEnabledFeatures::dataListElementEnabled()) {
HTMLDataListElement* dataList = element()->dataList();
if (dataList) {
@@ -237,7 +240,10 @@ Vector<Color> ColorInputType::suggestions() const
StyleColor color(option->value());
if (!color.isValid())
continue;
- suggestions.append(color.color());
+ ColorSuggestion suggestion(color.color(), color.color().serialized(), option->label());
+ suggestions.append(suggestion);
+ if (suggestions.size() >= maxSuggestions)
+ break;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698