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 CSSVariableResolver_h | 5 #ifndef CSSVariableResolver_h |
6 #define CSSVariableResolver_h | 6 #define CSSVariableResolver_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/css/parser/CSSParserToken.h" | 9 #include "core/css/parser/CSSParserToken.h" |
10 #include "wtf/HashSet.h" | 10 #include "wtf/HashSet.h" |
11 #include "wtf/text/AtomicString.h" | 11 #include "wtf/text/AtomicString.h" |
12 #include "wtf/text/AtomicStringHash.h" | 12 #include "wtf/text/AtomicStringHash.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class CSSParserTokenRange; | 16 class CSSParserTokenRange; |
17 class CSSPendingSubstitutionValue; | 17 class CSSPendingSubstitutionValue; |
18 class CSSVariableData; | 18 class CSSVariableData; |
19 class CSSVariableReferenceValue; | 19 class CSSVariableReferenceValue; |
20 class PropertyRegistry; | 20 class PropertyRegistry; |
21 class StyleResolverState; | 21 class StyleResolverState; |
22 class StyleVariableData; | 22 class StyleVariableData; |
23 | 23 |
24 class CSSVariableResolver { | 24 class CSSVariableResolver { |
25 STACK_ALLOCATED(); | 25 STACK_ALLOCATED(); |
26 public: | 26 public: |
27 static void resolveVariableDefinitions(const StyleResolverState&); | 27 static void resolveVariableDefinitions(const StyleResolverState&); |
28 static const CSSValue* resolvePendingSubstitutions(StyleResolverState&, CSSP
ropertyID, const CSSPendingSubstitutionValue&); | |
29 | 28 |
30 // Shorthand properties are not supported. | 29 // Shorthand properties are not supported. |
31 static const CSSValue* resolveVariableReferences(const StyleResolverState&,
CSSPropertyID, const CSSVariableReferenceValue&); | 30 static const CSSValue* resolveVariableReferences(const StyleResolverState&,
CSSPropertyID, const CSSValue&); |
32 | 31 |
33 DECLARE_TRACE(); | 32 DECLARE_TRACE(); |
34 | 33 |
35 private: | 34 private: |
36 CSSVariableResolver(const StyleResolverState&); | 35 CSSVariableResolver(const StyleResolverState&); |
37 | 36 |
| 37 static const CSSValue* resolvePendingSubstitutions(const StyleResolverState&
, CSSPropertyID, const CSSPendingSubstitutionValue&); |
| 38 static const CSSValue* resolveVariableReferences(const StyleResolverState&,
CSSPropertyID, const CSSVariableReferenceValue&); |
| 39 |
38 // These return false if we encounter a reference to an invalid variable wit
h no fallback | 40 // These return false if we encounter a reference to an invalid variable wit
h no fallback |
39 | 41 |
40 // Resolves a range which may contain var() references or @apply rules | 42 // Resolves a range which may contain var() references or @apply rules |
41 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); | 43 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); |
42 // Resolves the fallback (if present) of a var() reference, starting from th
e comma | 44 // Resolves the fallback (if present) of a var() reference, starting from th
e comma |
43 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); | 45 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); |
44 // Resolves the contents of a var() reference | 46 // Resolves the contents of a var() reference |
45 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r
esult); | 47 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r
esult); |
46 // Consumes and resolves an @apply rule | 48 // Consumes and resolves an @apply rule |
47 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result
); | 49 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result
); |
(...skipping 11 matching lines...) Expand all Loading... |
59 HashSet<AtomicString> m_variablesSeen; | 61 HashSet<AtomicString> m_variablesSeen; |
60 // Resolution doesn't finish when a cycle is detected. Fallbacks still | 62 // Resolution doesn't finish when a cycle is detected. Fallbacks still |
61 // need to be tracked for additional cycles, and invalidation only | 63 // need to be tracked for additional cycles, and invalidation only |
62 // applies back to cycle starts. | 64 // applies back to cycle starts. |
63 HashSet<AtomicString> m_cycleStartPoints; | 65 HashSet<AtomicString> m_cycleStartPoints; |
64 }; | 66 }; |
65 | 67 |
66 } // namespace blink | 68 } // namespace blink |
67 | 69 |
68 #endif // CSSVariableResolver | 70 #endif // CSSVariableResolver |
OLD | NEW |