Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.h

Issue 2323633002: Implement animation tainted custom property values (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 class StyleInheritedVariables; 22 class StyleInheritedVariables;
23 class StyleNonInheritedVariables; 23 class StyleNonInheritedVariables;
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(
33 CSSPropertyID, 33 const StyleResolverState&,
34 const CSSValue&); 34 CSSPropertyID,
35 const CSSValue&,
36 bool disallowAnimationTainted);
35 37
36 DECLARE_TRACE(); 38 DECLARE_TRACE();
37 39
38 private: 40 private:
39 CSSVariableResolver(const StyleResolverState&); 41 CSSVariableResolver(const StyleResolverState&);
40 42
41 static const CSSValue* resolvePendingSubstitutions( 43 static const CSSValue* resolvePendingSubstitutions(
42 const StyleResolverState&, 44 const StyleResolverState&,
43 CSSPropertyID, 45 CSSPropertyID,
44 const CSSPendingSubstitutionValue&); 46 const CSSPendingSubstitutionValue&,
47 bool disallowAnimationTainted);
45 static const CSSValue* resolveVariableReferences( 48 static const CSSValue* resolveVariableReferences(
46 const StyleResolverState&, 49 const StyleResolverState&,
47 CSSPropertyID, 50 CSSPropertyID,
48 const CSSVariableReferenceValue&); 51 const CSSVariableReferenceValue&,
52 bool disallowAnimationTainted);
49 53
50 // These return false if we encounter a reference to an invalid variable with 54 // These return false if we encounter a reference to an invalid variable with
51 // no fallback. 55 // no fallback.
52 56
53 // Resolves a range which may contain var() references or @apply rules. 57 // Resolves a range which may contain var() references or @apply rules.
54 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); 58 bool resolveTokenRange(CSSParserTokenRange,
59 bool disallowAnimationTainted,
60 Vector<CSSParserToken>& result,
61 bool& resultIsAnimationTainted);
55 // Resolves the fallback (if present) of a var() reference, starting from the 62 // Resolves the fallback (if present) of a var() reference, starting from the
56 // comma. 63 // comma.
57 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); 64 bool resolveFallback(CSSParserTokenRange,
65 bool disallowAnimationTainted,
66 Vector<CSSParserToken>& result,
67 bool& resultIsAnimationTainted);
58 // Resolves the contents of a var() reference. 68 // Resolves the contents of a var() reference.
59 bool resolveVariableReference(CSSParserTokenRange, 69 bool resolveVariableReference(CSSParserTokenRange,
60 Vector<CSSParserToken>& result); 70 bool disallowAnimationTainted,
71 Vector<CSSParserToken>& result,
72 bool& resultIsAnimationTainted);
61 // Consumes and resolves an @apply rule. 73 // Consumes and resolves an @apply rule.
62 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); 74 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result);
63 75
64 // These return null if the custom property is invalid. 76 // These return null if the custom property is invalid.
65 77
66 // Returns the CSSVariableData for a custom property, resolving and storing it 78 // Returns the CSSVariableData for a custom property, resolving and storing it
67 // if necessary. 79 // if necessary.
68 CSSVariableData* valueForCustomProperty(AtomicString name); 80 CSSVariableData* valueForCustomProperty(AtomicString name);
69 // Resolves the CSSVariableData from a custom property declaration. 81 // Resolves the CSSVariableData from a custom property declaration.
70 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, 82 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name,
71 const CSSVariableData&); 83 const CSSVariableData&);
72 84
73 const StyleResolverState& m_styleResolverState; 85 const StyleResolverState& m_styleResolverState;
74 StyleInheritedVariables* m_inheritedVariables; 86 StyleInheritedVariables* m_inheritedVariables;
75 StyleNonInheritedVariables* m_nonInheritedVariables; 87 StyleNonInheritedVariables* m_nonInheritedVariables;
76 Member<const PropertyRegistry> m_registry; 88 Member<const PropertyRegistry> m_registry;
77 HashSet<AtomicString> m_variablesSeen; 89 HashSet<AtomicString> m_variablesSeen;
78 // Resolution doesn't finish when a cycle is detected. Fallbacks still 90 // Resolution doesn't finish when a cycle is detected. Fallbacks still
79 // need to be tracked for additional cycles, and invalidation only 91 // need to be tracked for additional cycles, and invalidation only
80 // applies back to cycle starts. 92 // applies back to cycle starts.
81 HashSet<AtomicString> m_cycleStartPoints; 93 HashSet<AtomicString> m_cycleStartPoints;
82 }; 94 };
83 95
84 } // namespace blink 96 } // namespace blink
85 97
86 #endif // CSSVariableResolver 98 #endif // CSSVariableResolver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698