Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ElementRareData.h |
| diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h |
| index 75b0375475067491e23ea50e03a7e00a76fc5210..3cfbfc761dc66bda8ddb154768824c4fd8168342 100644 |
| --- a/third_party/WebKit/Source/core/dom/ElementRareData.h |
| +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h |
| @@ -26,6 +26,8 @@ |
| #include "core/dom/Attr.h" |
| #include "core/dom/CompositorProxiedPropertySet.h" |
| #include "core/dom/DatasetDOMStringMap.h" |
| +#include "core/dom/IntersectionObservation.h" |
| +#include "core/dom/IntersectionObserver.h" |
| #include "core/dom/NamedNodeMap.h" |
| #include "core/dom/NodeRareData.h" |
| #include "core/dom/PseudoElement.h" |
| @@ -34,7 +36,9 @@ |
| #include "core/html/ClassList.h" |
| #include "core/style/StyleInheritedData.h" |
| #include "platform/heap/Handle.h" |
| +#include "wtf/HashSet.h" |
| #include "wtf/OwnPtr.h" |
| +#include "wtf/WeakPtr.h" |
| namespace blink { |
| @@ -109,6 +113,55 @@ public: |
| m_elementAnimations = elementAnimations; |
| } |
| + bool hasIntersectionObserver() const |
| + { |
|
esprehn
2015/12/12 00:14:13
move all of this code to your separate object, put
szager1
2015/12/16 19:15:34
Done.
|
| + return m_intersectionObservers && m_intersectionObservers->size(); |
| + } |
| + |
| + IntersectionObserver::WeakHashSet& intersectionObservers() |
| + { |
| + if (!m_intersectionObservers) |
| + m_intersectionObservers = new IntersectionObserver::WeakHashSet(); |
| + return *m_intersectionObservers; |
| + } |
| + |
| + bool hasIntersectionObservation() const |
| + { |
| + return m_intersectionObservations && m_intersectionObservations->size(); |
| + } |
| + |
| + IntersectionObservation::HashSet& intersectionObservations() |
| + { |
| + if (!m_intersectionObservations) |
| + m_intersectionObservations = new IntersectionObservation::HashSet(); |
| + return *m_intersectionObservations; |
| + } |
| + |
| + void deactivateAllIntersectionObservers() |
| + { |
| + if (!m_intersectionObservers) |
| + return; |
| + for (auto& observer: *m_intersectionObservers) |
| + observer->setActive(false); |
| + } |
| + |
| + void deactivateAllIntersectionObservations() |
| + { |
| + if (!m_intersectionObservations) |
| + return; |
| + for (auto& observation: *m_intersectionObservations) |
| + observation->setActive(false); |
| + } |
| + |
| +#if !ENABLE(OILPAN) |
| + WeakPtr<Element> createWeakPtr(Element* element) |
| + { |
| + if (!m_weakPointerFactory) |
| + m_weakPointerFactory = adoptPtrWillBeNoop(new WeakPtrFactory<Element>(element)); |
| + return m_weakPointerFactory->createWeakPtr(); |
| + } |
| +#endif |
| + |
| bool hasPseudoElements() const; |
| void clearPseudoElements(); |
| @@ -139,10 +192,17 @@ private: |
| OwnPtrWillBeMember<ElementShadow> m_shadow; |
| OwnPtrWillBeMember<NamedNodeMap> m_attributeMap; |
| OwnPtrWillBeMember<AttrNodeList> m_attrNodeList; |
| - PersistentWillBeMember<ElementAnimations> m_elementAnimations; |
| OwnPtrWillBeMember<InlineCSSStyleDeclaration> m_cssomWrapper; |
| OwnPtr<CompositorProxiedPropertySet> m_proxiedProperties; |
| +#if !ENABLE(OILPAN) |
| + OwnPtrWillBeMember<WeakPtrFactory<Element>> m_weakPointerFactory; |
|
esprehn
2015/12/12 00:14:13
move to controller
szager1
2015/12/16 19:15:34
Done.
|
| +#endif |
| + |
| + PersistentWillBeMember<ElementAnimations> m_elementAnimations; |
| + // Note that m_intersectionObservers will contain both observers for which this element is target, |
|
ojan
2015/12/12 01:06:28
This comment is in the wrong place?
szager1
2015/12/16 19:15:34
That's an obsolete comment, I removed it.
|
| + // and observers for which this element is root. To tell them apart, check (observer->root() == element). |
|
esprehn
2015/12/12 00:14:13
keep two sets instead? This doesn't seem right
szager1
2015/12/16 19:15:34
same comment
|
| + |
| RefPtr<ComputedStyle> m_computedStyle; |
| RefPtrWillBeMember<CustomElementDefinition> m_customElementDefinition; |
| @@ -151,6 +211,11 @@ private: |
| RefPtrWillBeMember<PseudoElement> m_generatedFirstLetter; |
| RefPtrWillBeMember<PseudoElement> m_backdrop; |
| + // IntersectionObservers for which this element is root. |
| + PersistentWillBeMember<IntersectionObserver::WeakHashSet> m_intersectionObservers; |
| + // IntersectionObservations for which this element is target. |
| + PersistentWillBeMember<IntersectionObservation::HashSet> m_intersectionObservations; |
|
esprehn
2015/12/12 00:14:13
PersistentWillBeMember<IntersectionObserverControl
szager1
2015/12/16 19:15:34
Done.
|
| + |
| explicit ElementRareData(LayoutObject*); |
| }; |