Bug 1284350. Ensure that if a frame is painted it is added to the approximately visible list. r=mstange
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 12 Sep 2016 00:19:08 -0500
changeset 356998 a3bbde2006a03bf498a7fc478359d03af2a45b70
parent 356997 22b0444e1e3a2ab3be2f11822a75cc37c59d4e24
child 356999 5187bdfbe760cf52f0fb7a7e5cea4d88026d9478
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)
reviewersmstange
bugs1284350, 1282710, 1299065
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. Ensure that if a frame is painted it is added to the approximately visible list. r=mstange This takes the second hunk of https://hg.mozilla.org/mozilla-central/rev/82c3b4b81d82 only, but instead of the "in displayport" list we are adding to the "approximately visible" list. The "in displayport" list doesn't exist after the backouts that need to be done. This ensures that all visible frames are in the approximately visible list. By not taking the first chunk of the aforementioned changeset we don't remove frames that aren't painted from the approximately visible list. So the list only grows during a paint. But the next time the we do a full update of approximately visible images it can shrink. We need this because the video element uses visibility to start/stop decoding (bug 1282710, bug 1299065) and we want frames that are painted to for sure be marked as visible.
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2735,16 +2735,23 @@ nsIFrame::BuildDisplayListForChild(nsDis
   
   const nsStyleDisplay* ourDisp = StyleDisplay();
   // REVIEW: Taken from nsBoxFrame::Paint
   // Don't paint our children if the theme object is a leaf.
   if (IsThemed(ourDisp) &&
       !PresContext()->GetTheme()->WidgetIsContainer(ourDisp->mAppearance))
     return;
 
+  // Since we're now sure that we're adding this frame to the display list
+  // (which means we're painting it, modulo occlusion), mark it as visible
+  // within the displayport.
+  if (aBuilder->IsPaintingToWindow() && child->TrackingVisibility()) {
+    child->PresContext()->PresShell()->EnsureFrameInApproximatelyVisibleList(child);
+  }
+
   // Child is composited if it's transformed, partially transparent, or has
   // SVG effects or a blend mode..
   const nsStyleDisplay* disp = child->StyleDisplay();
   const nsStyleEffects* effects = child->StyleEffects();
   const nsStylePosition* pos = child->StylePosition();
   bool isVisuallyAtomic = child->HasOpacity()
     || child->IsTransformed()
     // strictly speaking, 'perspective' doesn't require visual atomicity,