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

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

Issue 1874623002: Implement iterable<DOMString, (StyleValue or sequence<StyleValue>)> for InlineStylePropertyMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@computed-stylepropertymap-2
Patch Set: Address review comments Created 4 years, 7 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 StylePropertyMap_h 5 #ifndef StylePropertyMap_h
6 #define StylePropertyMap_h 6 #define StylePropertyMap_h
7 7
8 #include "bindings/core/v8/Iterable.h" 8 #include "bindings/core/v8/Iterable.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/core/v8/UnionTypesCore.h" 10 #include "bindings/core/v8/UnionTypesCore.h"
11 #include "core/CSSPropertyNames.h" 11 #include "core/CSSPropertyNames.h"
12 #include "core/CoreExport.h" 12 #include "core/CoreExport.h"
13 #include "core/css/cssom/StyleValue.h" 13 #include "core/css/cssom/StyleValue.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class ExceptionState; 17 class ExceptionState;
18 18
19 class CORE_EXPORT StylePropertyMap : public GarbageCollectedFinalized<StylePrope rtyMap>, public ScriptWrappable, public PairIterable<String, StyleValueOrStyleVa lueSequence> { 19 class CORE_EXPORT StylePropertyMap : public GarbageCollectedFinalized<StylePrope rtyMap>, public ScriptWrappable, public PairIterable<String, StyleValueOrStyleVa lueSequence> {
20 WTF_MAKE_NONCOPYABLE(StylePropertyMap); 20 WTF_MAKE_NONCOPYABLE(StylePropertyMap);
21 DEFINE_WRAPPERTYPEINFO(); 21 DEFINE_WRAPPERTYPEINFO();
22 public: 22 public:
23 typedef HeapVector<Member<StyleValue>> StyleValueVector; 23 typedef HeapVector<Member<StyleValue>> StyleValueVector;
24 typedef std::pair<String, StyleValueOrStyleValueSequence> StylePropertyMapEn try;
24 25
25 virtual ~StylePropertyMap() { } 26 virtual ~StylePropertyMap() { }
26 27
27 // Accessors. 28 // Accessors.
28 StyleValue* get(const String& propertyName, ExceptionState&); 29 StyleValue* get(const String& propertyName, ExceptionState&);
29 StyleValueVector getAll(const String& propertyName, ExceptionState&); 30 StyleValueVector getAll(const String& propertyName, ExceptionState&);
30 bool has(const String& propertyName, ExceptionState&); 31 bool has(const String& propertyName, ExceptionState&);
31 32
32 virtual StyleValueVector getAll(CSSPropertyID) = 0; 33 virtual StyleValueVector getAll(CSSPropertyID) = 0;
33 virtual bool has(CSSPropertyID) = 0; 34 virtual bool has(CSSPropertyID) = 0;
34 35
35 virtual Vector<String> getProperties() = 0; 36 virtual Vector<String> getProperties() = 0;
36 37
37 // Modifiers. 38 // Modifiers.
38 void set(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState&); 39 void set(const String& propertyName, StyleValueOrStyleValueSequenceOrString& item, ExceptionState&);
39 void append(const String& propertyName, StyleValueOrStyleValueSequenceOrStri ng& item, ExceptionState&); 40 void append(const String& propertyName, StyleValueOrStyleValueSequenceOrStri ng& item, ExceptionState&);
40 void remove(const String& propertyName, ExceptionState&); 41 void remove(const String& propertyName, ExceptionState&);
41 42
42 virtual void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& item , ExceptionState&) = 0; 43 virtual void set(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& item , ExceptionState&) = 0;
43 virtual void append(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& i tem, ExceptionState&) = 0; 44 virtual void append(CSSPropertyID, StyleValueOrStyleValueSequenceOrString& i tem, ExceptionState&) = 0;
44 virtual void remove(CSSPropertyID, ExceptionState&) = 0; 45 virtual void remove(CSSPropertyID, ExceptionState&) = 0;
45 46
46 DEFINE_INLINE_VIRTUAL_TRACE() { } 47 DEFINE_INLINE_VIRTUAL_TRACE() { }
47 48
48 protected: 49 protected:
49 StylePropertyMap() { } 50 StylePropertyMap() { }
50 51
51 IterationSource* startIteration(ScriptState*, ExceptionState&) override { re turn nullptr; } 52 virtual HeapVector<StylePropertyMapEntry> getIterationEntries() = 0;
53 IterationSource* startIteration(ScriptState*, ExceptionState&) override;
52 StyleValueVector cssValueToStyleValueVector(CSSPropertyID, const CSSValue&); 54 StyleValueVector cssValueToStyleValueVector(CSSPropertyID, const CSSValue&);
53 }; 55 };
54 56
55 } // namespace blink 57 } // namespace blink
56 58
57 #endif 59 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698