Skip to content

Commit

Permalink
CSS Parser : Move parseSystemColor implementation out of BisonCSSParser
Browse files Browse the repository at this point in the history
The implementation doesn't depend on Bison, it is common to
both CSS parser implementations.

BUG=330389

Review URL: https://codereview.chromium.org/839453007

git-svn-id: svn://svn.chromium.org/blink/trunk@188290 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
darktears committed Jan 13, 2015
1 parent da6813b commit 9a371a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
14 changes: 0 additions & 14 deletions third_party/WebKit/Source/core/css/parser/BisonCSSParser-in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/rendering/RenderTheme.h"
#include "platform/FloatConversion.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/BitArray.h"
Expand Down Expand Up @@ -232,19 +231,6 @@ bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropert
return ok;
}

bool BisonCSSParser::parseSystemColor(RGBA32& color, const String& string)
{
CSSParserString cssColor;
cssColor.init(string);
CSSValueID id = cssValueKeywordID(cssColor);
if (!CSSPropertyParser::isSystemColor(id))
return false;

Color parsedColor = RenderTheme::theme().systemColor(id);
color = parsedColor.rgb();
return true;
}

void BisonCSSParser::parseSelector(const String& string, CSSSelectorList& selectorList)
{
m_selectorListForParseSelector = &selectorList;
Expand Down
1 change: 0 additions & 1 deletion third_party/WebKit/Source/core/css/parser/BisonCSSParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class BisonCSSParser {
PassRefPtrWillBeRawPtr<StyleRuleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
bool parseSupportsCondition(const String&);
static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String&, bool important, const CSSParserContext&);
static bool parseSystemColor(RGBA32& color, const String&);
bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObserver*, StyleSheetContents* contextStyleSheet);
static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(const String&, Element*);
PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&);
Expand Down
11 changes: 10 additions & 1 deletion third_party/WebKit/Source/core/css/parser/CSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "core/css/parser/CSSParserImpl.h"
#include "core/css/parser/CSSSelectorParser.h"
#include "core/css/parser/CSSTokenizer.h"
#include "core/rendering/RenderTheme.h"

namespace blink {

Expand Down Expand Up @@ -162,7 +163,15 @@ StyleColor CSSParser::colorFromRGBColorString(const String& string)

bool CSSParser::parseSystemColor(RGBA32& color, const String& colorString)
{
return BisonCSSParser::parseSystemColor(color, colorString);
CSSParserString cssColor;
cssColor.init(colorString);
CSSValueID id = cssValueKeywordID(cssColor);
if (!CSSPropertyParser::isSystemColor(id))
return false;

Color parsedColor = RenderTheme::theme().systemColor(id);
color = parsedColor.rgb();
return true;
}

} // namespace blink

0 comments on commit 9a371a0

Please sign in to comment.