Bug 826635. Refresh-driver painting is always enabled now, so remove the alternative code path. r=mattwoodrow
☠☠ backed out by ea909ce6007b ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 05 Jan 2013 16:14:17 +1300
changeset 126820 5e76dfb1d426caa6e5fac3ac440184598066f969
parent 126819 0df74b1a45438c1b823a6e3878e8b6fa6e180729
child 126821 06a834b786cf0b18205b0c00260df7beb01aa8e7
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs826635
milestone20.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 826635. Refresh-driver painting is always enabled now, so remove the alternative code path. r=mattwoodrow
view/public/nsViewManager.h
view/src/nsViewManager.cpp
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -41,32 +41,16 @@
    We do NOT assume anything about the relative z-ordering of sibling widgets. Even though
    we ask for a specific z-order, we don't assume that widget z-ordering actually works.
 */
 
 #define NSCOORD_NONE      INT32_MIN
 
 #undef DEBUG_MOUSE_LOCATION
 
-static bool
-IsRefreshDriverPaintingEnabled()
-{
-  static bool sRefreshDriverPaintingEnabled;
-  static bool sRefreshDriverPaintingPrefCached = false;
-
-  if (!sRefreshDriverPaintingPrefCached) {
-    sRefreshDriverPaintingPrefCached = true;
-    mozilla::Preferences::AddBoolVarCache(&sRefreshDriverPaintingEnabled,
-                                          "viewmanager.refresh-driver-painting.enabled",
-                                          true);
-  }
-
-  return sRefreshDriverPaintingEnabled;
-}
-
 int32_t nsViewManager::mVMCount = 0;
 
 // Weakly held references to all of the view managers
 nsVoidArray* nsViewManager::gViewManagers = nullptr;
 uint32_t nsViewManager::gLastUserEventTime = 0;
 
 nsViewManager::nsViewManager()
   : mDelayedResize(NSCOORD_NONE, NSCOORD_NONE)
