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 StyleResolverState; | 20 class StyleResolverState; |
21 class StyleVariableData; | 21 class StyleVariableData; |
22 | 22 |
23 class CSSVariableResolver { | 23 class CSSVariableResolver { |
24 public: | 24 public: |
25 static void resolveVariableDefinitions(StyleVariableData*); | 25 static void resolveVariableDefinitions(StyleVariableData*); |
26 static const CSSValue* resolveVariableReferences(StyleResolverState&, CSSPro
pertyID, const CSSVariableReferenceValue&); | 26 static const CSSValue* resolveVariableReferences(StyleResolverState&, CSSPro
pertyID, const CSSVariableReferenceValue&); |
27 static const CSSValue* resolvePendingSubstitutions(StyleResolverState&, CSSP
ropertyID, const CSSPendingSubstitutionValue&); | 27 static const CSSValue* resolvePendingSubstitutions(StyleResolverState&, CSSP
ropertyID, const CSSPendingSubstitutionValue&); |
28 | 28 |
29 // Shorthand properties are not supported. | 29 // Shorthand properties are not supported. |
30 static CSSValue* resolveVariableReferences(StyleVariableData*, CSSPropertyID
, const CSSVariableReferenceValue&); | 30 static const CSSValue* resolveVariableReferences(StyleVariableData*, CSSProp
ertyID, const CSSVariableReferenceValue&); |
31 | 31 |
32 private: | 32 private: |
33 CSSVariableResolver(StyleVariableData*); | 33 CSSVariableResolver(StyleVariableData*); |
34 | 34 |
35 // These return false if we encounter a reference to an invalid variable wit
h no fallback | 35 // These return false if we encounter a reference to an invalid variable wit
h no fallback |
36 | 36 |
37 // Resolves a range which may contain var() references or @apply rules | 37 // Resolves a range which may contain var() references or @apply rules |
38 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); | 38 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); |
39 // Resolves the fallback (if present) of a var() reference, starting from th
e comma | 39 // Resolves the fallback (if present) of a var() reference, starting from th
e comma |
40 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); | 40 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); |
(...skipping 13 matching lines...) Expand all Loading... |
54 HashSet<AtomicString> m_variablesSeen; | 54 HashSet<AtomicString> m_variablesSeen; |
55 // Resolution doesn't finish when a cycle is detected. Fallbacks still | 55 // Resolution doesn't finish when a cycle is detected. Fallbacks still |
56 // need to be tracked for additional cycles, and invalidation only | 56 // need to be tracked for additional cycles, and invalidation only |
57 // applies back to cycle starts. | 57 // applies back to cycle starts. |
58 HashSet<AtomicString> m_cycleStartPoints; | 58 HashSet<AtomicString> m_cycleStartPoints; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
62 | 62 |
63 #endif // CSSVariableResolver | 63 #endif // CSSVariableResolver |
OLD | NEW |