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

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

Issue 2051253002: Start autoplay muted videos with autoplay attribute when they are visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup and tests Created 4 years, 6 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/IntersectionObserver.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
index 26fe2ecfdbbe9437d9efcd4d505b9d13e67f5e28..8c531ddca8329a0e2141f4239e9adc5d8eea95d8 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
@@ -179,12 +179,18 @@ void IntersectionObserver::observe(Element* target, ExceptionState& exceptionSta
return;
}
+ observe(target);
szager1 2016/06/10 21:07:17 Infinite recursion.
szager1 2016/06/10 21:09:23 Oh never mind, I see what you did here. I would p
+}
+
+void IntersectionObserver::observe(Element* target)
+{
+ DCHECK(m_root);
+
if (!target || m_root.get() == target)
return;
if (target->ensureIntersectionObserverData().getObservationFor(*this))
return;
-
bool shouldReportRootBounds = false;
bool isDOMDescendant = false;
LocalFrame* targetFrame = target->document().frame();
@@ -222,6 +228,13 @@ void IntersectionObserver::unobserve(Element* target, ExceptionState& exceptionS
return;
}
+ unobserve(target);
szager1 2016/06/10 21:07:49 Infinite recursion.
szager1 2016/06/10 21:09:23 Same comment.
+}
+
+void IntersectionObserver::unobserve(Element* target)
+{
+ DCHECK(m_root);
+
if (!target || !target->intersectionObserverData())
return;
// TODO(szager): unobserve callback
@@ -340,7 +353,6 @@ unsigned IntersectionObserver::firstThresholdGreaterThan(float ratio) const
void IntersectionObserver::deliver()
{
-
if (m_entries.isEmpty())
return;

Powered by Google App Engine
This is Rietveld 408576698