OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef StylePropertyMap_h | |
6 #define StylePropertyMap_h | |
7 | |
8 #include "bindings/core/v8/Iterable.h" | |
9 #include "bindings/core/v8/ScriptWrappable.h" | |
10 #include "bindings/core/v8/UnionTypesCore.h" | |
11 #include "core/CSSPropertyNames.h" | |
12 #include "core/CoreExport.h" | |
13 #include "core/css/cssom/StyleValue.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class ExceptionState; | |
18 | |
19 class CORE_EXPORT StylePropertyMap : public GarbageCollectedFinalized<StylePrope rtyMap>, public ScriptWrappable, public PairIterable<String, StyleValueOrStyleVa lueSequence> { | |
20 WTF_MAKE_NONCOPYABLE(StylePropertyMap); | |
21 DEFINE_WRAPPERTYPEINFO(); | |
22 public: | |
23 // Accessors. | |
24 virtual StyleValue* get(const String& propertyName); | |
25 virtual StyleValue* get(CSSPropertyID) = 0; | |
26 virtual HeapVector<StyleValue*> getAll(const String& propertyName) = 0; | |
27 virtual Vector<String> getProperties() = 0; | |
28 virtual bool has(const String& propertyName) = 0; | |
29 | |
30 // Modifiers. | |
31 virtual void set(const String& propertyName, StyleValueOrStyleValueSequenceO rString& item, ExceptionState&); | |
32 virtual void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& item , ExceptionState&) = 0; | |
33 virtual void append(const String& propertyName, StyleValueOrStyleValueSequen ceOrString& item, ExceptionState&) = 0; | |
34 virtual void remove(const String& propertyName, ExceptionState&) = 0; | |
35 | |
36 DEFINE_INLINE_VIRTUAL_TRACE() { } | |
37 | |
38 protected: | |
39 StylePropertyMap() {} | |
40 }; | |
41 | |
42 class CORE_EXPORT MutableStylePropertyMap : public StylePropertyMap { | |
43 }; | |
44 | |
45 class CORE_EXPORT ImmutableStylePropertyMap : public StylePropertyMap { | |
Timothy Loh
2016/01/18 03:47:23
Classes should be in their own files.
meade_UTC10
2016/01/19 00:15:19
Done.
| |
46 public: | |
47 void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString&, ExceptionSt ate& exceptionState) override | |
48 { | |
49 exceptionState.throwTypeError("This StylePropertyMap is immutable."); | |
50 } | |
51 | |
52 void append(const String& propertyName, StyleValueOrStyleValueSequenceOrStri ng&, ExceptionState& exceptionState) override | |
53 { | |
54 exceptionState.throwTypeError("This StylePropertyMap is immutable."); | |
55 } | |
56 | |
57 void remove(const String& propertyName, ExceptionState& exceptionState) over ride | |
58 { | |
59 exceptionState.throwTypeError("This StylePropertyMap is immutable."); | |
60 } | |
61 }; | |
62 | |
63 } // namespace blink | |
64 | |
65 #endif | |
OLD | NEW |