Bug 1284350. Reland on top of backouts "Bug 1282710 - part 2 - Plumb the visibility event from nsIFrame to nsIDOMMediaElemnt; r=seth" a=ritu
authorKaku Kuo <tkuo@mozilla.com>
Wed, 29 Jun 2016 17:36:24 +0800
changeset 350246 e87992c4904ff879f2b7b25175403c7977a9fe82
parent 350245 3c848ba35ea14398819da950784ed23e53589b8b
child 350247 8342c2d542023375b906f1ca123449a7ba12b303
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, ritu
bugs1284350, 1282710
milestone50.0a2
Bug 1284350. Reland on top of backouts "Bug 1282710 - part 2 - Plumb the visibility event from nsIFrame to nsIDOMMediaElemnt; r=seth" a=ritu
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -663,23 +663,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();
 }