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 CSSParserImpl_h | 5 #ifndef CSSParserImpl_h |
6 #define CSSParserImpl_h | 6 #define CSSParserImpl_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/css/CSSProperty.h" | 9 #include "core/css/CSSProperty.h" |
10 #include "core/css/CSSPropertySourceData.h" | 10 #include "core/css/CSSPropertySourceData.h" |
11 #include "core/css/parser/CSSParserMode.h" | 11 #include "core/css/parser/CSSParserMode.h" |
12 #include "core/css/parser/CSSParserTokenRange.h" | 12 #include "core/css/parser/CSSParserTokenRange.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
15 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class StyleRuleBase; | |
19 class ImmutableStylePropertySet; | 20 class ImmutableStylePropertySet; |
20 class Element; | 21 class Element; |
21 class MutableStylePropertySet; | 22 class MutableStylePropertySet; |
22 | 23 |
23 class CSSParserImpl { | 24 class CSSParserImpl { |
24 STACK_ALLOCATED(); | 25 STACK_ALLOCATED(); |
25 public: | 26 public: |
26 CSSParserImpl(const CSSParserContext&, const String&); | 27 CSSParserImpl(const CSSParserContext&, const String&); |
27 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&); | 28 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&); |
28 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*); | 29 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*); |
29 static bool parseDeclaration(MutableStylePropertySet*, const String&, const CSSParserContext&); | 30 static bool parseDeclaration(MutableStylePropertySet*, const String&, const CSSParserContext&); |
31 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const String&, const CSSParserContext&); | |
30 | 32 |
31 private: | 33 private: |
34 // These two functions update the range they're given | |
35 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeAtRule(CSSParserTokenRange&); | |
Timothy Loh
2014/12/16 00:01:20
Eventually these two will take an enum along the l
| |
36 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeQualifiedRule(CSSParserTokenRan ge&); | |
37 | |
32 // FIXME: We should use a CSSRule::Type here | 38 // FIXME: We should use a CSSRule::Type here |
33 void consumeDeclarationList(CSSParserTokenRange, CSSRuleSourceData::Type); | 39 void consumeDeclarationList(CSSParserTokenRange, CSSRuleSourceData::Type); |
34 void consumeDeclaration(CSSParserTokenRange, CSSRuleSourceData::Type); | 40 void consumeDeclaration(CSSParserTokenRange, CSSRuleSourceData::Type); |
35 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, CSSRuleSourceData::Type); | 41 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, CSSRuleSourceData::Type); |
36 | 42 |
37 // FIXME: Can we build StylePropertySets directly? | 43 // FIXME: Can we build StylePropertySets directly? |
38 // FIXME: Investigate using a smaller inline buffer | 44 // FIXME: Investigate using a smaller inline buffer |
39 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; | 45 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; |
40 Vector<CSSParserToken> m_tokens; | 46 Vector<CSSParserToken> m_tokens; |
41 CSSParserContext m_context; | 47 CSSParserContext m_context; |
42 | 48 |
43 // FIXME: We need to store a context style sheet, similar to the Bison parse r | 49 // FIXME: We need to store a context style sheet, similar to the Bison parse r |
44 // for at least crbug.com/9877 and marking that we've seen rem units. | 50 // for at least crbug.com/9877 and marking that we've seen rem units. |
45 }; | 51 }; |
46 | 52 |
47 } // namespace blink | 53 } // namespace blink |
48 | 54 |
49 #endif // CSSParserImpl_h | 55 #endif // CSSParserImpl_h |
OLD | NEW |