OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> | 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #ifndef ElementRareData_h | 22 #ifndef ElementRareData_h |
23 #define ElementRareData_h | 23 #define ElementRareData_h |
24 | 24 |
25 #include "core/animation/ActiveAnimations.h" | 25 #include "core/animation/ActiveAnimations.h" |
26 #include "core/dom/DatasetDOMStringMap.h" | 26 #include "core/dom/DatasetDOMStringMap.h" |
27 #include "core/dom/NamedNodeMap.h" | |
28 #include "core/dom/NodeRareData.h" | 27 #include "core/dom/NodeRareData.h" |
29 #include "core/dom/PseudoElement.h" | 28 #include "core/dom/PseudoElement.h" |
30 #include "core/dom/custom/CustomElementDefinition.h" | 29 #include "core/dom/custom/CustomElementDefinition.h" |
31 #include "core/dom/shadow/ElementShadow.h" | 30 #include "core/dom/shadow/ElementShadow.h" |
32 #include "core/html/ClassList.h" | 31 #include "core/html/ClassList.h" |
33 #include "core/html/ime/InputMethodContext.h" | 32 #include "core/html/ime/InputMethodContext.h" |
34 #include "core/rendering/style/StyleInheritedData.h" | 33 #include "core/rendering/style/StyleInheritedData.h" |
35 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
36 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
37 | 36 |
38 namespace WebCore { | 37 namespace WebCore { |
39 | 38 |
39 class AttrData; | |
40 class HTMLElement; | 40 class HTMLElement; |
41 class NamedNodeMap; | |
41 | 42 |
42 class ElementRareData : public NodeRareData { | 43 class ElementRareData : public NodeRareData { |
43 public: | 44 public: |
44 static ElementRareData* create(RenderObject* renderer) | 45 static ElementRareData* create(RenderObject* renderer) |
45 { | 46 { |
46 return new ElementRareData(renderer); | 47 return new ElementRareData(renderer); |
47 } | 48 } |
48 | 49 |
49 ~ElementRareData(); | 50 ~ElementRareData(); |
50 | 51 |
(...skipping 20 matching lines...) Expand all Loading... | |
71 | 72 |
72 void clearShadow() { m_shadow = nullptr; } | 73 void clearShadow() { m_shadow = nullptr; } |
73 ElementShadow* shadow() const { return m_shadow.get(); } | 74 ElementShadow* shadow() const { return m_shadow.get(); } |
74 ElementShadow& ensureShadow() | 75 ElementShadow& ensureShadow() |
75 { | 76 { |
76 if (!m_shadow) | 77 if (!m_shadow) |
77 m_shadow = ElementShadow::create(); | 78 m_shadow = ElementShadow::create(); |
78 return *m_shadow; | 79 return *m_shadow; |
79 } | 80 } |
80 | 81 |
81 NamedNodeMap* attributeMap() const { return m_attributeMap.get(); } | |
82 void setAttributeMap(PassOwnPtrWillBeRawPtr<NamedNodeMap> attributeMap) { m_ attributeMap = attributeMap; } | |
83 | |
84 RenderStyle* computedStyle() const { return m_computedStyle.get(); } | 82 RenderStyle* computedStyle() const { return m_computedStyle.get(); } |
85 void setComputedStyle(PassRefPtr<RenderStyle> computedStyle) { m_computedSty le = computedStyle; } | 83 void setComputedStyle(PassRefPtr<RenderStyle> computedStyle) { m_computedSty le = computedStyle; } |
86 void clearComputedStyle() { m_computedStyle = nullptr; } | 84 void clearComputedStyle() { m_computedStyle = nullptr; } |
87 | 85 |
88 ClassList* classList() const { return m_classList.get(); } | 86 ClassList* classList() const { return m_classList.get(); } |
89 void setClassList(PassOwnPtrWillBeRawPtr<ClassList> classList) { m_classList = classList; } | 87 void setClassList(PassOwnPtrWillBeRawPtr<ClassList> classList) { m_classList = classList; } |
90 void clearClassListValueForQuirksMode() | 88 void clearClassListValueForQuirksMode() |
91 { | 89 { |
92 if (!m_classList) | 90 if (!m_classList) |
93 return; | 91 return; |
(...skipping 22 matching lines...) Expand all Loading... | |
116 m_inputMethodContext = InputMethodContext::create(element); | 114 m_inputMethodContext = InputMethodContext::create(element); |
117 return *m_inputMethodContext; | 115 return *m_inputMethodContext; |
118 } | 116 } |
119 | 117 |
120 bool hasPseudoElements() const; | 118 bool hasPseudoElements() const; |
121 void clearPseudoElements(); | 119 void clearPseudoElements(); |
122 | 120 |
123 void setCustomElementDefinition(PassRefPtr<CustomElementDefinition> definiti on) { m_customElementDefinition = definition; } | 121 void setCustomElementDefinition(PassRefPtr<CustomElementDefinition> definiti on) { m_customElementDefinition = definition; } |
124 CustomElementDefinition* customElementDefinition() const { return m_customEl ementDefinition.get(); } | 122 CustomElementDefinition* customElementDefinition() const { return m_customEl ementDefinition.get(); } |
125 | 123 |
124 AttrData& ensureAttrData(); | |
125 AttrData* attrData() { return m_attrData.get(); } | |
esprehn
2014/06/17 08:27:05
const
| |
126 | |
126 void traceAfterDispatch(Visitor*); | 127 void traceAfterDispatch(Visitor*); |
127 | 128 |
128 private: | 129 private: |
129 short m_tabindex; | 130 short m_tabindex; |
130 | 131 |
131 LayoutSize m_minimumSizeForResizing; | 132 LayoutSize m_minimumSizeForResizing; |
132 IntSize m_savedLayerScrollOffset; | 133 IntSize m_savedLayerScrollOffset; |
133 | 134 |
134 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset; | 135 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset; |
135 OwnPtrWillBeMember<ClassList> m_classList; | 136 OwnPtrWillBeMember<ClassList> m_classList; |
136 OwnPtrWillBeMember<ElementShadow> m_shadow; | 137 OwnPtrWillBeMember<ElementShadow> m_shadow; |
137 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; | 138 OwnPtrWillBeMember<AttrData> m_attrData; |
138 OwnPtrWillBeMember<InputMethodContext> m_inputMethodContext; | 139 OwnPtrWillBeMember<InputMethodContext> m_inputMethodContext; |
139 OwnPtrWillBeMember<ActiveAnimations> m_activeAnimations; | 140 OwnPtrWillBeMember<ActiveAnimations> m_activeAnimations; |
140 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; | 141 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; |
141 | 142 |
142 RefPtr<RenderStyle> m_computedStyle; | 143 RefPtr<RenderStyle> m_computedStyle; |
143 RefPtr<CustomElementDefinition> m_customElementDefinition; | 144 RefPtr<CustomElementDefinition> m_customElementDefinition; |
144 | 145 |
145 RefPtrWillBeMember<PseudoElement> m_generatedBefore; | 146 RefPtrWillBeMember<PseudoElement> m_generatedBefore; |
146 RefPtrWillBeMember<PseudoElement> m_generatedAfter; | 147 RefPtrWillBeMember<PseudoElement> m_generatedAfter; |
147 RefPtrWillBeMember<PseudoElement> m_backdrop; | 148 RefPtrWillBeMember<PseudoElement> m_backdrop; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 default: | 220 default: |
220 return 0; | 221 return 0; |
221 } | 222 } |
222 } | 223 } |
223 | 224 |
224 inline void ElementRareData::resetStyleState() | 225 inline void ElementRareData::resetStyleState() |
225 { | 226 { |
226 clearElementFlag(StyleAffectedByEmpty); | 227 clearElementFlag(StyleAffectedByEmpty); |
227 } | 228 } |
228 | 229 |
230 class AttrData : public NoBaseWillBeGarbageCollected<AttrData> { | |
haraken
2014/06/17 02:07:02
This is something like we're introducing another R
esprehn
2014/06/17 08:27:05
We really should put these in separate files, but
| |
231 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(AttrData); | |
232 public: | |
233 static PassOwnPtrWillBeRawPtr<AttrData> create(); | |
234 void trace(Visitor*); | |
235 | |
236 WillBeHeapVector<RefPtrWillBeMember<Attr> >& ensureAttrNodeList(); | |
237 WillBeHeapVector<RefPtrWillBeMember<Attr> >* attrNodeList() { return m_attrN odeList.get(); } | |
esprehn
2014/06/17 08:27:05
const
| |
238 void removeAttrNodeList(); | |
239 | |
240 NamedNodeMap* attributeMap() const { return m_attributeMap.get(); } | |
241 void setAttributeMap(PassOwnPtrWillBeRawPtr<NamedNodeMap>); | |
242 | |
243 private: | |
244 AttrData(); | |
245 | |
246 OwnPtrWillBeMember<WillBeHeapVector<RefPtrWillBeMember<Attr> > > m_attrNodeL ist; | |
247 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; | |
248 }; | |
249 | |
229 } // namespace | 250 } // namespace |
230 | 251 |
231 #endif // ElementRareData_h | 252 #endif // ElementRareData_h |
OLD | NEW |