Backed out changeset 57f4bd1baf13 (bug 1157941) for OSX 10.10 e10s browser_bug427559.js failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 07 Jul 2015 12:01:56 -0400
changeset 251770 a026b731506a0f48647f86e84a8d5f82bd512e9f
parent 251769 e965cd35db973c23bbc6db16712d5226fb17f234
child 251771 9340658848d140b1d1cc93bb1d5bf4080a095e25
push id29007
push userryanvm@gmail.com
push dateTue, 07 Jul 2015 18:38:06 +0000
treeherdermozilla-central@9340658848d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1157941, 427559
milestone42.0a1
backs out57f4bd1baf1390c363f281d1dde5e36ef2e7a2c0
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
Backed out changeset 57f4bd1baf13 (bug 1157941) for OSX 10.10 e10s browser_bug427559.js failures. CLOSED TREE
view/nsView.cpp
view/nsView.h
view/nsViewManager.cpp
widget/PuppetWidget.cpp
widget/PuppetWidget.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -85,20 +85,16 @@ nsView::~nsView()
     
     mViewManager = nullptr;
   }
   else if (mParent)
   {
     mParent->RemoveChild(this);
   }
 
-  if (mPreviousWindow) {
-    mPreviousWindow->SetPreviouslyAttachedWidgetListener(nullptr);
-  }
-
   // Destroy and release the widget
   DestroyWidget();
 
   delete mDirtyRegion;
 }
 
 class DestroyWidgetRunnable : public nsRunnable {
 public:
@@ -721,28 +717,16 @@ nsresult nsView::AttachToTopLevelWidget(
 
 // Detach this view from an attached widget. 
 nsresult nsView::DetachFromTopLevelWidget()
 {
   NS_PRECONDITION(mWidgetIsTopLevel, "Not attached currently!");
   NS_PRECONDITION(mWindow, "null mWindow for DetachFromTopLevelWidget!");
 
   mWindow->SetAttachedWidgetListener(nullptr);
-  nsIWidgetListener* listener = mWindow->GetPreviouslyAttachedWidgetListener();
-
-  if (listener && listener->GetView()) {
-    // Ensure the listener doesn't think it's being used anymore
-    listener->GetView()->SetPreviousWidget(nullptr);
-  }
-
-  // If the new view's frame is paint suppressed then the window
-  // will want to use us instead until that's done
-  mWindow->SetPreviouslyAttachedWidgetListener(this);
-
-  mPreviousWindow = mWindow;
   mWindow = nullptr;
 
   mWidgetIsTopLevel = false;
   
   return NS_OK;
 }
 
 void nsView::SetZIndex(bool aAuto, int32_t aZIndex)
@@ -1107,14 +1091,8 @@ nsView::HandleEvent(WidgetGUIEvent* aEve
 
   if (view) {
     nsRefPtr<nsViewManager> vm = view->GetViewManager();
     vm->DispatchEvent(aEvent, view, &result);
   }
 
   return result;
 }
-
-bool
-nsView::IsPrimaryFramePaintSuppressed()
-{
-  return mFrame ? mFrame->PresContext()->PresShell()->IsPaintingSuppressed() : false;
-}
--- a/view/nsView.h
+++ b/view/nsView.h
@@ -277,24 +277,16 @@ public:
    * If we believe that all cutout view have a native widget, this
    * could be a replacement.
    * @param aWidget out parameter for widget that this view contains,
    *        or nullptr if there is none.
    */
   nsIWidget* GetWidget() const { return mWindow; }
 
   /**
-   * The widget which we have attached a listener to can also have a "previous"
-   * listener set on it. This is to keep track of the last nsView when navigating
-   * to a new one so that we can continue to paint that if the new one isn't ready
-   * yet.
-   */
-  void SetPreviousWidget(nsIWidget* aWidget) { mPreviousWindow = aWidget; }
-
-  /**
    * Returns true if the view has a widget associated with it.
    */
   bool HasWidget() const { return mWindow != nullptr; }
   
   void SetForcedRepaint(bool aForceRepaint) { 
     mForcedRepaint = aForceRepaint; 
   }
 
@@ -386,18 +378,16 @@ public:
   virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
                                     bool aUseAttachedEvents) override;
 
   virtual ~nsView();
 
   nsPoint GetOffsetTo(const nsView* aOther, const int32_t aAPD) const;
   nsIWidget* GetNearestWidget(nsPoint* aOffset, const int32_t aAPD) const;
 
-  bool IsPrimaryFramePaintSuppressed();
-
 private:
   explicit nsView(nsViewManager* aViewManager = nullptr,
                   nsViewVisibility aVisibility = nsViewVisibility_kShow);
 
   bool ForcedRepaint() { return mForcedRepaint; }
 
   // Do the actual work of ResetWidgetBounds, unconditionally.  Don't
   // call this method if we have no widget.
@@ -455,17 +445,16 @@ private:
   // If the hierarchy is being removed, aViewManagerParent points to the view
   // manager for the hierarchy's old parent, and will have its mouse grab
   // released if it points to any view in this view hierarchy.
   void InvalidateHierarchy(nsViewManager *aViewManagerParent);
 
   nsViewManager    *mViewManager;
   nsView           *mParent;
   nsCOMPtr<nsIWidget> mWindow;
-  nsCOMPtr<nsIWidget> mPreviousWindow;
   nsView           *mNextSibling;
   nsView           *mFirstChild;
   nsIFrame         *mFrame;
   nsRegion         *mDirtyRegion;
   int32_t           mZIndex;
   nsViewVisibility  mVis;
   // position relative our parent view origin but in our appunits
   nscoord           mPosX, mPosY;
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -435,30 +435,21 @@ nsViewManager::ProcessPendingUpdatesPain
            : nullptr) {
       if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
           vm->mRootView->IsEffectivelyVisible() &&
           vm->mPresShell && vm->mPresShell->IsVisible()) {
         vm->FlushDelayedResize(true);
       }
     }
     nsView* view = nsView::GetViewFor(aWidget);
