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

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

Issue 2140073002: [Typed-OM] Add compound type of CSSVariableReferenceValue and String with some tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CSSTokenStreamValue
Patch Set: Removed unused variables Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CSSTokenStreamValue_h 5 #ifndef CSSTokenStreamValue_h
6 #define CSSTokenStreamValue_h 6 #define CSSTokenStreamValue_h
7 7
8 #include "bindings/core/v8/Iterable.h" 8 #include "bindings/core/v8/Iterable.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/core/v8/StringOrCSSVariableReferenceValue.h"
10 #include "core/CSSPropertyNames.h" 11 #include "core/CSSPropertyNames.h"
11 #include "core/CoreExport.h" 12 #include "core/CoreExport.h"
12 #include "core/css/CSSCustomIdentValue.h" 13 #include "core/css/CSSCustomIdentValue.h"
13 #include "core/css/CSSPrimitiveValue.h" 14 #include "core/css/CSSPrimitiveValue.h"
14 #include "core/css/cssom/CSSStyleValue.h" 15 #include "core/css/cssom/CSSStyleValue.h"
15 #include "core/css/parser/CSSParserTokenRange.h" 16 #include "core/css/parser/CSSParserTokenRange.h"
16 #include "core/css/parser/CSSPropertyParser.h" 17 #include "core/css/parser/CSSPropertyParser.h"
17 #include "platform/heap/HeapAllocator.h" 18 #include "platform/heap/HeapAllocator.h"
18 #include "wtf/Vector.h" 19 #include "wtf/Vector.h"
19 20
20 namespace blink { 21 namespace blink {
21 22
22 class CORE_EXPORT CSSTokenStreamValue final : public CSSStyleValue, public Value Iterable<String> { 23 class CORE_EXPORT CSSTokenStreamValue final : public CSSStyleValue, public Value Iterable<StringOrCSSVariableReferenceValue> {
23 WTF_MAKE_NONCOPYABLE(CSSTokenStreamValue); 24 WTF_MAKE_NONCOPYABLE(CSSTokenStreamValue);
24 DEFINE_WRAPPERTYPEINFO(); 25 DEFINE_WRAPPERTYPEINFO();
25 public: 26 public:
26 static CSSTokenStreamValue* create(const Vector<String>& listOfReferences) 27 static CSSTokenStreamValue* create(const HeapVector<StringOrCSSVariableRefer enceValue>& listOfReferences)
27 { 28 {
28 return new CSSTokenStreamValue(listOfReferences); 29 return new CSSTokenStreamValue(listOfReferences);
29 } 30 }
30 31
31 CSSValue* toCSSValue() const override; 32 CSSValue* toCSSValue() const override;
32 33
33 StyleValueType type() const override { return TokenStreamType; } 34 StyleValueType type() const override { return TokenStreamType; }
34 35
35 String referenceAtIndex(int index) { return m_listOfReferences.at(index); } 36 StringOrCSSVariableReferenceValue referenceAtIndex(int index) { return m_lis tOfReferences.at(index); }
36 37
37 size_t size() { return m_listOfReferences.size(); } 38 size_t size() { return m_listOfReferences.size(); }
38 39
40 DEFINE_INLINE_VIRTUAL_TRACE()
41 {
42 visitor->trace(m_listOfReferences);
43 CSSStyleValue::trace(visitor);
44 }
45
39 protected: 46 protected:
40 CSSTokenStreamValue(Vector<String> listOfReferences) 47 CSSTokenStreamValue(const HeapVector<StringOrCSSVariableReferenceValue>& lis tOfReferences)
41 : CSSStyleValue() 48 : CSSStyleValue()
42 , m_listOfReferences(listOfReferences) 49 , m_listOfReferences(listOfReferences)
43 { 50 {
44 } 51 }
45 52
46 private: 53 private:
47 IterationSource* startIteration(ScriptState*, ExceptionState&) override; 54 IterationSource* startIteration(ScriptState*, ExceptionState&) override;
48 55
49 Vector<String> m_listOfReferences; 56 HeapVector<StringOrCSSVariableReferenceValue> m_listOfReferences;
50 }; 57 };
51 58
52 } // namespace blink 59 } // namespace blink
53 60
54 #endif // CSSTokenStreamValue_h 61 #endif // CSSTokenStreamValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698