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

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

Issue 2873943002: Ensure original parser context is used when parsing resolved var() references (Closed)
Patch Set: g cl set-commit Created 3 years, 7 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 CSSVariableReferenceValue_h 5 #ifndef CSSVariableReferenceValue_h
6 #define CSSVariableReferenceValue_h 6 #define CSSVariableReferenceValue_h
7 7
8 #include "core/css/CSSValue.h" 8 #include "core/css/CSSValue.h"
9 #include "core/css/CSSVariableData.h" 9 #include "core/css/CSSVariableData.h"
10 #include "core/css/parser/CSSParserContext.h"
10 #include "platform/wtf/RefPtr.h" 11 #include "platform/wtf/RefPtr.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class CSSVariableReferenceValue : public CSSValue { 15 class CSSVariableReferenceValue : public CSSValue {
15 public: 16 public:
16 static CSSVariableReferenceValue* Create(PassRefPtr<CSSVariableData> data) { 17 static CSSVariableReferenceValue* Create(PassRefPtr<CSSVariableData> data,
17 return new CSSVariableReferenceValue(std::move(data)); 18 const CSSParserContext& context) {
19 return new CSSVariableReferenceValue(std::move(data), context);
18 } 20 }
19 21
20 CSSVariableData* VariableDataValue() const { return data_.Get(); } 22 CSSVariableData* VariableDataValue() const { return data_.Get(); }
23 const CSSParserContext* ParserContext() const {
24 return parser_context_.Get();
25 }
21 26
22 bool Equals(const CSSVariableReferenceValue& other) const { 27 bool Equals(const CSSVariableReferenceValue& other) const {
23 return data_ == other.data_; 28 return data_ == other.data_;
24 } 29 }
25 String CustomCSSText() const; 30 String CustomCSSText() const;
26 31
27 DECLARE_TRACE_AFTER_DISPATCH(); 32 DECLARE_TRACE_AFTER_DISPATCH();
28 33
29 private: 34 private:
30 CSSVariableReferenceValue(PassRefPtr<CSSVariableData> data) 35 CSSVariableReferenceValue(PassRefPtr<CSSVariableData> data,
31 : CSSValue(kVariableReferenceClass), data_(std::move(data)) {} 36 const CSSParserContext& context)
37 : CSSValue(kVariableReferenceClass),
38 data_(std::move(data)),
39 parser_context_(context) {
40 DCHECK(parser_context_);
41 }
32 42
33 RefPtr<CSSVariableData> data_; 43 RefPtr<CSSVariableData> data_;
44 Member<const CSSParserContext> parser_context_;
34 }; 45 };
35 46
36 DEFINE_CSS_VALUE_TYPE_CASTS(CSSVariableReferenceValue, 47 DEFINE_CSS_VALUE_TYPE_CASTS(CSSVariableReferenceValue,
37 IsVariableReferenceValue()); 48 IsVariableReferenceValue());
38 49
39 } // namespace blink 50 } // namespace blink
40 51
41 #endif // CSSVariableReferenceValue_h 52 #endif // CSSVariableReferenceValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698