Chromium Code Reviews| Index: Source/core/html/ColorInputType.cpp |
| diff --git a/Source/core/html/ColorInputType.cpp b/Source/core/html/ColorInputType.cpp |
| index 6c2c716f3464a467a4505c56071b1901bda1d342..57a98f5766aa0ea877ae5edbef26ee166154815f 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) |
|
tkent
2013/08/25 22:26:01
nit. >= is solider.
keishi
2013/08/26 05:29:15
Done.
|
| + break; |
| } |
| } |
| } |