Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 class CSSVariableResolver { | 25 class CSSVariableResolver { |
| 26 STACK_ALLOCATED(); | 26 STACK_ALLOCATED(); |
| 27 | 27 |
| 28 public: | 28 public: |
| 29 static void resolveVariableDefinitions(const StyleResolverState&); | 29 static void resolveVariableDefinitions(const StyleResolverState&); |
| 30 | 30 |
| 31 // Shorthand properties are not supported. | 31 // Shorthand properties are not supported. |
| 32 static const CSSValue* resolveVariableReferences(const StyleResolverState&, | 32 static const CSSValue* resolveVariableReferences(const StyleResolverState&, |
| 33 CSSPropertyID, | 33 CSSPropertyID, |
| 34 const CSSValue&); | 34 const CSSValue&, |
| 35 bool omitAnimationTainted); | |
|
alancutter (OOO until 2018)
2016/10/05 07:46:40
This should actually be disallowAnimationTainted.
alancutter (OOO until 2018)
2016/10/06 01:25:33
Done.
| |
| 35 | 36 |
| 36 DECLARE_TRACE(); | 37 DECLARE_TRACE(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 CSSVariableResolver(const StyleResolverState&); | 40 CSSVariableResolver(const StyleResolverState&); |
| 40 | 41 |
| 41 static const CSSValue* resolvePendingSubstitutions( | 42 static const CSSValue* resolvePendingSubstitutions( |
| 42 const StyleResolverState&, | 43 const StyleResolverState&, |
| 43 CSSPropertyID, | 44 CSSPropertyID, |
| 44 const CSSPendingSubstitutionValue&); | 45 const CSSPendingSubstitutionValue&, |
| 46 bool omitAnimationTainted); | |
| 45 static const CSSValue* resolveVariableReferences( | 47 static const CSSValue* resolveVariableReferences( |
| 46 const StyleResolverState&, | 48 const StyleResolverState&, |
| 47 CSSPropertyID, | 49 CSSPropertyID, |
| 48 const CSSVariableReferenceValue&); | 50 const CSSVariableReferenceValue&, |
| 51 bool omitAnimationTainted); | |
| 49 | 52 |
| 50 // These return false if we encounter a reference to an invalid variable with no fallback | 53 // These return false if we encounter a reference to an invalid variable with no fallback |
| 51 | 54 |
| 52 // Resolves a range which may contain var() references or @apply rules | 55 // Resolves a range which may contain var() references or @apply rules |
| 53 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); | 56 bool resolveTokenRange(CSSParserTokenRange, |
| 57 bool omitAnimationTainted, | |
| 58 Vector<CSSParserToken>& result, | |
| 59 bool& resultIsAnimationTainted); | |
| 54 // Resolves the fallback (if present) of a var() reference, starting from the comma | 60 // Resolves the fallback (if present) of a var() reference, starting from the comma |
| 55 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); | 61 bool resolveFallback(CSSParserTokenRange, |
| 62 bool omitAnimationTainted, | |
| 63 Vector<CSSParserToken>& result, | |
| 64 bool& resultIsAnimationTainted); | |
| 56 // Resolves the contents of a var() reference | 65 // Resolves the contents of a var() reference |
| 57 bool resolveVariableReference(CSSParserTokenRange, | 66 bool resolveVariableReference(CSSParserTokenRange, |
| 58 Vector<CSSParserToken>& result); | 67 bool omitAnimationTainted, |
| 68 Vector<CSSParserToken>& result, | |
| 69 bool& resultIsAnimationTainted); | |
| 59 // Consumes and resolves an @apply rule | 70 // Consumes and resolves an @apply rule |
| 60 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); | 71 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); |
| 61 | 72 |
| 62 // These return null if the custom property is invalid | 73 // These return null if the custom property is invalid |
| 63 | 74 |
| 64 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary | 75 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary |
| 65 CSSVariableData* valueForCustomProperty(AtomicString name); | 76 CSSVariableData* valueForCustomProperty(AtomicString name); |
| 66 // Resolves the CSSVariableData from a custom property declaration | 77 // Resolves the CSSVariableData from a custom property declaration |
| 67 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, | 78 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, |
| 68 const CSSVariableData&); | 79 const CSSVariableData&); |
| 69 | 80 |
| 70 const StyleResolverState& m_styleResolverState; | 81 const StyleResolverState& m_styleResolverState; |
| 71 StyleInheritedVariables* m_inheritedVariables; | 82 StyleInheritedVariables* m_inheritedVariables; |
| 72 StyleNonInheritedVariables* m_nonInheritedVariables; | 83 StyleNonInheritedVariables* m_nonInheritedVariables; |
| 73 Member<const PropertyRegistry> m_registry; | 84 Member<const PropertyRegistry> m_registry; |
| 74 HashSet<AtomicString> m_variablesSeen; | 85 HashSet<AtomicString> m_variablesSeen; |
| 75 // Resolution doesn't finish when a cycle is detected. Fallbacks still | 86 // Resolution doesn't finish when a cycle is detected. Fallbacks still |
| 76 // need to be tracked for additional cycles, and invalidation only | 87 // need to be tracked for additional cycles, and invalidation only |
| 77 // applies back to cycle starts. | 88 // applies back to cycle starts. |
| 78 HashSet<AtomicString> m_cycleStartPoints; | 89 HashSet<AtomicString> m_cycleStartPoints; |
| 79 }; | 90 }; |
| 80 | 91 |
| 81 } // namespace blink | 92 } // namespace blink |
| 82 | 93 |
| 83 #endif // CSSVariableResolver | 94 #endif // CSSVariableResolver |
| OLD | NEW |