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 ComputedStylePropertyMap_h | 5 #ifndef ComputedStylePropertyMap_h |
6 #define ComputedStylePropertyMap_h | 6 #define ComputedStylePropertyMap_h |
7 | 7 |
8 #include "core/css/CSSComputedStyleDeclaration.h" | 8 #include "core/css/CSSComputedStyleDeclaration.h" |
9 #include "core/css/cssom/ImmutableStylePropertyMap.h" | 9 #include "core/css/cssom/StylePropertyMapReadonly.h" |
10 #include "core/dom/Node.h" | 10 #include "core/dom/Node.h" |
11 #include "core/layout/LayoutObject.h" | 11 #include "core/layout/LayoutObject.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // This class implements computed StylePropertMapReadOnly in the Typed CSSOM | 15 // This class implements computed StylePropertMapReadOnly in the Typed CSSOM |
16 // API. The specification is here: | 16 // API. The specification is here: |
17 // https://drafts.css-houdini.org/css-typed-om-1/#computed-stylepropertymapreado
nly-objects | 17 // https://drafts.css-houdini.org/css-typed-om-1/#computed-stylepropertymapreado
nly-objects |
18 // | 18 // |
19 // The computed StylePropertyMapReadOnly retrieves computed styles and returns | 19 // The computed StylePropertyMapReadOnly retrieves computed styles and returns |
20 // them as CSSStyleValues. The IDL for this class is in StylePropertyMap.idl. | 20 // them as CSSStyleValues. The IDL for this class is in StylePropertyMap.idl. |
21 // The computed StylePropertyMapReadOnly for an element is accessed via | 21 // The computed StylePropertyMapReadOnly for an element is accessed via |
22 // window.getComputedStyleMap(element) (see WindowGetComputedStyle.idl/h) | 22 // window.getComputedStyleMap(element) (see WindowGetComputedStyle.idl/h) |
23 class CORE_EXPORT ComputedStylePropertyMap : public ImmutableStylePropertyMap { | 23 class CORE_EXPORT ComputedStylePropertyMap : public StylePropertyMapReadonly { |
24 WTF_MAKE_NONCOPYABLE(ComputedStylePropertyMap); | 24 WTF_MAKE_NONCOPYABLE(ComputedStylePropertyMap); |
25 | 25 |
26 public: | 26 public: |
27 static ComputedStylePropertyMap* create(Node* node, | 27 static ComputedStylePropertyMap* create(Node* node, |
28 const String& pseudoElement) { | 28 const String& pseudoElement) { |
29 return new ComputedStylePropertyMap(node, pseudoElement); | 29 return new ComputedStylePropertyMap(node, pseudoElement); |
30 } | 30 } |
31 | 31 |
32 Vector<String> getProperties() override; | 32 Vector<String> getProperties() override; |
33 | 33 |
34 DEFINE_INLINE_VIRTUAL_TRACE() { | 34 DEFINE_INLINE_VIRTUAL_TRACE() { |
35 visitor->trace(m_computedStyleDeclaration); | 35 visitor->trace(m_computedStyleDeclaration); |
36 visitor->trace(m_node); | 36 visitor->trace(m_node); |
37 ImmutableStylePropertyMap::trace(visitor); | 37 StylePropertyMapReadonly::trace(visitor); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 Node* node() const; | 41 Node* node() const; |
42 | 42 |
43 protected: | 43 protected: |
44 ComputedStylePropertyMap(Node* node, const String& pseudoElement = String()) | 44 ComputedStylePropertyMap(Node* node, const String& pseudoElement = String()) |
45 : ImmutableStylePropertyMap(), | 45 : StylePropertyMapReadonly(), |
46 m_computedStyleDeclaration( | 46 m_computedStyleDeclaration( |
47 CSSComputedStyleDeclaration::create(node, false, pseudoElement)), | 47 CSSComputedStyleDeclaration::create(node, false, pseudoElement)), |
48 m_pseudoId(CSSSelector::parsePseudoId(pseudoElement)), | 48 m_pseudoId(CSSSelector::parsePseudoId(pseudoElement)), |
49 m_node(node) {} | 49 m_node(node) {} |
50 | 50 |
51 CSSStyleValueVector getAllInternal(CSSPropertyID) override; | 51 CSSStyleValueVector getAllInternal(CSSPropertyID) override; |
52 CSSStyleValueVector getAllInternal(AtomicString customPropertyName) override; | 52 CSSStyleValueVector getAllInternal(AtomicString customPropertyName) override; |
53 | 53 |
54 HeapVector<StylePropertyMapEntry> getIterationEntries() override { | 54 HeapVector<StylePropertyMapEntry> getIterationEntries() override { |
55 return HeapVector<StylePropertyMapEntry>(); | 55 return HeapVector<StylePropertyMapEntry>(); |
56 } | 56 } |
57 | 57 |
58 Member<CSSComputedStyleDeclaration> m_computedStyleDeclaration; | 58 Member<CSSComputedStyleDeclaration> m_computedStyleDeclaration; |
59 PseudoId m_pseudoId; | 59 PseudoId m_pseudoId; |
60 Member<Node> m_node; | 60 Member<Node> m_node; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace blink | 63 } // namespace blink |
64 | 64 |
65 #endif | 65 #endif |
OLD | NEW |