Bug 1284350. Backed out changeset e9df21facccf (Bug 1269931 - Send visible region updates for pres shells associated with nested views. r=botond)
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 12 Sep 2016 00:19:07 -0500
changeset 354774 8864fa8e88fcdced9555052d0751ddf91aa4047e
parent 354773 efc8b6da54df0df6aa02bb120920de1359c6188e
child 354775 90ef23c8f05728ce678788db0b1cbf4591443097
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1284350, 1269931
milestone51.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 1284350. Backed out changeset e9df21facccf (Bug 1269931 - Send visible region updates for pres shells associated with nested views. r=botond)
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4605,34 +4605,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;
   }
@@ -4641,46 +4623,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);
@@ -5420,38 +5417,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
@@ -589,19 +589,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();