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/ElementAnimations.h" | 25 #include "core/animation/ElementAnimations.h" |
26 #include "core/dom/Attr.h" | 26 #include "core/dom/Attr.h" |
27 #include "core/dom/DatasetDOMStringMap.h" | 27 #include "core/dom/DatasetDOMStringMap.h" |
| 28 #include "core/dom/IntersectionObservation.h" |
| 29 #include "core/dom/IntersectionObserver.h" |
28 #include "core/dom/NamedNodeMap.h" | 30 #include "core/dom/NamedNodeMap.h" |
29 #include "core/dom/NodeRareData.h" | 31 #include "core/dom/NodeRareData.h" |
30 #include "core/dom/PseudoElement.h" | 32 #include "core/dom/PseudoElement.h" |
31 #include "core/dom/custom/CustomElementDefinition.h" | 33 #include "core/dom/custom/CustomElementDefinition.h" |
32 #include "core/dom/shadow/ElementShadow.h" | 34 #include "core/dom/shadow/ElementShadow.h" |
33 #include "core/html/ClassList.h" | 35 #include "core/html/ClassList.h" |
34 #include "core/style/StyleInheritedData.h" | 36 #include "core/style/StyleInheritedData.h" |
35 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "wtf/HashSet.h" |
36 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 40 #include "wtf/WeakPtr.h" |
37 | 41 |
38 namespace blink { | 42 namespace blink { |
39 | 43 |
40 class HTMLElement; | 44 class HTMLElement; |
41 | 45 |
42 class ElementRareData : public NodeRareData { | 46 class ElementRareData : public NodeRareData { |
43 public: | 47 public: |
44 static ElementRareData* create(LayoutObject* layoutObject) | 48 static ElementRareData* create(LayoutObject* layoutObject) |
45 { | 49 { |
46 return new ElementRareData(layoutObject); | 50 return new ElementRareData(layoutObject); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 104 |
101 IntSize savedLayerScrollOffset() const { return m_savedLayerScrollOffset; } | 105 IntSize savedLayerScrollOffset() const { return m_savedLayerScrollOffset; } |
102 void setSavedLayerScrollOffset(IntSize size) { m_savedLayerScrollOffset = si
ze; } | 106 void setSavedLayerScrollOffset(IntSize size) { m_savedLayerScrollOffset = si
ze; } |
103 | 107 |
104 ElementAnimations* elementAnimations() { return m_elementAnimations.get(); } | 108 ElementAnimations* elementAnimations() { return m_elementAnimations.get(); } |
105 void setElementAnimations(ElementAnimations* elementAnimations) | 109 void setElementAnimations(ElementAnimations* elementAnimations) |
106 { | 110 { |
107 m_elementAnimations = elementAnimations; | 111 m_elementAnimations = elementAnimations; |
108 } | 112 } |
109 | 113 |
| 114 bool hasIntersectionObservation() const |
| 115 { |
| 116 return m_intersectionObservations && m_intersectionObservations->size(); |
| 117 } |
| 118 |
| 119 IntersectionObservation::HashSet& intersectionObservations() |
| 120 { |
| 121 if (!m_intersectionObservations) |
| 122 m_intersectionObservations = adoptPtrWillBeNoop(new IntersectionObse
rvation::HashSet()); |
| 123 return *m_intersectionObservations.get(); |
| 124 } |
| 125 |
| 126 WeakPtr<Element> createWeakPtr(Element* element) |
| 127 { |
| 128 if (!m_weakPointerFactory) |
| 129 m_weakPointerFactory = adoptPtrWillBeNoop(new WeakPtrFactory<Element
>(element)); |
| 130 return m_weakPointerFactory->createWeakPtr(); |
| 131 } |
| 132 |
110 bool hasPseudoElements() const; | 133 bool hasPseudoElements() const; |
111 void clearPseudoElements(); | 134 void clearPseudoElements(); |
112 | 135 |
113 uint32_t incrementProxyCount() { return ++m_proxyCount; } | 136 uint32_t incrementProxyCount() { return ++m_proxyCount; } |
114 uint32_t decrementProxyCount() | 137 uint32_t decrementProxyCount() |
115 { | 138 { |
116 ASSERT(m_proxyCount); | 139 ASSERT(m_proxyCount); |
117 return --m_proxyCount; | 140 return --m_proxyCount; |
118 } | 141 } |
119 uint32_t proxyCount() const { return m_proxyCount; } | 142 uint32_t proxyCount() const { return m_proxyCount; } |
(...skipping 17 matching lines...) Expand all Loading... |
137 IntSize m_savedLayerScrollOffset; | 160 IntSize m_savedLayerScrollOffset; |
138 | 161 |
139 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset; | 162 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset; |
140 OwnPtrWillBeMember<ClassList> m_classList; | 163 OwnPtrWillBeMember<ClassList> m_classList; |
141 OwnPtrWillBeMember<ElementShadow> m_shadow; | 164 OwnPtrWillBeMember<ElementShadow> m_shadow; |
142 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; | 165 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; |
143 OwnPtrWillBeMember<AttrNodeList> m_attrNodeList; | 166 OwnPtrWillBeMember<AttrNodeList> m_attrNodeList; |
144 PersistentWillBeMember<ElementAnimations> m_elementAnimations; | 167 PersistentWillBeMember<ElementAnimations> m_elementAnimations; |
145 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; | 168 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; |
146 | 169 |
| 170 // Note that m_intersectionObservers will contain both observers for which t
his element is target, |
| 171 // and observers for which this element is root. To tell them apart, check
(observer->root() == element). |
| 172 OwnPtrWillBeMember<IntersectionObservation::HashSet> m_intersectionObservati
ons; |
| 173 OwnPtrWillBeMember<WeakPtrFactory<Element>> m_weakPointerFactory; |
| 174 |
147 RefPtr<ComputedStyle> m_computedStyle; | 175 RefPtr<ComputedStyle> m_computedStyle; |
148 RefPtrWillBeMember<CustomElementDefinition> m_customElementDefinition; | 176 RefPtrWillBeMember<CustomElementDefinition> m_customElementDefinition; |
149 | 177 |
150 RefPtrWillBeMember<PseudoElement> m_generatedBefore; | 178 RefPtrWillBeMember<PseudoElement> m_generatedBefore; |
151 RefPtrWillBeMember<PseudoElement> m_generatedAfter; | 179 RefPtrWillBeMember<PseudoElement> m_generatedAfter; |
152 RefPtrWillBeMember<PseudoElement> m_generatedFirstLetter; | 180 RefPtrWillBeMember<PseudoElement> m_generatedFirstLetter; |
153 RefPtrWillBeMember<PseudoElement> m_backdrop; | 181 RefPtrWillBeMember<PseudoElement> m_backdrop; |
154 | 182 |
155 explicit ElementRareData(LayoutObject*); | 183 explicit ElementRareData(LayoutObject*); |
156 }; | 184 }; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 case FIRST_LETTER: | 263 case FIRST_LETTER: |
236 return m_generatedFirstLetter.get(); | 264 return m_generatedFirstLetter.get(); |
237 default: | 265 default: |
238 return 0; | 266 return 0; |
239 } | 267 } |
240 } | 268 } |
241 | 269 |
242 } // namespace | 270 } // namespace |
243 | 271 |
244 #endif // ElementRareData_h | 272 #endif // ElementRareData_h |
OLD | NEW |