OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 return element()->document()->view()->contentsToRootView(element()->pixelSna ppedBoundingBox()); | 212 return element()->document()->view()->contentsToRootView(element()->pixelSna ppedBoundingBox()); |
213 } | 213 } |
214 | 214 |
215 Color ColorInputType::currentColor() | 215 Color ColorInputType::currentColor() |
216 { | 216 { |
217 return valueAsColor(); | 217 return valueAsColor(); |
218 } | 218 } |
219 | 219 |
220 bool ColorInputType::shouldShowSuggestions() const | 220 bool ColorInputType::shouldShowSuggestions() const |
221 { | 221 { |
222 #if ENABLE(DATALIST_ELEMENT) | |
223 return element()->fastHasAttribute(listAttr); | 222 return element()->fastHasAttribute(listAttr); |
tkent
2013/05/21 21:05:44
Needs runtime flag check.
| |
224 #else | |
225 return false; | |
226 #endif | |
227 } | 223 } |
228 | 224 |
229 Vector<Color> ColorInputType::suggestions() const | 225 Vector<Color> ColorInputType::suggestions() const |
230 { | 226 { |
231 Vector<Color> suggestions; | 227 Vector<Color> suggestions; |
232 #if ENABLE(DATALIST_ELEMENT) | |
233 HTMLDataListElement* dataList = element()->dataList(); | 228 HTMLDataListElement* dataList = element()->dataList(); |
234 if (dataList) { | 229 if (dataList) { |
235 RefPtr<HTMLCollection> options = dataList->options(); | 230 RefPtr<HTMLCollection> options = dataList->options(); |
236 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); i++) { | 231 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); i++) { |
237 if (!element()->isValidValue(option->value())) | 232 if (!element()->isValidValue(option->value())) |
238 continue; | 233 continue; |
239 Color color(option->value()); | 234 Color color(option->value()); |
240 if (!color.isValid()) | 235 if (!color.isValid()) |
241 continue; | 236 continue; |
242 suggestions.append(color); | 237 suggestions.append(color); |
243 } | 238 } |
244 } | 239 } |
245 #endif | |
246 return suggestions; | 240 return suggestions; |
247 } | 241 } |
248 | 242 |
249 } // namespace WebCore | 243 } // namespace WebCore |
250 | 244 |
251 #endif // ENABLE(INPUT_TYPE_COLOR) | 245 #endif // ENABLE(INPUT_TYPE_COLOR) |
OLD | NEW |