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

Unified Diff: Source/core/dom/TextLinkColors.cpp

Issue 1232593004: Don't resolve extended color keywords during parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test expectations fixups. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/platform/graphics/Color.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TextLinkColors.cpp
diff --git a/Source/core/dom/TextLinkColors.cpp b/Source/core/dom/TextLinkColors.cpp
index 436294befcbcb73b33b49754ae7f5c3ca2abdb5d..fe0b08fe9edadfe8f1035fb4d8200ffffdcb8f13 100644
--- a/Source/core/dom/TextLinkColors.cpp
+++ b/Source/core/dom/TextLinkColors.cpp
@@ -59,37 +59,9 @@ void TextLinkColors::resetActiveLinkColor()
static Color colorForCSSValue(CSSValueID cssValueId)
{
- struct ColorValue {
- CSSValueID cssValueId;
- RGBA32 color;
- };
-
- static const ColorValue colorValues[] = {
- { CSSValueAqua, 0xFF00FFFF },
- { CSSValueBlack, 0xFF000000 },
- { CSSValueBlue, 0xFF0000FF },
- { CSSValueFuchsia, 0xFFFF00FF },
- { CSSValueGray, 0xFF808080 },
- { CSSValueGreen, 0xFF008000 },
- { CSSValueGrey, 0xFF808080 },
- { CSSValueLime, 0xFF00FF00 },
- { CSSValueMaroon, 0xFF800000 },
- { CSSValueNavy, 0xFF000080 },
- { CSSValueOlive, 0xFF808000 },
- { CSSValueOrange, 0xFFFFA500 },
- { CSSValuePurple, 0xFF800080 },
- { CSSValueRed, 0xFFFF0000 },
- { CSSValueSilver, 0xFFC0C0C0 },
- { CSSValueTeal, 0xFF008080 },
- { CSSValueTransparent, 0x00000000 },
- { CSSValueWhite, 0xFFFFFFFF },
- { CSSValueYellow, 0xFFFFFF00 },
- { CSSValueInvalid, CSSValueInvalid }
- };
-
- for (const ColorValue* col = colorValues; col->cssValueId; ++col) {
- if (col->cssValueId == cssValueId)
- return col->color;
+ if (const char* valueName = getValueName(cssValueId)) {
+ if (const NamedColor* namedColor = findColor(valueName, strlen(valueName)))
fs 2015/07/16 17:06:03 This is likely a bit slower than the previous code
+ return Color(namedColor->ARGBValue);
}
return LayoutTheme::theme().systemColor(cssValueId);
}
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/platform/graphics/Color.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698