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

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

Issue 2310823002: Skeleton implementation of CSS Properties and Values API (Closed)
Patch Set: fix stylevardata copy ctor Created 4 years, 3 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"
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 PropertyRegistry;
20 class StyleResolverState; 21 class StyleResolverState;
21 class StyleVariableData; 22 class StyleVariableData;
22 23
23 class CSSVariableResolver { 24 class CSSVariableResolver {
25 STACK_ALLOCATED();
24 public: 26 public:
25 static void resolveVariableDefinitions(StyleVariableData*); 27 static void resolveVariableDefinitions(const StyleResolverState&);
26 static const CSSValue* resolvePendingSubstitutions(StyleResolverState&, CSSP ropertyID, const CSSPendingSubstitutionValue&); 28 static const CSSValue* resolvePendingSubstitutions(StyleResolverState&, CSSP ropertyID, const CSSPendingSubstitutionValue&);
27 29
28 // Shorthand properties are not supported. 30 // Shorthand properties are not supported.
29 static const CSSValue* resolveVariableReferences(const StyleResolverState&, CSSPropertyID, const CSSVariableReferenceValue&); 31 static const CSSValue* resolveVariableReferences(const StyleResolverState&, CSSPropertyID, const CSSVariableReferenceValue&);
30 32
33 DECLARE_TRACE();
34
31 private: 35 private:
32 CSSVariableResolver(StyleVariableData*); 36 CSSVariableResolver(const StyleResolverState&);
33 37
34 // These return false if we encounter a reference to an invalid variable wit h no fallback 38 // These return false if we encounter a reference to an invalid variable wit h no fallback
35 39
36 // Resolves a range which may contain var() references or @apply rules 40 // Resolves a range which may contain var() references or @apply rules
37 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); 41 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result);
38 // Resolves the fallback (if present) of a var() reference, starting from th e comma 42 // Resolves the fallback (if present) of a var() reference, starting from th e comma
39 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); 43 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result);
40 // Resolves the contents of a var() reference 44 // Resolves the contents of a var() reference
41 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r esult); 45 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r esult);
42 // Consumes and resolves an @apply rule 46 // Consumes and resolves an @apply rule
43 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result ); 47 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result );
44 48
45 // These return null if the custom property is invalid 49 // These return null if the custom property is invalid
46 50
47 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary 51 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary
48 CSSVariableData* valueForCustomProperty(AtomicString name); 52 CSSVariableData* valueForCustomProperty(AtomicString name);
49 // Resolves the CSSVariableData from a custom property declaration 53 // Resolves the CSSVariableData from a custom property declaration
50 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, const C SSVariableData&); 54 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, const C SSVariableData&);
51 55
56 const StyleResolverState& m_styleResolverState;
52 StyleVariableData* m_styleVariableData; 57 StyleVariableData* m_styleVariableData;
58 Member<const PropertyRegistry> m_registry;
53 HashSet<AtomicString> m_variablesSeen; 59 HashSet<AtomicString> m_variablesSeen;
54 // Resolution doesn't finish when a cycle is detected. Fallbacks still 60 // Resolution doesn't finish when a cycle is detected. Fallbacks still
55 // need to be tracked for additional cycles, and invalidation only 61 // need to be tracked for additional cycles, and invalidation only
56 // applies back to cycle starts. 62 // applies back to cycle starts.
57 HashSet<AtomicString> m_cycleStartPoints; 63 HashSet<AtomicString> m_cycleStartPoints;
58 }; 64 };
59 65
60 } // namespace blink 66 } // namespace blink
61 67
62 #endif // CSSVariableResolver 68 #endif // CSSVariableResolver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698