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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add RuntimeEnabled flags to all idl's, fix test expectations. Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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)
{

Powered by Google App Engine
This is Rietveld 408576698