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

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

Issue 2683853005: bindings: Make some value iterator properties aliases to Array.prototype functions (Closed)
Patch Set: Remove constexpr from Internals.h to fix the Android build Created 3 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 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 CSSUnparsedValue_h 5 #ifndef CSSUnparsedValue_h
6 #define CSSUnparsedValue_h 6 #define CSSUnparsedValue_h
7 7
8 #include "bindings/core/v8/Iterable.h"
9 #include "bindings/core/v8/StringOrCSSVariableReferenceValue.h" 8 #include "bindings/core/v8/StringOrCSSVariableReferenceValue.h"
10 #include "core/css/CSSVariableReferenceValue.h" 9 #include "core/css/CSSVariableReferenceValue.h"
11 #include "core/css/cssom/CSSStyleValue.h" 10 #include "core/css/cssom/CSSStyleValue.h"
12 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
13 12
14 namespace blink { 13 namespace blink {
15 14
16 class CORE_EXPORT CSSUnparsedValue final 15 class CORE_EXPORT CSSUnparsedValue final : public CSSStyleValue {
17 : public CSSStyleValue,
18 public ValueIterable<StringOrCSSVariableReferenceValue> {
19 WTF_MAKE_NONCOPYABLE(CSSUnparsedValue); 16 WTF_MAKE_NONCOPYABLE(CSSUnparsedValue);
20 DEFINE_WRAPPERTYPEINFO(); 17 DEFINE_WRAPPERTYPEINFO();
21 18
22 public: 19 public:
23 static CSSUnparsedValue* create( 20 static CSSUnparsedValue* create(
24 const HeapVector<StringOrCSSVariableReferenceValue>& fragments) { 21 const HeapVector<StringOrCSSVariableReferenceValue>& fragments) {
25 return new CSSUnparsedValue(fragments); 22 return new CSSUnparsedValue(fragments);
26 } 23 }
27 24
28 static CSSUnparsedValue* fromCSSValue(const CSSVariableReferenceValue&); 25 static CSSUnparsedValue* fromCSSValue(const CSSVariableReferenceValue&);
29 26
30 CSSValue* toCSSValue() const override; 27 CSSValue* toCSSValue() const override;
31 28
32 StyleValueType type() const override { return UnparsedType; } 29 StyleValueType type() const override { return UnparsedType; }
33 30
34 StringOrCSSVariableReferenceValue fragmentAtIndex(int index) const { 31 StringOrCSSVariableReferenceValue fragmentAtIndex(uint32_t index) const {
35 return m_fragments.at(index); 32 return m_fragments.at(index);
36 } 33 }
37 34
38 size_t size() const { return m_fragments.size(); } 35 size_t length() const { return m_fragments.size(); }
39 36
40 DEFINE_INLINE_VIRTUAL_TRACE() { 37 DEFINE_INLINE_VIRTUAL_TRACE() {
41 visitor->trace(m_fragments); 38 visitor->trace(m_fragments);
42 CSSStyleValue::trace(visitor); 39 CSSStyleValue::trace(visitor);
43 } 40 }
44 41
45 protected: 42 protected:
46 CSSUnparsedValue( 43 CSSUnparsedValue(
47 const HeapVector<StringOrCSSVariableReferenceValue>& fragments) 44 const HeapVector<StringOrCSSVariableReferenceValue>& fragments)
48 : CSSStyleValue(), m_fragments(fragments) {} 45 : CSSStyleValue(), m_fragments(fragments) {}
49 46
50 private: 47 private:
51 static CSSUnparsedValue* fromString(String string) { 48 static CSSUnparsedValue* fromString(String string) {
52 HeapVector<StringOrCSSVariableReferenceValue> fragments; 49 HeapVector<StringOrCSSVariableReferenceValue> fragments;
53 fragments.push_back(StringOrCSSVariableReferenceValue::fromString(string)); 50 fragments.push_back(StringOrCSSVariableReferenceValue::fromString(string));
54 return create(fragments); 51 return create(fragments);
55 } 52 }
56 53
57 IterationSource* startIteration(ScriptState*, ExceptionState&) override;
58
59 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest, ListOfStrings); 54 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest, ListOfStrings);
60 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest, 55 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest,
61 ListOfCSSVariableReferenceValues); 56 ListOfCSSVariableReferenceValues);
62 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest, MixedList); 57 FRIEND_TEST_ALL_PREFIXES(CSSUnparsedValueTest, MixedList);
63 FRIEND_TEST_ALL_PREFIXES(CSSVariableReferenceValueTest, MixedList); 58 FRIEND_TEST_ALL_PREFIXES(CSSVariableReferenceValueTest, MixedList);
64 59
65 HeapVector<StringOrCSSVariableReferenceValue> m_fragments; 60 HeapVector<StringOrCSSVariableReferenceValue> m_fragments;
66 }; 61 };
67 62
68 } // namespace blink 63 } // namespace blink
69 64
70 #endif // CSSUnparsedValue_h 65 #endif // CSSUnparsedValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698