-
     if (!view) {
       NS_ERROR("FlushDelayedResize destroyed the nsView?");
       return;
     }
 
-    nsIWidgetListener* previousListener = aWidget->GetPreviouslyAttachedWidgetListener();
-
-    if (previousListener &&
-        previousListener != view &&
-        view->IsPrimaryFramePaintSuppressed()) {
-      return;
-    }
-
     if (mPresShell) {
 #ifdef MOZ_DUMP_PAINTING
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n",
                       mPresShell, view, aWidget);
       }
 #endif
 
@@ -1153,9 +1144,8 @@ nsViewManager::InvalidateHierarchy()
       NS_ADDREF(mRootViewManager);
       NS_ASSERTION(mRootViewManager != this,
                    "Root view had a parent, but it has the same view manager");
     } else {
       mRootViewManager = this;
     }
   }
 }
-
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -212,24 +212,17 @@ PuppetWidget::Resize(double aWidth,
   // XXX: roc says that |aRepaint| dictates whether or not to
   // invalidate the expanded area
   if (oldBounds.Size() < mBounds.Size() && aRepaint) {
     nsIntRegion dirty(mBounds);
     dirty.Sub(dirty,  oldBounds);
     InvalidateRegion(this, dirty);
   }
 
-  // call WindowResized() on both the current listener, and possibly
-  // also the previous one if we're in a state where we're drawing that one
-  // because the current one is paint suppressed
   if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) {
-    if (GetCurrentWidgetListener() &&
-        GetCurrentWidgetListener() != mAttachedWidgetListener) {
-      GetCurrentWidgetListener()->WindowResized(this, mBounds.width, mBounds.height);
-    }
     mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
   }
 
   return NS_OK;
 }
 
 nsresult
 PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
@@ -315,18 +308,18 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
     WidgetKeyboardEvent* keyEvent = event->AsKeyboardEvent();
     if (keyEvent) {
       mTabChild->RequestNativeKeyBindings(&autoCache, keyEvent);
     }
   }
 
   aStatus = nsEventStatus_eIgnore;
 
-  if (GetCurrentWidgetListener()) {
-    aStatus = GetCurrentWidgetListener()->HandleEvent(event, mUseAttachedEvents);
+  if (mAttachedWidgetListener) {
+    aStatus = mAttachedWidgetListener->HandleEvent(event, mUseAttachedEvents);
   }
 
   return NS_OK;
 }
 
 nsEventStatus
 PuppetWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
 {
@@ -916,53 +909,53 @@ PuppetWidget::ClearCachedCursor()
   mCustomCursor = nullptr;
 }
 
 nsresult
 PuppetWidget::Paint()
 {
   MOZ_ASSERT(!mDirtyRegion.IsEmpty(), "paint event logic messed up");
 
-  if (!GetCurrentWidgetListener())
+  if (!mAttachedWidgetListener)
     return NS_OK;
 
   nsIntRegion region = mDirtyRegion;
 
   // reset repaint tracking
   mDirtyRegion.SetEmpty();
   mPaintTask.Revoke();
 
-  GetCurrentWidgetListener()->WillPaintWindow(this);
+  mAttachedWidgetListener->WillPaintWindow(this);
 
-  if (GetCurrentWidgetListener()) {
+  if (mAttachedWidgetListener) {
 #ifdef DEBUG
     debug_DumpPaintEvent(stderr, this, region,
                          nsAutoCString("PuppetWidget"), 0);
 #endif
 
     if (mozilla::layers::LayersBackend::LAYERS_CLIENT == mLayerManager->GetBackendType()) {
       // Do nothing, the compositor will handle drawing
       if (mTabChild) {
         mTabChild->NotifyPainted();
       }
     } else {
       nsRefPtr<gfxContext> ctx = new gfxContext(mDrawTarget);
       ctx->Rectangle(gfxRect(0,0,0,0));
       ctx->Clip();
       AutoLayerManagerSetup setupLayerManager(this, ctx,
                                               BufferMode::BUFFER_NONE);
-      GetCurrentWidgetListener()->PaintWindow(this, region);
+      mAttachedWidgetListener->PaintWindow(this, region);
       if (mTabChild) {
         mTabChild->NotifyPainted();
       }
     }
   }
 
-  if (GetCurrentWidgetListener()) {
-    GetCurrentWidgetListener()->DidPaintWindow();
+  if (mAttachedWidgetListener) {
+    mAttachedWidgetListener->DidPaintWindow();
   }
 
   return NS_OK;
 }
 
 void
 PuppetWidget::SetChild(PuppetWidget* aChild)
 {
@@ -1253,25 +1246,10 @@ PuppetScreenManager::GetNumberOfScreens(
 
 NS_IMETHODIMP
 PuppetScreenManager::GetSystemDefaultScale(float *aDefaultScale)
 {
   *aDefaultScale = 1.0f;
   return NS_OK;
 }
 
-nsIWidgetListener*
-PuppetWidget::GetCurrentWidgetListener()
-{
-  if (!mPreviouslyAttachedWidgetListener ||
-      !mAttachedWidgetListener) {
-    return mAttachedWidgetListener;
-  }
-
-  if (mAttachedWidgetListener->GetView()->IsPrimaryFramePaintSuppressed()) {
-    return mPreviouslyAttachedWidgetListener;
-  }
-
-  return mAttachedWidgetListener;
-}
-
 }  // namespace widget
 }  // namespace mozilla
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -269,18 +269,16 @@ private:
 
   bool CacheEditorRect();
   bool CacheCompositionRects(uint32_t& aStartOffset,
                              nsTArray<mozilla::LayoutDeviceIntRect>& aRectArray,
                              uint32_t& aTargetCauseOffset);
   bool GetCaretRect(mozilla::LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
   uint32_t GetCaretOffset();
 
-  nsIWidgetListener* GetCurrentWidgetListener();
-
   class PaintTask : public nsRunnable {
   public:
     NS_DECL_NSIRUNNABLE
     explicit PaintTask(PuppetWidget* widget) : mWidget(widget) {}
     void Revoke() { mWidget = nullptr; }
   private:
     PuppetWidget* mWidget;
   };
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -141,17 +141,16 @@ NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidge
 //
 // nsBaseWidget constructor
 //
 //-------------------------------------------------------------------------
 
 nsBaseWidget::nsBaseWidget()
 : mWidgetListener(nullptr)
 , mAttachedWidgetListener(nullptr)
-, mPreviouslyAttachedWidgetListener(nullptr)
 , mLayerManager(nullptr)
 , mCompositorVsyncDispatcher(nullptr)
 , mCursor(eCursor_standard)
 , mUpdateCursor(true)
 , mBorderStyle(eBorderStyle_none)
 , mUseLayersAcceleration(false)
 , mUseAttachedEvents(false)
 , mBounds(0,0,0,0)
@@ -395,26 +394,16 @@ nsBaseWidget::AttachViewToTopLevel(bool 
   return NS_OK;
 }
 
 nsIWidgetListener* nsBaseWidget::GetAttachedWidgetListener()
  {
    return mAttachedWidgetListener;
  }
 
-nsIWidgetListener* nsBaseWidget::GetPreviouslyAttachedWidgetListener()
- {
-   return mPreviouslyAttachedWidgetListener;
- }
-
-void nsBaseWidget::SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener)
- {
-   mPreviouslyAttachedWidgetListener = aListener;
- }
-
 void nsBaseWidget::SetAttachedWidgetListener(nsIWidgetListener* aListener)
  {
    mAttachedWidgetListener = aListener;
  }
 
 //-------------------------------------------------------------------------
 //
 // Close this nsBaseWidget
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -226,18 +226,16 @@ public:
                                                          double& aOverriddenDeltaY) override;
   virtual already_AddRefed<nsIWidget>
   CreateChild(const nsIntRect  &aRect,
               nsWidgetInitData *aInitData = nullptr,
               bool             aForceUseIWidgetParent = false) override;
   NS_IMETHOD              AttachViewToTopLevel(bool aUseAttachedEvents) override;
   virtual nsIWidgetListener* GetAttachedWidgetListener() override;
   virtual void               SetAttachedWidgetListener(nsIWidgetListener* aListener) override;
-  virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override;
-  virtual void               SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) override;
   NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() override final;
 
   // Helper function for dispatching events which are not processed by APZ,
   // but need to be transformed by APZ.
   nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
 
   // Dispatch an event that must be first be routed through APZ.
   nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) override;
