| 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" |
| 11 #include "core/css/StylePropertySet.h" |
| 11 #include "core/css/parser/CSSParserMode.h" | 12 #include "core/css/parser/CSSParserMode.h" |
| 12 #include "platform/graphics/Color.h" | 13 #include "platform/graphics/Color.h" |
| 13 #include <memory> | 14 #include <memory> |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class CSSParserObserver; | 18 class CSSParserObserver; |
| 18 class CSSParserTokenRange; | 19 class CSSParserTokenRange; |
| 19 class CSSSelectorList; | 20 class CSSSelectorList; |
| 20 class Element; | 21 class Element; |
| 21 class ImmutableStylePropertySet; | 22 class ImmutableStylePropertySet; |
| 22 class MutableStylePropertySet; | |
| 23 class StyleRuleBase; | 23 class StyleRuleBase; |
| 24 class StyleRuleKeyframe; | 24 class StyleRuleKeyframe; |
| 25 class StyleSheetContents; | 25 class StyleSheetContents; |
| 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 // Returns whether anything was changed. | |
| 50 static bool parseValue(MutableStylePropertySet*, | |
| 51 CSSPropertyID unresolvedProperty, | |
| 52 const String&, | |
| 53 bool important, | |
| 54 StyleSheetContents*); | |
| 55 | 49 |
| 56 static bool parseValueForCustomProperty(MutableStylePropertySet*, | 50 static MutableStylePropertySet::SetResult parseValue( |
| 57 const AtomicString& propertyName, | 51 MutableStylePropertySet*, |
| 58 const String& value, | 52 CSSPropertyID unresolvedProperty, |
| 59 bool important, | 53 const String&, |
| 60 StyleSheetContents*, | 54 bool important, |
| 61 bool isAnimationTainted); | 55 StyleSheetContents*); |
| 56 |
| 57 static MutableStylePropertySet::SetResult parseValueForCustomProperty( |
| 58 MutableStylePropertySet*, |
| 59 const AtomicString& propertyName, |
| 60 const String& value, |
| 61 bool important, |
| 62 StyleSheetContents*, |
| 63 bool isAnimationTainted); |
| 62 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); | 64 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); |
| 63 | 65 |
| 64 // This is for non-shorthands only | 66 // This is for non-shorthands only |
| 65 static const CSSValue* parseSingleValue( | 67 static const CSSValue* parseSingleValue( |
| 66 CSSPropertyID, | 68 CSSPropertyID, |
| 67 const String&, | 69 const String&, |
| 68 const CSSParserContext& = strictCSSParserContext()); | 70 const CSSParserContext& = strictCSSParserContext()); |
| 69 | 71 |
| 70 static const CSSValue* parseFontFaceDescriptor(CSSPropertyID, | 72 static const CSSValue* parseFontFaceDescriptor(CSSPropertyID, |
| 71 const String&, | 73 const String&, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 | 89 |
| 88 static void parseSheetForInspector(const CSSParserContext&, | 90 static void parseSheetForInspector(const CSSParserContext&, |
| 89 StyleSheetContents*, | 91 StyleSheetContents*, |
| 90 const String&, | 92 const String&, |
| 91 CSSParserObserver&); | 93 CSSParserObserver&); |
| 92 static void parseDeclarationListForInspector(const CSSParserContext&, | 94 static void parseDeclarationListForInspector(const CSSParserContext&, |
| 93 const String&, | 95 const String&, |
| 94 CSSParserObserver&); | 96 CSSParserObserver&); |
| 95 | 97 |
| 96 private: | 98 private: |
| 97 static bool parseValue(MutableStylePropertySet*, | 99 static MutableStylePropertySet::SetResult parseValue( |
| 98 CSSPropertyID unresolvedProperty, | 100 MutableStylePropertySet*, |
| 99 const String&, | 101 CSSPropertyID unresolvedProperty, |
| 100 bool important, | 102 const String&, |
| 101 const CSSParserContext&); | 103 bool important, |
| 104 const CSSParserContext&); |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 } // namespace blink | 107 } // namespace blink |
| 105 | 108 |
| 106 #endif // CSSParser_h | 109 #endif // CSSParser_h |
| OLD | NEW |