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

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

Issue 1694133002: Simplify CSS variables resolution logic [2 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split up Created 4 years, 10 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 CSSVariableData_h 5 #ifndef CSSVariableData_h
6 #define CSSVariableData_h 6 #define CSSVariableData_h
7 7
8 #include "core/css/parser/CSSParserToken.h" 8 #include "core/css/parser/CSSParserToken.h"
9 #include "core/css/parser/CSSParserTokenRange.h" 9 #include "core/css/parser/CSSParserTokenRange.h"
10 #include "wtf/RefCounted.h" 10 #include "wtf/RefCounted.h"
11 #include "wtf/text/WTFString.h" 11 #include "wtf/text/WTFString.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class CSSParserTokenRange; 15 class CSSParserTokenRange;
16 16
17 class CSSVariableData : public RefCounted<CSSVariableData> { 17 class CSSVariableData : public RefCounted<CSSVariableData> {
18 WTF_MAKE_NONCOPYABLE(CSSVariableData); 18 WTF_MAKE_NONCOPYABLE(CSSVariableData);
19 USING_FAST_MALLOC(CSSVariableData); 19 USING_FAST_MALLOC(CSSVariableData);
20 public: 20 public:
21 static PassRefPtr<CSSVariableData> create(const CSSParserTokenRange& range, bool needsVariableResolution = true) 21 static PassRefPtr<CSSVariableData> create(const CSSParserTokenRange& range, bool needsVariableResolution = true)
22 { 22 {
23 return adoptRef(new CSSVariableData(range, needsVariableResolution)); 23 return adoptRef(new CSSVariableData(range, needsVariableResolution));
24 } 24 }
25 25
26 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke n>& resolvedTokens, PassRefPtr<CSSVariableData> unresolvedData) 26 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke n>& resolvedTokens, const CSSVariableData& unresolvedData)
27 { 27 {
28 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData->m_ba ckingString)); 28 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData.m_bac kingString));
29 } 29 }
30 30
31 CSSParserTokenRange tokenRange() { return m_tokens; } 31 CSSParserTokenRange tokenRange() { return m_tokens; }
32 32
33 const Vector<CSSParserToken>& tokens() const { return m_tokens; } 33 const Vector<CSSParserToken>& tokens() const { return m_tokens; }
34 34
35 bool operator==(const CSSVariableData& other) const; 35 bool operator==(const CSSVariableData& other) const;
36 36
37 bool needsVariableResolution() const { return m_needsVariableResolution; } 37 bool needsVariableResolution() const { return m_needsVariableResolution; }
38 private: 38 private:
(...skipping 13 matching lines...) Expand all
52 template<typename CharacterType> void updateTokens(const CSSParserTokenRange &); 52 template<typename CharacterType> void updateTokens(const CSSParserTokenRange &);
53 53
54 String m_backingString; 54 String m_backingString;
55 Vector<CSSParserToken> m_tokens; 55 Vector<CSSParserToken> m_tokens;
56 const bool m_needsVariableResolution; 56 const bool m_needsVariableResolution;
57 }; 57 };
58 58
59 } // namespace blink 59 } // namespace blink
60 60
61 #endif // CSSVariableData_h 61 #endif // CSSVariableData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698