Bug 941050 - Don't assume fixed position layers are only created for ContainerLayers owned by the ViewportFrame. r=tn
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 29 Nov 2013 18:17:53 +1300
changeset 172776 040f7055cab9725de80ce19de6fd9edee0e14a9f
parent 172678 c84597fb24e0c690da82e303444da6b5ae1ec6bc
child 172777 7e7ba237d059a8d531dc71b824471992a549fad0
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs941050
milestone28.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 941050 - Don't assume fixed position layers are only created for ContainerLayers owned by the ViewportFrame. r=tn
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1612,32 +1612,28 @@ ContainerState::ThebesLayerData::CanOpti
 }
 
 const nsIFrame*
 ContainerState::FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryRoot,
                                               const nsIntRegion& aDrawRegion,
                                               nsIntRegion* aVisibleRegion,
                                               bool* aIsSolidColorInVisibleRegion)
 {
-  if (mContainerFrame->GetParent()) {
-    // Viewports with displayports always get a layer created for the viewport
-    // frame. (See nsSubdocumentFrame::BuildDisplayList's calculation of
-    // needsOwnLayer.) The children of that layer are the ones that might
-    // have fixed-pos frame data. So if we're creating layers for children
-    // of a frame other than a viewport, there's nothing to do here.
-    return nullptr;
-  }
+  nsIFrame *viewport = mContainerFrame->PresContext()->PresShell()->GetRootFrame();
+
   // Viewports with no fixed-pos frames are not relevant.
-  if (!mContainerFrame->GetFirstChild(nsIFrame::kFixedList)) {
+  if (!viewport->GetFirstChild(nsIFrame::kFixedList)) {
     return nullptr;
   }
   nsRect displayPort;
   for (const nsIFrame* f = aAnimatedGeometryRoot; f; f = f->GetParent()) {
     if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(f, &displayPort)) {
-      displayPort += mContainerFrame->GetOffsetToCrossDoc(mContainerReferenceFrame);
+      // Display ports are relative to the viewport, convert it to be relative
+      // to our reference frame.
+      displayPort += viewport->GetOffsetToCrossDoc(mContainerReferenceFrame);
       nsIntRegion newVisibleRegion;
       newVisibleRegion.And(ScaleToOutsidePixels(displayPort, false),
                            aDrawRegion);
       if (!aVisibleRegion->Contains(newVisibleRegion)) {
         if (aIsSolidColorInVisibleRegion) {
           *aIsSolidColorInVisibleRegion = false;
         }
         *aVisibleRegion = newVisibleRegion;