OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CSSVariableData_h | 5 #ifndef CSSVariableData_h |
6 #define CSSVariableData_h | 6 #define CSSVariableData_h |
7 | 7 |
| 8 #include "core/css/StylePropertySet.h" |
8 #include "core/css/parser/CSSParserToken.h" | 9 #include "core/css/parser/CSSParserToken.h" |
9 #include "core/css/parser/CSSParserTokenRange.h" | 10 #include "core/css/parser/CSSParserTokenRange.h" |
10 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
11 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 class CSSParserTokenRange; | 16 class CSSParserTokenRange; |
16 | 17 |
17 class CSSVariableData : public RefCounted<CSSVariableData> { | 18 class CSSVariableData : public RefCounted<CSSVariableData> { |
(...skipping 10 matching lines...) Expand all Loading... |
28 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData.m_bac
kingString)); | 29 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData.m_bac
kingString)); |
29 } | 30 } |
30 | 31 |
31 CSSParserTokenRange tokenRange() { return m_tokens; } | 32 CSSParserTokenRange tokenRange() { return m_tokens; } |
32 | 33 |
33 const Vector<CSSParserToken>& tokens() const { return m_tokens; } | 34 const Vector<CSSParserToken>& tokens() const { return m_tokens; } |
34 | 35 |
35 bool operator==(const CSSVariableData& other) const; | 36 bool operator==(const CSSVariableData& other) const; |
36 | 37 |
37 bool needsVariableResolution() const { return m_needsVariableResolution; } | 38 bool needsVariableResolution() const { return m_needsVariableResolution; } |
| 39 |
| 40 const StylePropertySet* propertySet(); |
| 41 |
38 private: | 42 private: |
39 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); | 43 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); |
40 | 44 |
41 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause | 45 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause |
42 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich | 46 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich |
43 // point to the unresolved CSSVariableData values that own the backing strin
gs | 47 // point to the unresolved CSSVariableData values that own the backing strin
gs |
44 // this will potentially reference. | 48 // this will potentially reference. |
45 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) | 49 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) |
46 : m_backingString(backingString) | 50 : m_backingString(backingString) |
47 , m_tokens(resolvedTokens) | 51 , m_tokens(resolvedTokens) |
48 , m_needsVariableResolution(false) | 52 , m_needsVariableResolution(false) |
| 53 , m_cachedPropertySet(false) |
49 { } | 54 { } |
50 | 55 |
51 void consumeAndUpdateTokens(const CSSParserTokenRange&); | 56 void consumeAndUpdateTokens(const CSSParserTokenRange&); |
52 template<typename CharacterType> void updateTokens(const CSSParserTokenRange
&); | 57 template<typename CharacterType> void updateTokens(const CSSParserTokenRange
&); |
53 | 58 |
54 String m_backingString; | 59 String m_backingString; |
55 Vector<CSSParserToken> m_tokens; | 60 Vector<CSSParserToken> m_tokens; |
56 const bool m_needsVariableResolution; | 61 const bool m_needsVariableResolution; |
| 62 |
| 63 // Parsed representation for @apply |
| 64 bool m_cachedPropertySet; |
| 65 RefPtrWillBePersistent<StylePropertySet> m_propertySet; |
57 }; | 66 }; |
58 | 67 |
59 } // namespace blink | 68 } // namespace blink |
60 | 69 |
61 #endif // CSSVariableData_h | 70 #endif // CSSVariableData_h |
OLD | NEW |