| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 static const CSSValue* resolvePendingSubstitutions( | 41 static const CSSValue* resolvePendingSubstitutions( |
| 42 const StyleResolverState&, | 42 const StyleResolverState&, |
| 43 CSSPropertyID, | 43 CSSPropertyID, |
| 44 const CSSPendingSubstitutionValue&); | 44 const CSSPendingSubstitutionValue&); |
| 45 static const CSSValue* resolveVariableReferences( | 45 static const CSSValue* resolveVariableReferences( |
| 46 const StyleResolverState&, | 46 const StyleResolverState&, |
| 47 CSSPropertyID, | 47 CSSPropertyID, |
| 48 const CSSVariableReferenceValue&); | 48 const CSSVariableReferenceValue&); |
| 49 | 49 |
| 50 // These return false if we encounter a reference to an invalid variable with
no fallback | 50 // These return false if we encounter a reference to an invalid variable with |
| 51 // no fallback. |
| 51 | 52 |
| 52 // Resolves a range which may contain var() references or @apply rules | 53 // Resolves a range which may contain var() references or @apply rules. |
| 53 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); | 54 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); |
| 54 // Resolves the fallback (if present) of a var() reference, starting from the
comma | 55 // Resolves the fallback (if present) of a var() reference, starting from the |
| 56 // comma. |
| 55 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); | 57 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); |
| 56 // Resolves the contents of a var() reference | 58 // Resolves the contents of a var() reference. |
| 57 bool resolveVariableReference(CSSParserTokenRange, | 59 bool resolveVariableReference(CSSParserTokenRange, |
| 58 Vector<CSSParserToken>& result); | 60 Vector<CSSParserToken>& result); |
| 59 // Consumes and resolves an @apply rule | 61 // Consumes and resolves an @apply rule. |
| 60 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); | 62 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); |
| 61 | 63 |
| 62 // These return null if the custom property is invalid | 64 // These return null if the custom property is invalid. |
| 63 | 65 |
| 64 // Returns the CSSVariableData for a custom property, resolving and storing it
if necessary | 66 // Returns the CSSVariableData for a custom property, resolving and storing it |
| 67 // if necessary. |
| 65 CSSVariableData* valueForCustomProperty(AtomicString name); | 68 CSSVariableData* valueForCustomProperty(AtomicString name); |
| 66 // Resolves the CSSVariableData from a custom property declaration | 69 // Resolves the CSSVariableData from a custom property declaration. |
| 67 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, | 70 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, |
| 68 const CSSVariableData&); | 71 const CSSVariableData&); |
| 69 | 72 |
| 70 const StyleResolverState& m_styleResolverState; | 73 const StyleResolverState& m_styleResolverState; |
| 71 StyleInheritedVariables* m_inheritedVariables; | 74 StyleInheritedVariables* m_inheritedVariables; |
| 72 StyleNonInheritedVariables* m_nonInheritedVariables; | 75 StyleNonInheritedVariables* m_nonInheritedVariables; |
| 73 Member<const PropertyRegistry> m_registry; | 76 Member<const PropertyRegistry> m_registry; |
| 74 HashSet<AtomicString> m_variablesSeen; | 77 HashSet<AtomicString> m_variablesSeen; |
| 75 // Resolution doesn't finish when a cycle is detected. Fallbacks still | 78 // Resolution doesn't finish when a cycle is detected. Fallbacks still |
| 76 // need to be tracked for additional cycles, and invalidation only | 79 // need to be tracked for additional cycles, and invalidation only |
| 77 // applies back to cycle starts. | 80 // applies back to cycle starts. |
| 78 HashSet<AtomicString> m_cycleStartPoints; | 81 HashSet<AtomicString> m_cycleStartPoints; |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 } // namespace blink | 84 } // namespace blink |
| 82 | 85 |
| 83 #endif // CSSVariableResolver | 86 #endif // CSSVariableResolver |
| OLD | NEW |