| 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;
|
| }
|
| }
|
| }
|
|
|