Bug 1284350 - Revert "Bug 1269931 - Send visible region updates for pres shells associated with nested views. r=botond". a=lizzard
authorSeth Fowler <mark.seth.fowler@gmail.com>
Fri, 08 Jul 2016 17:55:08 -0700
changeset 339894 1174153847d4e8a0587532673ca49e4d17ae96b5
parent 339893 49c3a77eb1af251796251c85c00a0a9d3a2202f1
child 339895 1bb133ce73f9bfbfc5f8ae0247ccfc24f40b3f27
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, lizzard
bugs1284350, 1269931
milestone49.0a2
Bug 1284350 - Revert "Bug 1269931 - Send visible region updates for pres shells associated with nested views. r=botond". a=lizzard This reverts commit 3fefb3b9cfb902a63c9e6cabc42b1c43d73ddf34.
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4580,34 +4580,16 @@ PresShell::StyleRuleRemoved(StyleSheetHa
 }
 
 nsIFrame*
 PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame) const
 {
   return mFrameConstructor->GetPlaceholderFrameFor(aFrame);
 }
 
-static void
-SendUpdateVisibleRegion(CompositorBridgeChild* aCompositorChild,
-                        const VisibleRegions& aRegions,
-                        VisibilityCounter aCounter,
-                        uint64_t aLayersId,
-                        uint32_t aPresShellId)
-{
-  for (auto iter = aRegions.ConstIter(); !iter.Done(); iter.Next()) {
-    const ViewID viewId = iter.Key();
-    const CSSIntRegion* region = iter.UserData();
-    MOZ_ASSERT(region);
-
-    const ScrollableLayerGuid guid(aLayersId, aPresShellId, viewId);
-
-    aCompositorChild->SendUpdateVisibleRegion(aCounter, guid, *region);
-  }
-}
-
 void
 PresShell::NotifyCompositorOfVisibleRegionsChange()
 {
   mNotifyCompositorOfVisibleRegionsChangeEvent.Revoke();
 
   if (!mVisibleRegions) {
     return;
   }
@@ -4616,46 +4598,61 @@ PresShell::NotifyCompositorOfVisibleRegi
   TabChild* tabChild = TabChild::GetFrom(this);
   if (!tabChild) {
     return;
   }
 
   const uint64_t layersId = tabChild->LayersId();
   const uint32_t presShellId = GetPresShellId();
 
-  // Retrieve the CompositorBridgeChild, which we'll use to communicate with
-  // the compositor.
-  LayerManager* layerManager = GetRootLayerManager();
+  // Retrieve the CompositorBridgeChild.
+  LayerManager* layerManager = GetLayerManager();
   if (!layerManager) {
     return;
   }
 
   ClientLayerManager* clientLayerManager = layerManager->AsClientLayerManager();
   if (!clientLayerManager) {
     return;
   }
 
   CompositorBridgeChild* compositorChild = clientLayerManager->GetCompositorBridgeChild();
   if (!compositorChild) {
     return;
   }
 
-  // Clear the old visible regions associated with this pres shell.
+  // Clear the old visible regions associated with this document.
   compositorChild->SendClearVisibleRegions(layersId, presShellId);
 
   // Send the new visible regions to the compositor.
-  SendUpdateVisibleRegion(compositorChild,
-                          mVisibleRegions->mApproximate,
-                          VisibilityCounter::MAY_BECOME_VISIBLE,
-                          layersId, presShellId);
-
-  SendUpdateVisibleRegion(compositorChild,
-                          mVisibleRegions->mInDisplayPort,
-                          VisibilityCounter::IN_DISPLAYPORT,
-                          layersId, presShellId);
+  for (auto iter = mVisibleRegions->mApproximate.ConstIter();
+      !iter.Done();
+      iter.Next()) {
+    const ViewID viewId = iter.Key();
+    const CSSIntRegion* region = iter.UserData();
+    MOZ_ASSERT(region);
+
+    const ScrollableLayerGuid guid(layersId, presShellId, viewId);
+
+    compositorChild->SendUpdateVisibleRegion(VisibilityCounter::MAY_BECOME_VISIBLE,
+                                             guid, *region);
+  }
+
+  for (auto iter = mVisibleRegions->mInDisplayPort.ConstIter();
+      !iter.Done();
+      iter.Next()) {
+    const ViewID viewId = iter.Key();
+    const CSSIntRegion* region = iter.UserData();
+    MOZ_ASSERT(region);
+
+    const ScrollableLayerGuid guid(layersId, presShellId, viewId);
+
+    compositorChild->SendUpdateVisibleRegion(VisibilityCounter::IN_DISPLAYPORT,
+                                             guid, *region);
+  }
 }
 
 nsresult
 PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
                           nscolor aBackgroundColor,
                           gfxContext* aThebesContext)
 {
   NS_ENSURE_TRUE(!(aFlags & RENDER_IS_UNTRUSTED), NS_ERROR_NOT_IMPLEMENTED);
@@ -5395,38 +5392,16 @@ LayerManager* PresShell::GetLayerManager
   if (rootView) {
     if (nsIWidget* widget = rootView->GetWidget()) {
       return widget->GetLayerManager();
     }
   }
   return nullptr;
 }
 
-LayerManager*
-PresShell::GetRootLayerManager()
-{
-  MOZ_ASSERT(mViewManager);
-  nsViewManager* viewManager = mViewManager;
-
-  while (nsView* view = viewManager->GetRootView()) {
-    if (nsIWidget* widget = view->GetWidget()) {
-      return widget->GetLayerManager();
-    }
-
-    nsView* parentView = view->GetParent();
-    if (!parentView) {
-      return nullptr;
-    }
-
-    viewManager = parentView->GetViewManager();
-  }
-
-  return nullptr;
-}
-
 bool PresShell::AsyncPanZoomEnabled()
 {
   NS_ASSERTION(mViewManager, "Should have view manager");
   nsView* rootView = mViewManager->GetRootView();
   if (rootView) {
     if (nsIWidget* widget = rootView->GetWidget()) {
       return widget->AsyncPanZoomEnabled();
     }
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -579,19 +579,16 @@ protected:
    * Methods to handle changes to user and UA sheet lists that we get
    * notified about.
    */
   void AddUserSheet(nsISupports* aSheet);
   void AddAgentSheet(nsISupports* aSheet);
   void AddAuthorSheet(nsISupports* aSheet);
   void RemoveSheet(mozilla::SheetType aType, nsISupports* aSheet);
 
-  /// @return the LayerManager at the root of the view tree.
-  LayerManager* GetRootLayerManager();
-
   // Hide a view if it is a popup
   void HideViewIfPopup(nsView* aView);
 
   // Utility method to restore the root scrollframe state
   void RestoreRootScrollPosition();
 
   void MaybeReleaseCapturingContent();