OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/StyleColor.h" | 5 #include "core/css/StyleColor.h" |
6 | 6 |
7 #include "core/layout/LayoutTheme.h" | 7 #include "core/layout/LayoutTheme.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 Color StyleColor::colorFromKeyword(CSSValueID keyword) | 11 Color StyleColor::colorFromKeyword(CSSValueID keyword) |
12 { | 12 { |
13 if (const char* valueName = getValueName(keyword)) { | 13 if (const char* valueName = getValueName(keyword)) { |
14 if (const NamedColor* namedColor = findColor(valueName, strlen(valueName
))) | 14 if (const NamedColor* namedColor = findColor(valueName, strlen(valueName
))) |
15 return Color(namedColor->ARGBValue); | 15 return Color(namedColor->ARGBValue); |
16 } | 16 } |
17 return LayoutTheme::theme().systemColor(keyword); | 17 return LayoutTheme::theme().systemColor(keyword); |
18 } | 18 } |
19 | 19 |
| 20 bool StyleColor::isColorKeyword(CSSValueID id) |
| 21 { |
| 22 // Named colors and color keywords: |
| 23 // |
| 24 // <named-color> |
| 25 // 'aqua', 'black', 'blue', ..., 'yellow' (CSS3: "basic color keywords") |
| 26 // 'aliceblue', ..., 'yellowgreen' (CSS3: "extended color keywords"
) |
| 27 // 'transparent' |
| 28 // |
| 29 // 'currentcolor' |
| 30 // |
| 31 // <deprecated-system-color> |
| 32 // 'ActiveBorder', ..., 'WindowText' |
| 33 // |
| 34 // WebKit proprietary/internal: |
| 35 // '-webkit-link' |
| 36 // '-webkit-activelink' |
| 37 // '-internal-active-list-box-selection' |
| 38 // '-internal-active-list-box-selection-text' |
| 39 // '-internal-inactive-list-box-selection' |
| 40 // '-internal-inactive-list-box-selection-text' |
| 41 // '-webkit-focus-ring-color' |
| 42 // '-internal-quirk-inherit' |
| 43 // |
| 44 return (id >= CSSValueAqua && id <= CSSValueInternalQuirkInherit) |
| 45 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) |
| 46 || id == CSSValueMenu; |
| 47 } |
| 48 |
20 } // namespace blink | 49 } // namespace blink |
OLD | NEW |