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