Bug 786672 - Use the scrolled frame for nsDisplayScrollLayer when finding the active scrolled root. r=roc a=lsblakk
authorChris Lord <chrislord.net@gmail.com>
Wed, 12 Sep 2012 18:33:34 +0100
changeset 106836 b97cf7f8f87d1aa23a8ab90cffc4ecc1717f0101
parent 106835 2753c3553b4aa704cb5bc79b4e1001d9ff4e476b
child 106837 0e519ec1916fad9b12f8a1556893791c8e0c0b1d
push id2078
push userchrislord.net@gmail.com
push dateWed, 12 Sep 2012 17:33:56 +0000
treeherdermozilla-aurora@b97cf7f8f87d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs786672
milestone17.0a2
Bug 786672 - Use the scrolled frame for nsDisplayScrollLayer when finding the active scrolled root. r=roc a=lsblakk 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