| OLD | NEW |
| 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/StringOrCSSVariableReferenceValue.h" | 9 #include "bindings/core/v8/StringOrCSSVariableReferenceValue.h" |
| 10 #include "core/css/cssom/CSSStyleValue.h" | 10 #include "core/css/cssom/CSSStyleValue.h" |
| 11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class CORE_EXPORT CSSTokenStreamValue final : public CSSStyleValue, public Value
Iterable<StringOrCSSVariableReferenceValue> { | 15 class CORE_EXPORT CSSTokenStreamValue final : public CSSStyleValue, public Value
Iterable<StringOrCSSVariableReferenceValue> { |
| 16 WTF_MAKE_NONCOPYABLE(CSSTokenStreamValue); | 16 WTF_MAKE_NONCOPYABLE(CSSTokenStreamValue); |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 public: | 18 public: |
| 19 static CSSTokenStreamValue* create(const Vector<String>& fragments) | 19 static CSSTokenStreamValue* create(const HeapVector<StringOrCSSVariableRefer
enceValue>& fragments) |
| 20 { | 20 { |
| 21 return new CSSTokenStreamValue(fragments); | 21 return new CSSTokenStreamValue(fragments); |
| 22 } | 22 } |
| 23 | 23 |
| 24 CSSValue* toCSSValue() const override; | 24 CSSValue* toCSSValue() const override; |
| 25 | 25 |
| 26 StyleValueType type() const override { return TokenStreamType; } | 26 StyleValueType type() const override { return TokenStreamType; } |
| 27 | 27 |
| 28 String fragmentAtIndex(int index) const { return m_fragments.at(index); } | 28 StringOrCSSVariableReferenceValue fragmentAtIndex(int index) const { return
m_fragments.at(index); } |
| 29 | 29 |
| 30 size_t size() const { return m_fragments.size(); } | 30 size_t size() const { return m_fragments.size(); } |
| 31 | 31 |
| 32 DEFINE_INLINE_VIRTUAL_TRACE() |
| 33 { |
| 34 visitor->trace(m_fragments); |
| 35 CSSStyleValue::trace(visitor); |
| 36 } |
| 37 |
| 32 protected: | 38 protected: |
| 33 CSSTokenStreamValue(const Vector<String>& fragments) | 39 CSSTokenStreamValue(const HeapVector<StringOrCSSVariableReferenceValue>& fra
gments) |
| 34 : CSSStyleValue() | 40 : CSSStyleValue() |
| 35 , m_fragments(fragments) | 41 , m_fragments(fragments) |
| 36 { | 42 { |
| 37 } | 43 } |
| 38 | 44 |
| 39 private: | 45 private: |
| 40 IterationSource* startIteration(ScriptState*, ExceptionState&) override; | 46 IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
| 41 | 47 |
| 42 Vector<String> m_fragments; | 48 HeapVector<StringOrCSSVariableReferenceValue> m_fragments; |
| 43 }; | 49 }; |
| 44 | 50 |
| 45 } // namespace blink | 51 } // namespace blink |
| 46 | 52 |
| 47 #endif // CSSTokenStreamValue_h | 53 #endif // CSSTokenStreamValue_h |
| OLD | NEW |