@@ -476,17 +474,16 @@ protected:
    */
   void DestroyCompositor();
   void DestroyLayerManager();
 
   void FreeShutdownObserver();
 
   nsIWidgetListener* mWidgetListener;
   nsIWidgetListener* mAttachedWidgetListener;
-  nsIWidgetListener* mPreviouslyAttachedWidgetListener;
   nsRefPtr<LayerManager> mLayerManager;
   nsRefPtr<CompositorChild> mCompositorChild;
   nsRefPtr<CompositorParent> mCompositorParent;
   nsRefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
   nsRefPtr<APZCTreeManager> mAPZC;
   nsRefPtr<APZEventState> mAPZEventState;
   nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
   nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -114,18 +114,18 @@ typedef void* nsNativeWidget;
 #if defined(MOZ_WIDGET_GTK)
 // set/get nsPluginNativeWindowGtk, e10s specific
 #define NS_NATIVE_PLUGIN_OBJECT_PTR    104
 #endif
 // See RegisterPluginWindowForRemoteUpdates
 #define NS_NATIVE_PLUGIN_ID            105
 
 #define NS_IWIDGET_IID \
-{ 0x483BF75C, 0xF909, 0x45C3, \
-  { 0x95, 0xBE, 0x41, 0x89, 0xDB, 0xCE, 0x2E, 0x13 } };
+{ 0x53376F57, 0xF081, 0x4949, \
+  { 0xB5, 0x5E, 0x87, 0xEF, 0x6A, 0xE9, 0xE3, 0x5A } };
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -936,18 +936,16 @@ class nsIWidget : public nsISupports {
     NS_IMETHOD AttachViewToTopLevel(bool aUseAttachedEvents) = 0;
 
     /**
      * Accessor functions to get and set the attached listener. Used by
      * nsView in connection with AttachViewToTopLevel above.
      */
     virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) = 0;
     virtual nsIWidgetListener* GetAttachedWidgetListener() = 0;
-    virtual void SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) = 0;
-    virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() = 0;
 
     /**
      * Accessor functions to get and set the listener which handles various
      * actions for the widget.
      */
     //@{
     virtual nsIWidgetListener* GetWidgetListener() = 0;
     virtual void SetWidgetListener(nsIWidgetListener* alistener) = 0;