Bug 1263349 (Part 3) - Only consider a frame IN_DISPLAYPORT if it's within the critical displayport, considering ancestors. r=botond
☠☠ backed out by aae16737c930 ☠ ☠
authorSeth Fowler <mark.seth.fowler@gmail.com>
Tue, 24 May 2016 01:12:48 -0700
changeset 337708 1ae4cfe35d7157c4c0d3bc1b39224053e5cd84ba
parent 337707 4cfdd1649464cf1b80de560ca972c8ed1633b251
child 337709 e866748db4e36ea28cddc9902f6bb3fbcb8af9ea
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1263349
milestone49.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 1263349 (Part 3) - Only consider a frame IN_DISPLAYPORT if it's within the critical displayport, considering ancestors. r=botond
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2731,21 +2731,30 @@ 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.
+  // (which means we're painting it, modulo occlusion), it may be visible.
   if (aBuilder->IsPaintingToWindow() && child->TrackingVisibility()) {
-    nsIPresShell* shell = child->PresContext()->PresShell();
-    shell->MarkFrameVisible(child, VisibilityCounter::IN_DISPLAYPORT);
+    // Check if the frame is visible in the critical displayport, taking into
+    // account the critical displayport of all ancestor scrollframes.
+    nsRect displayPortIntersection =
+      nsLayoutUtils::TransformAndIntersectRect(child,
+                                               child->GetVisualOverflowRect(),
+                                               aBuilder->GetCurrentScrollParent(),
+                                               aBuilder->GetDisplayPortConsideringAncestors());
+
+    if (!displayPortIntersection.IsEmpty()) {
+      nsIPresShell* shell = child->PresContext()->PresShell();
+      shell->MarkFrameVisible(child, VisibilityCounter::IN_DISPLAYPORT);
+    }
   }
 
   // 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()