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 |