Bug 800859. Part 2: Remove nsIPresShell::DidPaint. r=mattwoodrow
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 19 Oct 2012 14:21:16 +1300
changeset 111228 1bf5c18ae382f29e7442aae37dac48a815eb6425
parent 111227 6e108817d0c564adc2ab27ba379f8f85e6e6afde
child 111229 74f3a93b928335df8e3b03bc1a6a317a8336ee8b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmattwoodrow
bugs800859
milestone19.0a1
Bug 800859. Part 2: Remove nsIPresShell::DidPaint. r=mattwoodrow
layout/base/nsIPresShell.h
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
view/src/nsViewManager.cpp
view/src/nsViewManager.h
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -109,20 +109,20 @@ typedef struct CapturingContentInfo {
   // capture should only be allowed during a mousedown event
   bool mAllowed;
   bool mPointerLock;
   bool mRetargetToElement;
   bool mPreventDrag;
   nsIContent* mContent;
 } CapturingContentInfo;
 
-// f50f99bc-e178-4e67-89ea-f2aee5923f6d
+// 307910dd-7355-4535-84e7-6b95a4edffbe
 #define NS_IPRESSHELL_IID \
-{ 0xf50f99bc, 0xe178, 0x4e67, \
-  { 0x89, 0xea, 0xf2, 0xae, 0xe5, 0x92, 0x3f, 0x6d } }
+{ 0x307910dd, 0x7355, 0x4535, \
+  { 0x84, 0xe7, 0x6b, 0x95, 0xa4, 0xed, 0xff, 0xbe } }
 
 // debug VerifyReflow flags
 #define VERIFY_REFLOW_ON                    0x01
 #define VERIFY_REFLOW_NOISY                 0x02
 #define VERIFY_REFLOW_ALL                   0x04
 #define VERIFY_REFLOW_DUMP_COMMANDS         0x08
 #define VERIFY_REFLOW_NOISY_RC              0x10
 #define VERIFY_REFLOW_REALLY_NOISY_RC       0x20
@@ -1248,22 +1248,16 @@ public:
    * Notify that we're going to call Paint with PAINT_LAYERS
    * on the pres shell for a widget (which might not be this one, since
    * WillPaint is called on all presshells in the same toplevel window as the
    * painted widget). This is issued at a time when it's safe to modify
    * widget geometry.
    */
   virtual void WillPaint(bool aWillSendDidPaint) = 0;
   /**
-   * Notify that we called Paint with PAINT_LAYERS. Only fires on the
-   * pres shell for the painted widget. This is issued at a time when it's
-   * safe to modify widget geometry.
-   */
-  virtual void DidPaint() = 0;
-  /**
    * Notify that we're going to call Paint with PAINT_COMPOSITE.
    * Fires on the presshell for the painted widget.
    * This is issued at a time when it's safe to modify widget geometry.
    */
   virtual void WillPaintWindow(bool aWillSendDidPaint) = 0;
   /**
    * Notify that we called Paint with PAINT_COMPOSITE.
    * Fires on the presshell for the painted widget.
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -7038,21 +7038,16 @@ PresShell::WillPaint(bool aWillSendDidPa
   // Process reflows, if we have them, to reduce flicker due to invalidates and
   // reflow being interspersed.  Note that we _do_ allow this to be
   // interruptible; if we can't do all the reflows it's better to flicker a bit
   // than to freeze up.
   FlushPendingNotifications(Flush_InterruptibleLayout);
 }
 
 void
-PresShell::DidPaint()
-{
-}
-
-void
 PresShell::WillPaintWindow(bool aWillSendDidPaint)
 {
   nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
   if (rootPresContext != mPresContext) {
     // This could be a popup's presshell. We don't allow plugins in popups
     // so there's nothing to do here.
     return;
   }
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -191,17 +191,16 @@ public:
   virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
                                                         nsEvent* aEvent,
                                                         nsEventStatus* aStatus);
   virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
                                                         nsIDOMEvent* aEvent,
                                                         nsEventStatus* aStatus);
   virtual bool ShouldIgnoreInvalidation();
   virtual void WillPaint(bool aWillSendDidPaint);
-  virtual void DidPaint();
   virtual void WillPaintWindow(bool aWillSendDidPaint);
   virtual void DidPaintWindow();
   virtual void ScheduleViewManagerFlush();
   virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange);
   virtual void ClearMouseCaptureOnView(nsIView* aView);
   virtual bool IsVisible();
 
   // caret handling
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -709,20 +709,16 @@ bool nsViewManager::PaintWindow(nsIWidge
 }
 
 void nsViewManager::DidPaintWindow()
 {
   nsCOMPtr<nsIPresShell> shell = mPresShell;
   if (shell) {
     shell->DidPaintWindow();
   }
-
-  if (!IsRefreshDriverPaintingEnabled()) {
-    mRootViewManager->CallDidPaintOnObserver();
-  }
 }
 
 nsresult nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsIView* aView, nsEventStatus* aStatus)
 {
   SAMPLE_LABEL("event", "nsViewManager::DispatchEvent");
 
   if ((NS_IS_MOUSE_EVENT(aEvent) &&
        // Ignore mouse events that we synthesize.
@@ -1209,17 +1205,16 @@ nsViewManager::ProcessPendingUpdates()
   if (IsRefreshDriverPaintingEnabled()) {
     mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
       
     // Flush things like reflows by calling WillPaint on observer presShells.
     if (mPresShell) {
       CallWillPaintOnObservers(true);
     }
     ProcessPendingUpdatesForView(mRootView, true);
-    CallDidPaintOnObserver();
   } else {
     ProcessPendingUpdatesForView(mRootView, true);
   }
 }
 
 void
 nsViewManager::UpdateWidgetGeometry()
 {
@@ -1254,29 +1249,16 @@ nsViewManager::CallWillPaintOnObservers(
         if (shell) {
           shell->WillPaint(aWillSendDidPaint);
         }
       }
     }
   }
 }
 
-void
-nsViewManager::CallDidPaintOnObserver()
-{
-  NS_PRECONDITION(IsRootVM(), "Must be root VM for this to be called!");
-
-  if (mRootView && mRootView->IsEffectivelyVisible()) {
-    nsCOMPtr<nsIPresShell> shell = GetPresShell();
-    if (shell) {
-      shell->DidPaint();
-    }
-  }
-}
-
 NS_IMETHODIMP
 nsViewManager::GetLastUserEventTime(uint32_t& aTime)
 {
   aTime = gLastUserEventTime;
   return NS_OK;
 }
 
 void
--- a/view/src/nsViewManager.h
+++ b/view/src/nsViewManager.h
@@ -116,17 +116,16 @@ private:
   void FlushPendingInvalidates();
   void ProcessPendingUpdatesForView(nsView *aView,
                                     bool aFlushDirtyRegion = true);
   void FlushDirtyRegionToWidget(nsView* aView);
   /**
    * Call WillPaint() on all view observers under this vm root.
    */
   void CallWillPaintOnObservers(bool aWillSendDidPaint);
-  void CallDidPaintOnObserver();
   void ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget);
   void ReparentWidgets(nsIView* aView, nsIView *aParent);
   void InvalidateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedRegion);
 
   void InvalidateViews(nsView *aView);
 
   // aView is the view for aWidget and aRegion is relative to aWidget.
   void Refresh(nsView *aView, const nsIntRegion& aRegion, bool aWillSendDidPaint);