OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CSSParser_h | 5 #ifndef CSSParser_h |
6 #define CSSParser_h | 6 #define CSSParser_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/css/CSSValue.h" | 10 #include "core/css/CSSValue.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class CORE_EXPORT CSSParser { | 27 class CORE_EXPORT CSSParser { |
28 STATIC_ONLY(CSSParser); | 28 STATIC_ONLY(CSSParser); |
29 public: | 29 public: |
30 // As well as regular rules, allows @import and @namespace but not @charset | 30 // As well as regular rules, allows @import and @namespace but not @charset |
31 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const CSSParserContex
t&, StyleSheetContents*, const String&); | 31 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const CSSParserContex
t&, StyleSheetContents*, const String&); |
32 // TODO(timloh): Split into parseSheet and parseSheetForInspector | 32 // TODO(timloh): Split into parseSheet and parseSheetForInspector |
33 static void parseSheet(const CSSParserContext&, StyleSheetContents*, const S
tring&, const TextPosition& startPosition, CSSParserObserver*, bool logErrors =
false); | 33 static void parseSheet(const CSSParserContext&, StyleSheetContents*, const S
tring&, const TextPosition& startPosition, CSSParserObserver*, bool logErrors =
false); |
34 static void parseSelector(const CSSParserContext&, const String&, CSSSelecto
rList&); | 34 static void parseSelector(const CSSParserContext&, const String&, CSSSelecto
rList&); |
35 // TODO(timloh): Split into parseDeclarationList and parseDeclarationListFor
Inspector | 35 // TODO(timloh): Split into parseDeclarationList and parseDeclarationListFor
Inspector |
36 static bool parseDeclarationList(const CSSParserContext&, MutableStyleProper
tySet*, const String&, CSSParserObserver*, StyleSheetContents* contextStyleSheet
); | 36 static bool parseDeclarationList(const CSSParserContext&, MutableStyleProper
tySet*, const String&, CSSParserObserver*, StyleSheetContents* contextStyleSheet
); |
37 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); | 37 static bool parseValue(MutableStylePropertySet*, CSSPropertyID unresolvedPro
perty, const String&, bool important, CSSParserMode, StyleSheetContents*); |
38 | 38 |
39 // This is for non-shorthands only | 39 // This is for non-shorthands only |
40 static PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID, cons
t String&, const CSSParserContext& = strictCSSParserContext()); | 40 static PassRefPtrWillBeRawPtr<CSSValue> parseSingleValue(CSSPropertyID, cons
t String&, const CSSParserContext& = strictCSSParserContext()); |
41 | 41 |
42 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec
laration(const String&, Element*); | 42 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec
laration(const String&, Element*); |
43 | 43 |
44 static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); | 44 static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); |
45 static PassRefPtrWillBeRawPtr<StyleRuleKeyframe> parseKeyframeRule(const CSS
ParserContext&, StyleSheetContents*, const String&); | 45 static PassRefPtrWillBeRawPtr<StyleRuleKeyframe> parseKeyframeRule(const CSS
ParserContext&, StyleSheetContents*, const String&); |
46 | 46 |
47 static bool parseSupportsCondition(const String&); | 47 static bool parseSupportsCondition(const String&); |
48 | 48 |
49 // The color will only be changed when string contains a valid CSS color, so
callers | 49 // The color will only be changed when string contains a valid CSS color, so
callers |
50 // can set it to a default color and ignore the boolean result. | 50 // can set it to a default color and ignore the boolean result. |
51 static bool parseColor(RGBA32& color, const String&, bool strict = false); | 51 static bool parseColor(RGBA32& color, const String&, bool strict = false); |
52 static bool parseSystemColor(RGBA32& color, const String&); | 52 static bool parseSystemColor(RGBA32& color, const String&); |
53 static StyleColor colorFromRGBColorString(const String&); | 53 static StyleColor colorFromRGBColorString(const String&); |
54 | 54 |
55 private: | 55 private: |
56 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, const CSSParserContext&); | 56 static bool parseValue(MutableStylePropertySet*, CSSPropertyID unresolvedPro
perty, const String&, bool important, const CSSParserContext&); |
57 static bool parseFastPath(MutableStylePropertySet*, CSSPropertyID, const Str
ing&, bool important, CSSParserMode); | 57 static bool parseFastPath(MutableStylePropertySet*, CSSPropertyID unresolved
Property, const String&, bool important, CSSParserMode); |
58 }; | 58 }; |
59 | 59 |
| 60 // TODO(timloh): It's weird that these are declared here but defined in CSSPrope
rtyParser.h |
| 61 CSSPropertyID unresolvedCSSPropertyID(const String&); |
60 CSSPropertyID cssPropertyID(const String&); | 62 CSSPropertyID cssPropertyID(const String&); |
61 | 63 |
62 } // namespace blink | 64 } // namespace blink |
63 | 65 |
64 #endif // CSSParser_h | 66 #endif // CSSParser_h |
OLD | NEW |