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

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

Issue 1645433002: Basic implementation of @apply (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix expted.txt for failing test Created 4 years, 9 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 14 matching lines...) Expand all
25 static void resolveAndApplyVariableReferences(StyleResolverState&, CSSProper tyID, const CSSVariableReferenceValue&); 25 static void resolveAndApplyVariableReferences(StyleResolverState&, CSSProper tyID, const CSSVariableReferenceValue&);
26 26
27 // Shorthand properties are not supported. 27 // Shorthand properties are not supported.
28 static PassRefPtrWillBeRawPtr<CSSValue> resolveVariableReferences(StyleVaria bleData*, CSSPropertyID, const CSSVariableReferenceValue&); 28 static PassRefPtrWillBeRawPtr<CSSValue> resolveVariableReferences(StyleVaria bleData*, CSSPropertyID, const CSSVariableReferenceValue&);
29 29
30 private: 30 private:
31 CSSVariableResolver(StyleVariableData*); 31 CSSVariableResolver(StyleVariableData*);
32 32
33 // These return false if we encounter a reference to an invalid variable wit h no fallback 33 // These return false if we encounter a reference to an invalid variable wit h no fallback
34 34
35 // Resolves a range which may contain var() references 35 // Resolves a range which may contain var() references or @apply rules
36 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result); 36 bool resolveTokenRange(CSSParserTokenRange, Vector<CSSParserToken>& result);
37 // Resolves the fallback (if present) of a var() reference, starting from th e comma 37 // Resolves the fallback (if present) of a var() reference, starting from th e comma
38 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result); 38 bool resolveFallback(CSSParserTokenRange, Vector<CSSParserToken>& result);
39 // Resolves the contents of a var() reference 39 // Resolves the contents of a var() reference
40 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r esult); 40 bool resolveVariableReference(CSSParserTokenRange, Vector<CSSParserToken>& r esult);
41 // Consumes and resolves an @apply rule
42 void resolveApplyAtRule(CSSParserTokenRange&, Vector<CSSParserToken>& result );
41 43
42 // These return null if the custom property is invalid 44 // These return null if the custom property is invalid
43 45
44 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary 46 // Returns the CSSVariableData for a custom property, resolving and storing it if necessary
45 CSSVariableData* valueForCustomProperty(AtomicString name); 47 CSSVariableData* valueForCustomProperty(AtomicString name);
46 // Resolves the CSSVariableData from a custom property declaration 48 // Resolves the CSSVariableData from a custom property declaration
47 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, const C SSVariableData&); 49 PassRefPtr<CSSVariableData> resolveCustomProperty(AtomicString name, const C SSVariableData&);
48 50
49 StyleVariableData* m_styleVariableData; 51 StyleVariableData* m_styleVariableData;
50 HashSet<AtomicString> m_variablesSeen; 52 HashSet<AtomicString> m_variablesSeen;
51 // Resolution doesn't finish when a cycle is detected. Fallbacks still 53 // Resolution doesn't finish when a cycle is detected. Fallbacks still
52 // need to be tracked for additional cycles, and invalidation only 54 // need to be tracked for additional cycles, and invalidation only
53 // applies back to cycle starts. 55 // applies back to cycle starts.
54 HashSet<AtomicString> m_cycleStartPoints; 56 HashSet<AtomicString> m_cycleStartPoints;
55 }; 57 };
56 58
57 } // namespace blink 59 } // namespace blink
58 60
59 #endif // CSSVariableResolver 61 #endif // CSSVariableResolver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698