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

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementRareData.h

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: oilpan-ify Created 5 years, 1 month 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 /* 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
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 = new IntersectionObservation::HashSet();
123 return *m_intersectionObservations;
124 }
125
126 void deactivateAllIntersectionObservations()
127 {
128 if (!m_intersectionObservations)
129 return;
130 for (auto& observation: *m_intersectionObservations)
131 observation->setActive(false);
132 }
133
134 WeakPtr<Element> createWeakPtr(Element* element)
135 {
136 if (!m_weakPointerFactory)
137 m_weakPointerFactory = adoptPtrWillBeNoop(new WeakPtrFactory<Element >(element));
138 return m_weakPointerFactory->createWeakPtr();
139 }
140
110 bool hasPseudoElements() const; 141 bool hasPseudoElements() const;
111 void clearPseudoElements(); 142 void clearPseudoElements();
112 143
113 uint32_t incrementProxyCount() { return ++m_proxyCount; } 144 uint32_t incrementProxyCount() { return ++m_proxyCount; }
114 uint32_t decrementProxyCount() 145 uint32_t decrementProxyCount()
115 { 146 {
116 ASSERT(m_proxyCount); 147 ASSERT(m_proxyCount);
117 return --m_proxyCount; 148 return --m_proxyCount;
118 } 149 }
119 uint32_t proxyCount() const { return m_proxyCount; } 150 uint32_t proxyCount() const { return m_proxyCount; }
(...skipping 14 matching lines...) Expand all
134 unsigned short m_proxyCount; 165 unsigned short m_proxyCount;
135 166
136 LayoutSize m_minimumSizeForResizing; 167 LayoutSize m_minimumSizeForResizing;
137 IntSize m_savedLayerScrollOffset; 168 IntSize m_savedLayerScrollOffset;
138 169
139 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset; 170 OwnPtrWillBeMember<DatasetDOMStringMap> m_dataset;
140 OwnPtrWillBeMember<ClassList> m_classList; 171 OwnPtrWillBeMember<ClassList> m_classList;
141 OwnPtrWillBeMember<ElementShadow> m_shadow; 172 OwnPtrWillBeMember<ElementShadow> m_shadow;
142 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; 173 OwnPtrWillBeMember<NamedNodeMap> m_attributeMap;
143 OwnPtrWillBeMember<AttrNodeList> m_attrNodeList; 174 OwnPtrWillBeMember<AttrNodeList> m_attrNodeList;
175 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper;
176 OwnPtrWillBeMember<WeakPtrFactory<Element>> m_weakPointerFactory;
177
144 PersistentWillBeMember<ElementAnimations> m_elementAnimations; 178 PersistentWillBeMember<ElementAnimations> m_elementAnimations;
145 OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; 179 // Note that m_intersectionObservers will contain both observers for which t his element is target,
180 // and observers for which this element is root. To tell them apart, check (observer->root() == element).
181 PersistentWillBeMember<IntersectionObservation::HashSet> m_intersectionObser vations;
146 182
147 RefPtr<ComputedStyle> m_computedStyle; 183 RefPtr<ComputedStyle> m_computedStyle;
148 RefPtrWillBeMember<CustomElementDefinition> m_customElementDefinition; 184 RefPtrWillBeMember<CustomElementDefinition> m_customElementDefinition;
149 185
150 RefPtrWillBeMember<PseudoElement> m_generatedBefore; 186 RefPtrWillBeMember<PseudoElement> m_generatedBefore;
151 RefPtrWillBeMember<PseudoElement> m_generatedAfter; 187 RefPtrWillBeMember<PseudoElement> m_generatedAfter;
152 RefPtrWillBeMember<PseudoElement> m_generatedFirstLetter; 188 RefPtrWillBeMember<PseudoElement> m_generatedFirstLetter;
153 RefPtrWillBeMember<PseudoElement> m_backdrop; 189 RefPtrWillBeMember<PseudoElement> m_backdrop;
154 190
155 explicit ElementRareData(LayoutObject*); 191 explicit ElementRareData(LayoutObject*);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 case FIRST_LETTER: 271 case FIRST_LETTER:
236 return m_generatedFirstLetter.get(); 272 return m_generatedFirstLetter.get();
237 default: 273 default:
238 return 0; 274 return 0;
239 } 275 }
240 } 276 }
241 277
242 } // namespace 278 } // namespace
243 279
244 #endif // ElementRareData_h 280 #endif // ElementRareData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698