Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index 69043a7e4e08076652fe8f9f9622810e624c72c9..fe8604310d47a71169437b7a869c090019b0282b 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -54,6 +54,7 @@ |
#include "core/dom/ClientRectList.h" |
#include "core/dom/DatasetDOMStringMap.h" |
#include "core/dom/ElementDataCache.h" |
+#include "core/dom/ElementIntersectionObserverData.h" |
#include "core/dom/ElementRareData.h" |
#include "core/dom/ElementTraversal.h" |
#include "core/dom/ExceptionCode.h" |
@@ -1457,8 +1458,12 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio |
if (!insertionPoint->isInTreeScope()) |
return InsertionDone; |
- if (hasRareData()) |
- elementRareData()->clearClassListValueForQuirksMode(); |
+ if (hasRareData()) { |
+ ElementRareData* rareData = elementRareData(); |
+ rareData->clearClassListValueForQuirksMode(); |
+ if (rareData->intersectionObserverData()) |
+ rareData->intersectionObserverData()->activateValidIntersectionObservers(*this); |
+ } |
if (isUpgradedCustomElement() && inDocument()) |
CustomElement::didAttach(this, document()); |
@@ -1536,6 +1541,9 @@ void Element::removedFrom(ContainerNode* insertionPoint) |
if (ElementAnimations* elementAnimations = data->elementAnimations()) |
elementAnimations->cssAnimations().cancel(); |
+ |
+ if (data->intersectionObserverData()) |
+ data->intersectionObserverData()->deactivateAllIntersectionObservers(*this); |
} |
} |
@@ -2586,6 +2594,18 @@ Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat |
return nullptr; |
} |
+ElementIntersectionObserverData* Element::intersectionObserverData() const |
+{ |
+ if (elementRareData()) |
+ return elementRareData()->intersectionObserverData(); |
+ return nullptr; |
+} |
+ |
+ElementIntersectionObserverData& Element::ensureIntersectionObserverData() |
+{ |
+ return ensureElementRareData().ensureIntersectionObserverData(); |
+} |
+ |
// Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() |
static Element* contextElementForInsertion(const String& where, Element* element, ExceptionState& exceptionState) |
{ |