Bug 1284350. Reland on top of backouts "Bug 1282710 - part 2 - Plumb the visibility event from nsIFrame to nsIDOMMediaElemnt; r=seth" r=kaku
authorKaku Kuo <tkuo@mozilla.com>
Wed, 29 Jun 2016 17:36:24 +0800
changeset 357000 8de973bd95adf8b7106bb196343ebb7bf420aba8
parent 356999 5187bdfbe760cf52f0fb7a7e5cea4d88026d9478
child 357001 f56deec592bd3cff3e7f9eacb4786a3e50626fca
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, kaku
bugs1284350, 1282710
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1284350. Reland on top of backouts "Bug 1282710 - part 2 - Plumb the visibility event from nsIFrame to nsIDOMMediaElemnt; r=seth" r=kaku
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -665,23 +665,26 @@ nsVideoFrame::AttributeChanged(int32_t a
                                             aAttribute,
                                             aModType);
 }
 
 void
 nsVideoFrame::OnVisibilityChange(Visibility aNewVisibility,
                                  Maybe<OnNonvisible> aNonvisibleAction)
 {
-  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mPosterImage);
-  if (!imageLoader) {
-    nsContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
-    return;
+  if (HasVideoElement()) {
+    nsCOMPtr<nsIDOMHTMLMediaElement> mediaDomElement = do_QueryInterface(mContent);
+    mediaDomElement->OnVisibilityChange(aNewVisibility);
   }
 
-  imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction);
+  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mPosterImage);
+  if (imageLoader) {
+    imageLoader->OnVisibilityChange(aNewVisibility,
+                                    aNonvisibleAction);
+  }
 
   nsContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
 }
 
 bool nsVideoFrame::HasVideoElement() {
   nsCOMPtr<nsIDOMHTMLMediaElement> mediaDomElement = do_QueryInterface(mContent);
   return mediaDomElement->IsVideo();
 }