Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h |
| diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51dab82f2e684ce40b95ddff57e2fc1cb12f3a11 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef StylePropertyMap_h |
| +#define StylePropertyMap_h |
| + |
| +#include "bindings/core/v8/Iterable.h" |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "bindings/core/v8/UnionTypesCore.h" |
| +#include "core/CSSPropertyNames.h" |
| +#include "core/CoreExport.h" |
| +#include "core/css/cssom/StyleValue.h" |
| + |
| +namespace blink { |
| + |
| +class ExceptionState; |
| + |
| +class CORE_EXPORT StylePropertyMap : public GarbageCollectedFinalized<StylePropertyMap>, public ScriptWrappable, public PairIterable<String, StyleValueOrStyleValueSequence> { |
| + WTF_MAKE_NONCOPYABLE(StylePropertyMap); |
| + DEFINE_WRAPPERTYPEINFO(); |
| +public: |
| + // Accessors. |
| + virtual StyleValue* get(const String& propertyName); |
| + virtual StyleValue* get(CSSPropertyID) = 0; |
| + virtual HeapVector<StyleValue*> getAll(const String& propertyName) = 0; |
| + virtual Vector<String> getProperties() = 0; |
| + virtual bool has(const String& propertyName) = 0; |
| + |
| + // Modifiers. |
| + virtual void set(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState&); |
| + virtual void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& item, ExceptionState&) = 0; |
| + virtual void append(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState&) = 0; |
| + virtual void remove(const String& propertyName, ExceptionState&) = 0; |
| + |
| + DEFINE_INLINE_VIRTUAL_TRACE() { } |
| + |
| +protected: |
| + StylePropertyMap() {} |
| +}; |
| + |
| +class CORE_EXPORT MutableStylePropertyMap : public StylePropertyMap { |
| +}; |
| + |
| +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.
|
| +public: |
| + void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString&, ExceptionState& exceptionState) override |
| + { |
| + exceptionState.throwTypeError("This StylePropertyMap is immutable."); |
| + } |
| + |
| + void append(const String& propertyName, StyleValueOrStyleValueSequenceOrString&, ExceptionState& exceptionState) override |
| + { |
| + exceptionState.throwTypeError("This StylePropertyMap is immutable."); |
| + } |
| + |
| + void remove(const String& propertyName, ExceptionState& exceptionState) override |
| + { |
| + exceptionState.throwTypeError("This StylePropertyMap is immutable."); |
| + } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |