1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "core/css/parser/CSSParser.h"
8 #include "core/css/CSSKeyframeRule.h"
9 #include "core/css/StyleColor.h"
10 #include "core/css/StyleRule.h"
14 CSSParser::CSSParser(const CSSParserContext& context)
15 : m_bisonParser(context)
19 bool CSSParser::parseDeclaration(MutableStylePropertySet* propertySet, const String& declaration, CSSParserObserver* observer, StyleSheetContents* styleSheet)
21 return m_bisonParser.parseDeclaration(propertySet, declaration, observer, styleSheet);
24 void CSSParser::parseSelector(const String& selector, CSSSelectorList& selectorList)
26 m_bisonParser.parseSelector(selector, selectorList);
29 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& rule)
31 return BisonCSSParser(context).parseRule(styleSheet, rule);
34 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text, const TextPosition& startPosition, CSSParserObserver* observer, bool logErrors)
36 BisonCSSParser(context).parseSheet(styleSheet, text, startPosition, observer, logErrors);
39 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode parserMode, StyleSheetContents* styleSheet)
41 return BisonCSSParser::parseValue(declaration, propertyID, string, important, parserMode, styleSheet);
44 bool CSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
46 return BisonCSSParser::parseValue(declaration, propertyID, string, important, context);
49 PassRefPtrWillBeRawPtr<CSSValue> CSSParser::parseSingleValue(CSSPropertyID propertyID, const String& string, const CSSParserContext& context)
53 RefPtrWillBeRawPtr<MutableStylePropertySet> stylePropertySet = MutableStylePropertySet::create();
54 bool success = parseValue(stylePropertySet.get(), propertyID, string, false, context);
55 ASSERT_UNUSED(success, success == stylePropertySet->hasProperty(propertyID));
56 return stylePropertySet->getPropertyCSSValue(propertyID);
59 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& styleString, Element* element)
61 return BisonCSSParser::parseInlineStyleDeclaration(styleString, element);
64 PassOwnPtr<Vector<double> > CSSParser::parseKeyframeKeyList(const String& keyList)
66 return BisonCSSParser(strictCSSParserContext()).parseKeyframeKeyList(keyList);
69 PassRefPtrWillBeRawPtr<StyleKeyframe> CSSParser::parseKeyframeRule(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& rule)
71 return BisonCSSParser(context).parseKeyframeRule(styleSheet, rule);
74 bool CSSParser::parseSupportsCondition(const String& condition)
76 return BisonCSSParser(CSSParserContext(HTMLStandardMode, 0)).parseSupportsCondition(condition);
79 bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict)
81 return BisonCSSParser::parseColor(color, string, strict);
84 StyleColor CSSParser::colorFromRGBColorString(const String& string)
86 return BisonCSSParser::colorFromRGBColorString(string);
89 bool CSSParser::parseSystemColor(RGBA32& color, const String& colorString)
91 return BisonCSSParser::parseSystemColor(color, colorString);