From f29053535c8c9c61d985bd4f6567282575ccb794 Mon Sep 17 00:00:00 2001
From: Markus Stange <mstange@themasta.com>
Date: Wed, 23 Sep 2009 08:53:25 +1200
Subject: [PATCH] Backed out changeset 7799cfb99362 (Bug 517804 - Flush reflows
 and invalidations during viewWillDraw) because it caused a ts_shutdown
 regression.

---
 view/src/nsViewManager.cpp      | 23 ++++++++++-------------
 widget/public/nsGUIEvent.h      |  2 --
 widget/src/cocoa/nsChildView.mm |  9 ---------
 3 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp
index 60de0caec4045..c987c35d30218 100644
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -893,7 +893,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
         break;
       }
 
-    case NS_WILL_PAINT:
     case NS_PAINT:
       {
         nsPaintEvent *event = static_cast<nsPaintEvent*>(aEvent);
@@ -906,18 +905,16 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
         // The rect is in device units, and it's in the coordinate space of its
         // associated window.
         nsCOMPtr<nsIRegion> region = event->region;
-        if (aEvent->message == NS_PAINT) {
-          if (!region) {
-            if (NS_FAILED(CreateRegion(getter_AddRefs(region))))
-              break;
-
-            const nsIntRect& damrect = *event->rect;
-            region->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
-          }
-
-          if (region->IsEmpty())
+        if (!region) {
+          if (NS_FAILED(CreateRegion(getter_AddRefs(region))))
             break;
+
+          const nsIntRect& damrect = *event->rect;
+          region->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
         }
+        
+        if (region->IsEmpty())
+          break;
 
         // Refresh the view
         if (IsRefreshEnabled()) {
@@ -988,12 +985,12 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
               rootVM->ProcessPendingUpdates(mRootView, PR_FALSE);
             }
             
-            if (view && aEvent->message == NS_PAINT) {
+            if (view) {
               Refresh(view, event->renderingContext, region,
                       NS_VMREFRESH_DOUBLE_BUFFER);
             }
           }
-        } else if (aEvent->message == NS_PAINT) {
+        } else {
           // since we got an NS_PAINT event, we need to
           // draw something so we don't get blank areas,
           // unless there's no widget or it's transparent.
diff --git a/widget/public/nsGUIEvent.h b/widget/public/nsGUIEvent.h
index 00d45c8e96977..b5a9b128b7d21 100644
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -162,8 +162,6 @@ class nsHashKey;
 #define NS_DEACTIVATE                   (NS_WINDOW_START + 8)
 // top-level window z-level change request
 #define NS_SETZLEVEL                    (NS_WINDOW_START + 9)
-// Widget will need to be painted
-#define NS_WILL_PAINT                   (NS_WINDOW_START + 29)
 // Widget needs to be repainted
 #define NS_PAINT                        (NS_WINDOW_START + 30)
 // Key is pressed within a window
diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm
index ad9f316641a92..656415d9d22da 100644
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -2739,15 +2739,6 @@ static const PRInt32 sShadowInvalidationInterval = 100;
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)viewWillDraw
-{
-  if (!mGeckoChild)
-    return;
-
-  nsPaintEvent paintEvent(PR_TRUE, NS_WILL_PAINT, mGeckoChild);
-  mGeckoChild->DispatchWindowEvent(paintEvent);
-}
-
 // Allows us to turn off setting up the clip region
 // before each drawRect. We already clip within gecko.
 - (BOOL)wantsDefaultClipping
-- 
GitLab