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

Unified Diff: Source/core/css/SVGCSSParser.cpp

Issue 14108013: CSS systemcolors should work in svg properties using <color>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add LayoutTest and isSystemColor function. Created 7 years, 8 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 | « LayoutTests/svg/css/css-systemcolors-expected.svg ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SVGCSSParser.cpp
diff --git a/Source/core/css/SVGCSSParser.cpp b/Source/core/css/SVGCSSParser.cpp
index e6e115e3424075e57f5b1aa0de91853cb5509bdb..5c2320372da75654d84fe085cd0b13ad63c78fc7 100644
--- a/Source/core/css/SVGCSSParser.cpp
+++ b/Source/core/css/SVGCSSParser.cpp
@@ -36,6 +36,11 @@ using namespace std;
namespace WebCore {
+static bool isSystemColor(int id)
+{
+ return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSSValueMenu;
+}
+
bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
{
CSSParserValue* value = m_valueList->current();
@@ -185,7 +190,7 @@ bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
parsedValue = SVGPaint::createNone();
else if (id == CSSValueCurrentcolor)
parsedValue = SVGPaint::createCurrentColor();
- else if ((id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSSValueMenu)
+ else if (isSystemColor(id))
parsedValue = SVGPaint::createColor(RenderTheme::defaultTheme()->systemColor(id));
else if (value->unit == CSSPrimitiveValue::CSS_URI) {
RGBA32 c = Color::transparent;
@@ -208,8 +213,10 @@ bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
case CSSPropertyStopColor: // TODO : icccolor
case CSSPropertyFloodColor:
case CSSPropertyLightingColor:
- if ((id >= CSSValueAqua && id <= CSSValueWindowtext) ||
- (id >= CSSValueAliceblue && id <= CSSValueYellowgreen))
+ if (isSystemColor(id))
+ parsedValue = SVGColor::createFromColor(RenderTheme::defaultTheme()->systemColor(id));
+ else if ((id >= CSSValueAqua && id <= CSSValueTransparent) ||
+ (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == CSSValueGrey)
parsedValue = SVGColor::createFromString(value->string);
else if (id == CSSValueCurrentcolor)
parsedValue = SVGColor::createCurrentColor();
« no previous file with comments | « LayoutTests/svg/css/css-systemcolors-expected.svg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698