Bug 786672 - Use the scrolled frame for nsDisplayScrollLayer when finding the active scrolled root. r=roc
authorChris Lord <chrislord.net@gmail.com>
Thu, 30 Aug 2012 08:31:16 +0100
changeset 103877 6a95de502ec1aa20153b45e2c40e089ba16e8b8a
parent 103876 6442238886ea95d2818e518c89e2de59cb4f861b
child 103878 6a38804470790144619f8d17f120c2436e7cccb6
push id14213
push userchrislord.net@gmail.com
push dateThu, 30 Aug 2012 07:31:29 +0000
treeherdermozilla-inbound@6a95de502ec1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs786672
milestone18.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 786672 - Use the scrolled frame for nsDisplayScrollLayer when finding the active scrolled root. r=roc The underlying frame of an nsDisplayScrollLayer can change and end up returning different values when finding the active scrolled root. Instead of relying on display-item ordering/merging, get the scrolled frame from the item (which was already storing it).
layout/base/FrameLayerBuilder.cpp
layout/base/nsDisplayList.h
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1802,16 +1802,22 @@ ContainerState::ProcessDisplayItems(cons
 
     nsIFrame* activeScrolledRoot;
     bool forceInactive = false;
     if (aFlags & NO_COMPONENT_ALPHA) {
       activeScrolledRoot =
         nsLayoutUtils::GetActiveScrolledRootFor(mContainerFrame,
                                                 mBuilder->ReferenceFrame());
       forceInactive = true;
+    } else if (item->GetType() == nsDisplayItem::TYPE_SCROLL_LAYER) {
+      nsDisplayScrollLayer* scrollLayerItem =
+        static_cast<nsDisplayScrollLayer*>(item);
+      activeScrolledRoot =
+        nsLayoutUtils::GetActiveScrolledRootFor(scrollLayerItem->GetScrolledFrame(),
+                                                mBuilder->ReferenceFrame());
     } else {
       activeScrolledRoot = nsLayoutUtils::GetActiveScrolledRootFor(item, mBuilder);
     }
 
     // Assign the item to a layer
     if (layerState == LAYER_ACTIVE_FORCE ||
         (!forceInactive &&
          (layerState == LAYER_ACTIVE_EMPTY ||
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2033,16 +2033,18 @@ public:
   virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder);
 
   // Get the number of nsDisplayScrollLayers for a scroll frame. Note that this
   // number does not include nsDisplayScrollInfoLayers. If this number is not 1
   // after merging, all the nsDisplayScrollLayers should flatten away.
   intptr_t GetScrollLayerCount();
   intptr_t RemoveScrollLayerCount();
 
+  virtual nsIFrame* GetScrolledFrame() { return mScrolledFrame; }
+
 private:
   nsIFrame* mScrollFrame;
   nsIFrame* mScrolledFrame;
 };
 
 /**
  * Like nsDisplayScrollLayer, but only has metadata on the scroll frame. This
  * creates a layer that has no Thebes child layer, but still allows the