Bug 1323586 - Drop reference to previous widget listener in PuppetWidget when showing after having been hidden. r?tnikkel draft
authorMike Conley <mconley@mozilla.com>
Fri, 16 Dec 2016 15:54:49 -0500
changeset 450495 96bafc2c82f4dcecdee8d696f4b2caeac1466a05
parent 450435 5a536a16e33798fe7b16de35c968d5bc0cbf8448
child 539771 59c1c4981fef16603138cd8523fc5773ea4169c8
push id38876
push usermconley@mozilla.com
push dateFri, 16 Dec 2016 21:05:03 +0000
reviewerstnikkel
bugs1323586
milestone53.0a1
Bug 1323586 - Drop reference to previous widget listener in PuppetWidget when showing after having been hidden. r?tnikkel The previously attached widget listener is used mainly so that we can continue to show the previous page until the next one is ready enough to display properly (to avoid a "flashing" effect). When the PuppetWidget is made visible after having been hidden (perhaps during a tab switch), the previously attached widget listener is not useful. It's actually harmful, since PuppetWidget::Paint will attempt to paint that old widget listener, which is not possible, since it's detatched from a widget, so we end up not painting a frame. MozReview-Commit-ID: LJfKzepqguE
widget/PuppetWidget.cpp
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -199,16 +199,25 @@ PuppetWidget::Show(bool aState)
   bool wasVisible = mVisible;
   mVisible = aState;
 
   if (mChild) {
     mChild->mVisible = aState;
   }
 
   if (!wasVisible && mVisible) {
+    // The previously attached widget listener is handy if
+    // we're transitioning from page to page without dropping
+    // layers (since we'll continue to show the old layers
+    // associated with that old widget listener). If the
+    // PuppetWidget was hidden, those layers are dropped,
+    // so the previously attached widget listener is really
+    // of no use anymore (and is actually actively harmful - see
+    // bug 1323586).
+    mPreviouslyAttachedWidgetListener = nullptr;
     Resize(mBounds.width, mBounds.height, false);
     Invalidate(mBounds);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP