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 StylePropertyMap_h | 5 #ifndef StylePropertyMap_h |
6 #define StylePropertyMap_h | 6 #define StylePropertyMap_h |
7 | 7 |
8 #include "bindings/core/v8/CSSStyleValueOrCSSStyleValueSequence.h" | 8 #include "core/css/cssom/StylePropertyMapReadonly.h" |
9 #include "bindings/core/v8/CSSStyleValueOrCSSStyleValueSequenceOrString.h" | |
10 #include "bindings/core/v8/Iterable.h" | |
11 #include "bindings/core/v8/ScriptWrappable.h" | |
12 #include "core/CSSPropertyNames.h" | |
13 #include "core/CoreExport.h" | |
14 #include "core/css/cssom/CSSStyleValue.h" | |
15 | 9 |
16 namespace blink { | 10 namespace blink { |
17 | 11 |
18 class ExceptionState; | 12 class ExceptionState; |
19 | 13 |
20 class CORE_EXPORT StylePropertyMap | 14 class CORE_EXPORT StylePropertyMap : public StylePropertyMapReadonly { |
21 : public GarbageCollectedFinalized<StylePropertyMap>, | 15 DEFINE_WRAPPERTYPEINFO(); |
22 public ScriptWrappable, | |
23 public PairIterable<String, CSSStyleValueOrCSSStyleValueSequence> { | |
24 WTF_MAKE_NONCOPYABLE(StylePropertyMap); | 16 WTF_MAKE_NONCOPYABLE(StylePropertyMap); |
25 DEFINE_WRAPPERTYPEINFO(); | |
26 | 17 |
27 public: | 18 public: |
28 typedef std::pair<String, CSSStyleValueOrCSSStyleValueSequence> | |
29 StylePropertyMapEntry; | |
30 | |
31 virtual ~StylePropertyMap() {} | |
32 | |
33 // Accessors. | |
34 virtual CSSStyleValue* get(const String& propertyName, ExceptionState&); | |
35 virtual CSSStyleValueVector getAll(const String& propertyName, | |
36 ExceptionState&); | |
37 virtual bool has(const String& propertyName, ExceptionState&); | |
38 | |
39 virtual Vector<String> getProperties() = 0; | |
40 | |
41 // Modifiers. | |
42 void set(const String& propertyName, | 19 void set(const String& propertyName, |
43 CSSStyleValueOrCSSStyleValueSequenceOrString& item, | 20 CSSStyleValueOrCSSStyleValueSequenceOrString& item, |
44 ExceptionState&); | 21 ExceptionState&); |
45 void append(const String& propertyName, | 22 void append(const String& propertyName, |
46 CSSStyleValueOrCSSStyleValueSequenceOrString& item, | 23 CSSStyleValueOrCSSStyleValueSequenceOrString& item, |
47 ExceptionState&); | 24 ExceptionState&); |
48 void remove(const String& propertyName, ExceptionState&); | 25 void remove(const String& propertyName, ExceptionState&); |
49 | 26 |
50 virtual void set(CSSPropertyID, | 27 virtual void set(CSSPropertyID, |
51 CSSStyleValueOrCSSStyleValueSequenceOrString& item, | 28 CSSStyleValueOrCSSStyleValueSequenceOrString& item, |
52 ExceptionState&) = 0; | 29 ExceptionState&) = 0; |
53 virtual void append(CSSPropertyID, | 30 virtual void append(CSSPropertyID, |
54 CSSStyleValueOrCSSStyleValueSequenceOrString& item, | 31 CSSStyleValueOrCSSStyleValueSequenceOrString& item, |
55 ExceptionState&) = 0; | 32 ExceptionState&) = 0; |
56 virtual void remove(CSSPropertyID, ExceptionState&) = 0; | 33 virtual void remove(CSSPropertyID, ExceptionState&) = 0; |
57 | 34 |
58 DEFINE_INLINE_VIRTUAL_TRACE() {} | |
59 | |
60 protected: | 35 protected: |
61 StylePropertyMap() {} | 36 StylePropertyMap() {} |
62 | 37 |
63 virtual CSSStyleValueVector getAllInternal(CSSPropertyID) = 0; | |
64 virtual CSSStyleValueVector getAllInternal( | |
65 AtomicString customPropertyName) = 0; | |
66 | |
67 virtual HeapVector<StylePropertyMapEntry> getIterationEntries() = 0; | |
68 IterationSource* startIteration(ScriptState*, ExceptionState&) override; | |
69 }; | 38 }; |
70 | 39 |
71 } // namespace blink | 40 } // namespace blink |
72 | 41 |
73 #endif | 42 #endif |
OLD | NEW |