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

Side by Side Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 184693003: Merge SVGCSSParser into CSSPropertyParser.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move isSystemColor to CSSPropertyParser for better reuse Created 6 years, 9 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/parser/CSSPropertyParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 1195
1196 bool BisonCSSParser::parseColor(const String& string) 1196 bool BisonCSSParser::parseColor(const String& string)
1197 { 1197 {
1198 setupParser("@-internal-decls color:", string, ""); 1198 setupParser("@-internal-decls color:", string, "");
1199 cssyyparse(this); 1199 cssyyparse(this);
1200 m_rule = nullptr; 1200 m_rule = nullptr;
1201 1201
1202 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C SSPropertyColor; 1202 return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == C SSPropertyColor;
1203 } 1203 }
1204 1204
1205 // FIXME: This is copied from SVGCSSParser.cpp
1206 static bool isSystemColor(int id)
1207 {
1208 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS ValueMenu;
1209 }
1210
1211 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string, Docum ent* document) 1205 bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string, Docum ent* document)
1212 { 1206 {
1213 if (!document) 1207 if (!document)
1214 return false; 1208 return false;
1215 1209
1216 CSSParserString cssColor; 1210 CSSParserString cssColor;
1217 cssColor.init(string); 1211 cssColor.init(string);
1218 CSSValueID id = cssValueKeywordID(cssColor); 1212 CSSValueID id = cssValueKeywordID(cssColor);
1219 if (!isSystemColor(id)) 1213 if (!CSSPropertyParser::isSystemColor(id))
1220 return false; 1214 return false;
1221 1215
1222 Color parsedColor = RenderTheme::theme().systemColor(id); 1216 Color parsedColor = RenderTheme::theme().systemColor(id);
1223 color = parsedColor.rgb(); 1217 color = parsedColor.rgb();
1224 return true; 1218 return true;
1225 } 1219 }
1226 1220
1227 void BisonCSSParser::parseSelector(const String& string, CSSSelectorList& select orList) 1221 void BisonCSSParser::parseSelector(const String& string, CSSSelectorList& select orList)
1228 { 1222 {
1229 m_selectorListForParseSelector = &selectorList; 1223 m_selectorListForParseSelector = &selectorList;
(...skipping 8938 matching lines...) Expand 10 before | Expand all | Expand 10 after
10168 { 10162 {
10169 // The tokenizer checks for the construct of an+b. 10163 // The tokenizer checks for the construct of an+b.
10170 // However, since the {ident} rule precedes the {nth} rule, some of those 10164 // However, since the {ident} rule precedes the {nth} rule, some of those
10171 // tokens are identified as string literal. Furthermore we need to accept 10165 // tokens are identified as string literal. Furthermore we need to accept
10172 // "odd" and "even" which does not match to an+b. 10166 // "odd" and "even" which does not match to an+b.
10173 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10167 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10174 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10168 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10175 } 10169 }
10176 10170
10177 } 10171 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/parser/CSSPropertyParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698