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

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

Issue 1330633003: Intersection Observer first draft Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix segfault on null input. Created 5 years, 3 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: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index ba5c7821706e1435499ee6ffa341c677a4bd57d5..21613093d8be0f93133441cf6e680f631b111d2f 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -3493,6 +3493,28 @@ bool Element::supportsStyleSharing() const
return true;
}
+void Element::registerIntersectionObserver(IntersectionObserver* observer)
+{
+ size_t index = m_intersectionObservers.find(observer);
+ if (index != WTF::kNotFound)
+ return;
+
+ m_intersectionObservers.append(observer);
+ if (document().layoutView() && layoutObject())
+ document().layoutView()->addIntersectionObserverTarget(layoutObject());
+}
+
+void Element::unregisterIntersectionObserver(IntersectionObserver* observer)
+{
+ size_t index = m_intersectionObservers.find(observer);
+ if (index == WTF::kNotFound)
+ return;
+
+ m_intersectionObservers.remove(index);
+ if (document().layoutView() && layoutObject())
+ document().layoutView()->removeIntersectionObserverTarget(layoutObject());
+}
+
DEFINE_TRACE(Element)
{
#if ENABLE(OILPAN)

Powered by Google App Engine
This is Rietveld 408576698