Bug 1323586 - Drop reference to previous widget listener in PuppetWidget when showing after having been hidden. r=tnikkel. a=gchang
authorMike Conley <mconley@mozilla.com>
Fri, 16 Dec 2016 15:54:49 -0500
changeset 353132 8255a7049f448df8fe5154fdfe0aa5248684f164
parent 353131 62eb5ff8893e7803da94b2e52bd108285aa1f5fe
child 353133 91817312d38a2e9c4bdf879d8eab44c57ea5d696
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, gchang
bugs1323586
milestone52.0a2
Bug 1323586 - Drop reference to previous widget listener in PuppetWidget when showing after having been hidden. r=tnikkel. a=gchang 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
@@ -203,16 +203,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