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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutMedia.cpp

Issue 1370723002: Include viewport visibility checks for autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 5 years, 1 month 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/layout/LayoutMedia.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp
index 9b9bcb107b065061864afb13fd570054efa5b178..63a4546df7f308b379a7511e6039103438bce4ba 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp
@@ -119,4 +119,36 @@ void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) const
{
}
+void LayoutMedia::willBeDestroyed()
+{
+ if (view())
+ view()->unregisterMediaForPositionChangeNotification(*this);
+ LayoutImage::willBeDestroyed();
+}
+
+void LayoutMedia::insertedIntoTree()
+{
+ LayoutImage::insertedIntoTree();
+
+ // Note that if we don't want them and aren't registered, then this
+ // will do nothing.
+ if (HTMLMediaElement* element = mediaElement())
+ element->updatePositionNotificationRegistration();
+}
+
+void LayoutMedia::notifyPositionMayHaveChanged(const IntRect& visibleRect)
+{
+ // Tell our element about it.
+ if (HTMLMediaElement* element = mediaElement())
+ element->notifyPositionMayHaveChanged(visibleRect);
+}
+
+void LayoutMedia::setRequestPositionUpdates(bool want)
+{
+ if (want)
+ view()->registerMediaForPositionChangeNotification(*this);
+ else
+ view()->unregisterMediaForPositionChangeNotification(*this);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMedia.h ('k') | third_party/WebKit/Source/core/layout/LayoutVideo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698