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

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

Issue 2901213005: Ensure string data is kept alive as long as there are CSSVariableData tokens pointing to it (Closed)
Patch Set: comment Created 3 years, 6 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 "platform/wtf/HashSet.h" 10 #include "platform/wtf/HashSet.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const CSSVariableReferenceValue&, 51 const CSSVariableReferenceValue&,
52 bool disallow_animation_tainted); 52 bool disallow_animation_tainted);
53 53
54 // 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
55 // no fallback. 55 // no fallback.
56 56
57 // Resolves a range which may contain var() references or @apply rules. 57 // Resolves a range which may contain var() references or @apply rules.
58 bool ResolveTokenRange(CSSParserTokenRange, 58 bool ResolveTokenRange(CSSParserTokenRange,
59 bool disallow_animation_tainted, 59 bool disallow_animation_tainted,
60 Vector<CSSParserToken>& result, 60 Vector<CSSParserToken>& result,
61 Vector<String>& result_backing_strings,
61 bool& result_is_animation_tainted); 62 bool& result_is_animation_tainted);
62 // Resolves the fallback (if present) of a var() reference, starting from the 63 // Resolves the fallback (if present) of a var() reference, starting from the
63 // comma. 64 // comma.
64 bool ResolveFallback(CSSParserTokenRange, 65 bool ResolveFallback(CSSParserTokenRange,
65 bool disallow_animation_tainted, 66 bool disallow_animation_tainted,
66 Vector<CSSParserToken>& result, 67 Vector<CSSParserToken>& result,
68 Vector<String>& result_backing_strings,
67 bool& result_is_animation_tainted); 69 bool& result_is_animation_tainted);
68 // Resolves the contents of a var() reference. 70 // Resolves the contents of a var() reference.
69 bool ResolveVariableReference(CSSParserTokenRange, 71 bool ResolveVariableReference(CSSParserTokenRange,
70 bool disallow_animation_tainted, 72 bool disallow_animation_tainted,
71 Vector<CSSParserToken>& result, 73 Vector<CSSParserToken>& result,
74 Vector<String>& result_backing_strings,
72 bool& result_is_animation_tainted); 75 bool& result_is_animation_tainted);
73 // Consumes and resolves an @apply rule. 76 // Consumes and resolves an @apply rule.
74 void ResolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result); 77 void ResolveApplyAtRule(CSSParserTokenRange&,
78 Vector<CSSParserToken>& result,
79 Vector<String>& result_backing_strings);
75 80
76 // These return null if the custom property is invalid. 81 // These return null if the custom property is invalid.
77 82
78 // Returns the CSSVariableData for a custom property, resolving and storing it 83 // Returns the CSSVariableData for a custom property, resolving and storing it
79 // if necessary. 84 // if necessary.
80 CSSVariableData* ValueForCustomProperty(AtomicString name); 85 CSSVariableData* ValueForCustomProperty(AtomicString name);
81 // Resolves the CSSVariableData from a custom property declaration. 86 // Resolves the CSSVariableData from a custom property declaration.
82 PassRefPtr<CSSVariableData> ResolveCustomProperty(AtomicString name, 87 PassRefPtr<CSSVariableData> ResolveCustomProperty(AtomicString name,
83 const CSSVariableData&); 88 const CSSVariableData&);
84 89
85 StyleInheritedVariables* inherited_variables_; 90 StyleInheritedVariables* inherited_variables_;
86 StyleNonInheritedVariables* non_inherited_variables_; 91 StyleNonInheritedVariables* non_inherited_variables_;
87 Member<const PropertyRegistry> registry_; 92 Member<const PropertyRegistry> registry_;
88 HashSet<AtomicString> variables_seen_; 93 HashSet<AtomicString> variables_seen_;
89 // Resolution doesn't finish when a cycle is detected. Fallbacks still 94 // Resolution doesn't finish when a cycle is detected. Fallbacks still
90 // need to be tracked for additional cycles, and invalidation only 95 // need to be tracked for additional cycles, and invalidation only
91 // applies back to cycle starts. 96 // applies back to cycle starts.
92 HashSet<AtomicString> cycle_start_points_; 97 HashSet<AtomicString> cycle_start_points_;
93 }; 98 };
94 99
95 } // namespace blink 100 } // namespace blink
96 101
97 #endif // CSSVariableResolver 102 #endif // CSSVariableResolver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698