Bug 1062100 - Part 1: Remove ItemCoversScrollableArea. r=mattwoodrow, a=lmandel
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 06 Sep 2014 16:16:33 +1200
changeset 218362 422d79a278be1ae0573ebcba29f9cdcadada3b3d
parent 218361 65c0a4f2b0e97fd7b11e4adaa950825500e4f14e
child 218363 231126bd4179a1ba74084c1adf459ed4ee4fe5fc
push id7100
push userryanvm@gmail.com
push dateSat, 11 Oct 2014 22:05:28 +0000
treeherdermozilla-aurora@e96a7a4f3bbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lmandel
bugs1062100
milestone34.0a2
Bug 1062100 - Part 1: Remove ItemCoversScrollableArea. r=mattwoodrow, a=lmandel This isn't really part of this bug but it simplifies related code.
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2660,34 +2660,16 @@ IsScrollLayerItemAndOverlayScrollbarForS
           nsDisplayOwnLayer::HORIZONTAL_SCROLLBAR)) &&
         layerItem->Frame()->GetParent() == scrollItem->GetScrollFrame()) {
       return true;
     }
   }
   return false;
 }
 
-bool
-ContainerState::ItemCoversScrollableArea(nsDisplayItem* aItem, const nsRegion& aOpaque)
-{
-  nsIPresShell* presShell = aItem->Frame()->PresContext()->PresShell();
-  nsIFrame* rootFrame = presShell->GetRootFrame();
-  if (mContainerFrame != rootFrame) {
-    return false;
-  }
-  nsRect scrollableArea;
-  if (presShell->IsScrollPositionClampingScrollPortSizeSet()) {
-    scrollableArea = nsRect(nsPoint(0, 0),
-      presShell->GetScrollPositionClampingScrollPortSize());
-  } else {
-    scrollableArea = rootFrame->GetRectRelativeToSelf();
-  }
-  return aOpaque.Contains(scrollableArea);
-}
-
 nsIntRegion
 ContainerState::ComputeOpaqueRect(nsDisplayItem* aItem,
                                   const nsIFrame* aAnimatedGeometryRoot,
                                   const nsIFrame* aFixedPosFrame,
                                   const DisplayItemClip& aClip,
                                   nsDisplayList* aList,
                                   bool* aHideAllLayersBelow,
                                   bool* aOpaqueForAnimatedGeometryRootParent)
@@ -2698,31 +2680,28 @@ ContainerState::ComputeOpaqueRect(nsDisp
   if (!opaque.IsEmpty()) {
     nsRegion opaqueClipped;
     nsRegionRectIterator iter(opaque);
     for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
       opaqueClipped.Or(opaqueClipped, aClip.ApproximateIntersectInward(*r));
     }
     if (aAnimatedGeometryRoot == mContainerAnimatedGeometryRoot &&
         aFixedPosFrame == mContainerFixedPosFrame &&
-        !aList->IsOpaque() &&
         opaqueClipped.Contains(mContainerBounds)) {
+      *aHideAllLayersBelow = true;
       aList->SetIsOpaque();
     }
     // Add opaque areas to the "exclude glass" region. Only do this when our
     // container layer is going to be the rootmost layer, otherwise transforms
     // etc will mess us up (and opaque contributions from other containers are
     // not needed).
     if (!nsLayoutUtils::GetCrossDocParentFrame(mContainerFrame)) {
       mBuilder->AddWindowOpaqueRegion(opaqueClipped);
     }
     opaquePixels = ScaleRegionToInsidePixels(opaqueClipped, snapOpaque);
-    if (aFixedPosFrame && ItemCoversScrollableArea(aItem, opaque)) {
-      *aHideAllLayersBelow = true;
-    }
 
     nsIScrollableFrame* sf = nsLayoutUtils::GetScrollableFrameFor(aAnimatedGeometryRoot);
     if (sf) {
       nsRect displayport;
       bool usingDisplayport =
         nsLayoutUtils::GetDisplayPort(aAnimatedGeometryRoot->GetContent(), &displayport);
       if (!usingDisplayport) {
         // No async scrolling, so all that matters is that the layer contents
@@ -3581,17 +3560,17 @@ ContainerState::PostprocessRetainedLayer
             == mContainerAnimatedGeometryRoot) {
         animatedGeometryRootToCover = mContainerAnimatedGeometryRoot;
         data = FindOpaqueRegionEntry(opaqueRegions,
             animatedGeometryRootToCover, e->mFixedPosFrameForLayerData);
       }
 
       if (!data) {
         if (animatedGeometryRootToCover == mContainerAnimatedGeometryRoot &&
-            !e->mFixedPosFrameForLayerData) {
+            e->mFixedPosFrameForLayerData == mContainerFixedPosFrame) {
           NS_ASSERTION(opaqueRegionForContainer == -1, "Already found it?");
           opaqueRegionForContainer = opaqueRegions.Length();
         }
         data = opaqueRegions.AppendElement();
         data->mAnimatedGeometryRoot = animatedGeometryRootToCover;
         data->mFixedPosFrameForLayerData = e->mFixedPosFrameForLayerData;
       }
       data->mOpaqueRegion.Or(data->mOpaqueRegion, e->mOpaqueRegion);