Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: third_party/WebKit/Source/core/css/StyleColor.cpp

Issue 2041363002: Move isColorKeyword out of CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alternative using StyleColor Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleColor.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698