| 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/StylePropertySet.h" | 10 #include "core/css/StylePropertySet.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class StyleRuleKeyframe; | 23 class StyleRuleKeyframe; |
| 24 class StyleSheetContents; | 24 class StyleSheetContents; |
| 25 class CSSValue; | 25 class CSSValue; |
| 26 | 26 |
| 27 // This class serves as the public API for the css/parser subsystem | 27 // This class serves as the public API for the css/parser subsystem |
| 28 class CORE_EXPORT CSSParser { | 28 class CORE_EXPORT CSSParser { |
| 29 STATIC_ONLY(CSSParser); | 29 STATIC_ONLY(CSSParser); |
| 30 | 30 |
| 31 public: | 31 public: |
| 32 // As well as regular rules, allows @import and @namespace but not @charset | 32 // As well as regular rules, allows @import and @namespace but not @charset |
| 33 static StyleRuleBase* parseRule(const CSSParserContext&, | 33 static StyleRuleBase* parseRule(const CSSParserContext*, |
| 34 StyleSheetContents*, | 34 StyleSheetContents*, |
| 35 const String&); | 35 const String&); |
| 36 static void parseSheet(const CSSParserContext&, | 36 static void parseSheet(const CSSParserContext*, |
| 37 StyleSheetContents*, | 37 StyleSheetContents*, |
| 38 const String&, | 38 const String&, |
| 39 bool deferPropertyParsing = false); | 39 bool deferPropertyParsing = false); |
| 40 static CSSSelectorList parseSelector(const CSSParserContext&, | 40 static CSSSelectorList parseSelector(const CSSParserContext*, |
| 41 StyleSheetContents*, | 41 StyleSheetContents*, |
| 42 const String&); | 42 const String&); |
| 43 static CSSSelectorList parsePageSelector(const CSSParserContext&, | 43 static CSSSelectorList parsePageSelector(const CSSParserContext*, |
| 44 StyleSheetContents*, | 44 StyleSheetContents*, |
| 45 const String&); | 45 const String&); |
| 46 static bool parseDeclarationList(const CSSParserContext&, | 46 static bool parseDeclarationList(const CSSParserContext*, |
| 47 MutableStylePropertySet*, | 47 MutableStylePropertySet*, |
| 48 const String&); | 48 const String&); |
| 49 | 49 |
| 50 static MutableStylePropertySet::SetResult parseValue( | 50 static MutableStylePropertySet::SetResult parseValue( |
| 51 MutableStylePropertySet*, | 51 MutableStylePropertySet*, |
| 52 CSSPropertyID unresolvedProperty, | 52 CSSPropertyID unresolvedProperty, |
| 53 const String&, | 53 const String&, |
| 54 bool important); |
| 55 static MutableStylePropertySet::SetResult parseValue( |
| 56 MutableStylePropertySet*, |
| 57 CSSPropertyID unresolvedProperty, |
| 58 const String&, |
| 54 bool important, | 59 bool important, |
| 55 StyleSheetContents*); | 60 StyleSheetContents*); |
| 56 | 61 |
| 57 static MutableStylePropertySet::SetResult parseValueForCustomProperty( | 62 static MutableStylePropertySet::SetResult parseValueForCustomProperty( |
| 58 MutableStylePropertySet*, | 63 MutableStylePropertySet*, |
| 59 const AtomicString& propertyName, | 64 const AtomicString& propertyName, |
| 60 const PropertyRegistry*, | 65 const PropertyRegistry*, |
| 61 const String& value, | 66 const String& value, |
| 62 bool important, | 67 bool important, |
| 63 StyleSheetContents*, | 68 StyleSheetContents*, |
| 64 bool isAnimationTainted); | 69 bool isAnimationTainted); |
| 65 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); | 70 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); |
| 66 | 71 |
| 67 // This is for non-shorthands only | 72 // This is for non-shorthands only |
| 68 static const CSSValue* parseSingleValue( | 73 static const CSSValue* parseSingleValue( |
| 69 CSSPropertyID, | 74 CSSPropertyID, |
| 70 const String&, | 75 const String&, |
| 71 const CSSParserContext& = strictCSSParserContext()); | 76 const CSSParserContext* = strictCSSParserContext()); |
| 72 | 77 |
| 73 static const CSSValue* parseFontFaceDescriptor(CSSPropertyID, | 78 static const CSSValue* parseFontFaceDescriptor(CSSPropertyID, |
| 74 const String&, | 79 const String&, |
| 75 const CSSParserContext&); | 80 const CSSParserContext*); |
| 76 | 81 |
| 77 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, | 82 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, |
| 78 Element*); | 83 Element*); |
| 79 | 84 |
| 80 static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); | 85 static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); |
| 81 static StyleRuleKeyframe* parseKeyframeRule(const CSSParserContext&, | 86 static StyleRuleKeyframe* parseKeyframeRule(const CSSParserContext*, |
| 82 const String&); | 87 const String&); |
| 83 | 88 |
| 84 static bool parseSupportsCondition(const String&); | 89 static bool parseSupportsCondition(const String&); |
| 85 | 90 |
| 86 // The color will only be changed when string contains a valid CSS color, so | 91 // The color will only be changed when string contains a valid CSS color, so |
| 87 // callers can set it to a default color and ignore the boolean result. | 92 // callers can set it to a default color and ignore the boolean result. |
| 88 static bool parseColor(Color&, const String&, bool strict = false); | 93 static bool parseColor(Color&, const String&, bool strict = false); |
| 89 static bool parseSystemColor(Color&, const String&); | 94 static bool parseSystemColor(Color&, const String&); |
| 90 | 95 |
| 91 static void parseSheetForInspector(const CSSParserContext&, | 96 static void parseSheetForInspector(const CSSParserContext*, |
| 92 StyleSheetContents*, | 97 StyleSheetContents*, |
| 93 const String&, | 98 const String&, |
| 94 CSSParserObserver&); | 99 CSSParserObserver&); |
| 95 static void parseDeclarationListForInspector(const CSSParserContext&, | 100 static void parseDeclarationListForInspector(const CSSParserContext*, |
| 96 const String&, | 101 const String&, |
| 97 CSSParserObserver&); | 102 CSSParserObserver&); |
| 98 | 103 |
| 99 private: | 104 private: |
| 100 static MutableStylePropertySet::SetResult parseValue( | 105 static MutableStylePropertySet::SetResult parseValue( |
| 101 MutableStylePropertySet*, | 106 MutableStylePropertySet*, |
| 102 CSSPropertyID unresolvedProperty, | 107 CSSPropertyID unresolvedProperty, |
| 103 const String&, | 108 const String&, |
| 104 bool important, | 109 bool important, |
| 105 const CSSParserContext&); | 110 const CSSParserContext*); |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 } // namespace blink | 113 } // namespace blink |
| 109 | 114 |
| 110 #endif // CSSParser_h | 115 #endif // CSSParser_h |
| OLD | NEW |