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

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: 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..f6e9e524690b758eeca4f983302ccb14e85e6fa3 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
@@ -179,12 +179,19 @@ void IntersectionObserver::observe(Element* target, ExceptionState& exceptionSta
return;
}
+ observe(target);
+}
+
+void IntersectionObserver::observe(Element* target)
+{
+ if (!m_root)
+ return;
+
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 +229,14 @@ void IntersectionObserver::unobserve(Element* target, ExceptionState& exceptionS
return;
}
+ unobserve(target);
+}
+
+void IntersectionObserver::unobserve(Element* target)
+{
+ if (!m_root)
+ return;
+
if (!target || !target->intersectionObserverData())
return;
// TODO(szager): unobserve callback
@@ -340,7 +355,6 @@ unsigned IntersectionObserver::firstThresholdGreaterThan(float ratio) const
void IntersectionObserver::deliver()
{
-
if (m_entries.isEmpty())
return;

Powered by Google App Engine
This is Rietveld 408576698