@@ -343,17 +327,16 @@ void nsViewManager::Refresh(nsView *aVie
     NS_ASSERTION(GetDisplayRootFor(aView) == aView,
                  "Widgets that we paint must all be display roots");
 
     if (mPresShell) {
 #ifdef DEBUG_INVALIDATIONS
       printf("--COMPOSITE-- %p\n", mPresShell);
 #endif
       mPresShell->Paint(aView, damageRegion,
-                        (IsRefreshDriverPaintingEnabled() ? 0 : nsIPresShell::PAINT_LAYERS) |
                         nsIPresShell::PAINT_COMPOSITE |
                         (aWillSendDidPaint ? nsIPresShell::PAINT_WILL_SEND_DID_PAINT : 0));
 #ifdef DEBUG_INVALIDATIONS
       printf("--ENDCOMPOSITE--\n");
 #endif
       mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
     }
 
@@ -384,50 +367,48 @@ void nsViewManager::ProcessPendingUpdate
   for (nsView* childView = aView->GetFirstChild(); childView;
        childView = childView->GetNextSibling()) {
     ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
   }
 
   // Push out updates after we've processed the children; ensures that
   // damage is applied based on the final widget geometry
   if (aFlushDirtyRegion) {
-    if (IsRefreshDriverPaintingEnabled()) {
-      nsIWidget *widget = aView->GetWidget();
-      if (widget && widget->NeedsPaint()) {
-        // If an ancestor widget was hidden and then shown, we could
-        // have a delayed resize to handle.
-        for (nsViewManager *vm = this; vm;
-             vm = vm->mRootView->GetParent()
-                    ? vm->mRootView->GetParent()->GetViewManager()
-                    : nullptr) {
-          if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
-              vm->mRootView->IsEffectivelyVisible() &&
-              mPresShell && mPresShell->IsVisible()) {
-            vm->FlushDelayedResize(true);
-            vm->InvalidateView(vm->mRootView);
-          }
+    nsIWidget *widget = aView->GetWidget();
+    if (widget && widget->NeedsPaint()) {
+      // If an ancestor widget was hidden and then shown, we could
+      // have a delayed resize to handle.
+      for (nsViewManager *vm = this; vm;
+           vm = vm->mRootView->GetParent()
+                  ? vm->mRootView->GetParent()->GetViewManager()
+                  : nullptr) {
+        if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
+            vm->mRootView->IsEffectivelyVisible() &&
+            mPresShell && mPresShell->IsVisible()) {
+          vm->FlushDelayedResize(true);
+          vm->InvalidateView(vm->mRootView);
         }
+      }
 
-        NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
+      NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
 
-        SetPainting(true);
+      SetPainting(true);
 #ifdef DEBUG_INVALIDATIONS
-        printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
+      printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
 #endif
-        nsAutoScriptBlocker scriptBlocker;
-        NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
-        mPresShell->Paint(aView, nsRegion(),
-                          nsIPresShell::PAINT_LAYERS |
-                          nsIPresShell::PAINT_WILL_SEND_DID_PAINT);
+      nsAutoScriptBlocker scriptBlocker;
+      NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
+      mPresShell->Paint(aView, nsRegion(),
+                        nsIPresShell::PAINT_LAYERS |
+                        nsIPresShell::PAINT_WILL_SEND_DID_PAINT);
 #ifdef DEBUG_INVALIDATIONS
-        printf("---- PAINT END ----\n");
+      printf("---- PAINT END ----\n");
 #endif
-        aView->SetForcedRepaint(false);
-        SetPainting(false);
-      }
+      aView->SetForcedRepaint(false);
+      SetPainting(false);
     }
     FlushDirtyRegionToWidget(aView);
   }
 }
 
 void nsViewManager::FlushDirtyRegionToWidget(nsView* aView)
 {
   if (!aView->HasNonEmptyDirtyRegion())
@@ -630,40 +611,17 @@ void nsViewManager::InvalidateViews(nsVi
   while (nullptr != childView)  {
     childView->GetViewManager()->InvalidateViews(childView);
     childView = childView->GetNextSibling();
   }
 }
 
 void nsViewManager::WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint)
 {
-  if (!IsRefreshDriverPaintingEnabled() && aWidget && mContext) {
-    // If an ancestor widget was hidden and then shown, we could
-    // have a delayed resize to handle.
-    for (nsViewManager *vm = this; vm;
-         vm = vm->mRootView->GetParent()
-                ? vm->mRootView->GetParent()->GetViewManager()
-                : nullptr) {
-      if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
-          vm->mRootView->IsEffectivelyVisible() &&
-          mPresShell && mPresShell->IsVisible()) {
-        vm->FlushDelayedResize(true);
-        vm->InvalidateView(vm->mRootView);
-      }
-    }
-
-    // Flush things like reflows by calling WillPaint on observer presShells.
-    nsRefPtr<nsViewManager> rootVM = RootViewManager();
-    rootVM->CallWillPaintOnObservers(aWillSendDidPaint);
-
-    // Flush view widget geometry updates and invalidations.
-    rootVM->ProcessPendingUpdates();
-  }
-
-  if (aWidget && IsRefreshDriverPaintingEnabled()) {
+  if (aWidget) {
     nsView* view = nsView::GetViewFor(aWidget);
     if (view && view->ForcedRepaint()) {
       ProcessPendingUpdates();
       // Re-get the view pointer here since the ProcessPendingUpdates might have
       // destroyed it during CallWillPaintOnObservers.
       view = nsView::GetViewFor(aWidget);
       if (view) {
         view->SetForcedRepaint(false);
@@ -681,20 +639,16 @@ bool nsViewManager::PaintWindow(nsIWidge
                                 uint32_t aFlags)
  {
   if (!aWidget || !mContext)
     return false;
 
   NS_ASSERTION(IsPaintingAllowed(),
                "shouldn't be receiving paint events while painting is disallowed!");
 
-  if (!(aFlags & nsIWidgetListener::SENT_WILL_PAINT) && !IsRefreshDriverPaintingEnabled()) {
-    WillPaintWindow(aWidget, (aFlags & nsIWidgetListener::WILL_SEND_DID_PAINT));
-  }
-
   // Get the view pointer here since NS_WILL_PAINT might have
   // destroyed it during CallWillPaintOnObservers (bug 378273).
   nsView* view = nsView::GetViewFor(aWidget);
   if (view && !aRegion.IsEmpty()) {
     Refresh(view, aRegion, (aFlags & nsIWidgetListener::WILL_SEND_DID_PAINT));
   }
 
   return true;
@@ -1047,17 +1001,17 @@ bool nsViewManager::IsViewInserted(nsVie
     return true;
   } else if (aView->GetParent() == nullptr) {
     return false;
   } else {
     nsView* view = aView->GetParent()->GetFirstChild();
     while (view != nullptr) {
       if (view == aView) {
         return true;
-      }        
+      }
       view = view->GetNextSibling();
     }
     return false;
   }
 }
 
 void
 nsViewManager::SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZIndex, bool aTopMost)
@@ -1152,45 +1106,36 @@ nsViewManager::IsPainting(bool& aIsPaint
 void
 nsViewManager::ProcessPendingUpdates()
 {
   if (!IsRootVM()) {
     RootViewManager()->ProcessPendingUpdates();
     return;
   }
 
-  if (IsRefreshDriverPaintingEnabled()) {
-    mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
-      
-    // Flush things like reflows by calling WillPaint on observer presShells.
-    if (mPresShell) {
-      CallWillPaintOnObservers(true);
-    }
-    ProcessPendingUpdatesForView(mRootView, true);
-  } else {
-    ProcessPendingUpdatesForView(mRootView, true);
+  mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
+
+  // Flush things like reflows by calling WillPaint on observer presShells.
+  if (mPresShell) {
+    CallWillPaintOnObservers(true);
   }
+  ProcessPendingUpdatesForView(mRootView, true);
 }
 
 void
 nsViewManager::UpdateWidgetGeometry()
 {
   if (!IsRootVM()) {
     RootViewManager()->UpdateWidgetGeometry();
     return;
   }
 
   if (mHasPendingWidgetGeometryChanges) {
-    if (IsRefreshDriverPaintingEnabled()) {
-      mHasPendingWidgetGeometryChanges = false;
-    }
+    mHasPendingWidgetGeometryChanges = false;
     ProcessPendingUpdatesForView(mRootView, false);
-    if (!IsRefreshDriverPaintingEnabled()) {
-      mHasPendingWidgetGeometryChanges = false;
-    }
   }
 }
 
 void
 nsViewManager::CallWillPaintOnObservers(bool aWillSendDidPaint)
 {
   NS_PRECONDITION(IsRootVM(), "Must be root VM for this to be called!");