Bug 1154125 - Ensure the context has up-to-date device pixel DPI scaling before using it in calling nsViewManager::SetWindowDimensions. r=mstange a=sledru
authorJonathan Kew <jkew@mozilla.com>
Thu, 30 Jun 2016 12:27:29 +0100
changeset 325511 ebd239b4cbfb8eff833560f72b163275ac4026d3
parent 325510 2a0c3fd014516cd8718395e25a8cecd1fa29e0cb
child 325512 59e0323f3db6d891daa2389dd8716d9bfb0c83a0
push id9827
push userjkew@mozilla.com
push dateTue, 26 Jul 2016 15:06:52 +0000
treeherdermozilla-aurora@ebd239b4cbfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, sledru
bugs1154125
milestone49.0a2
Bug 1154125 - Ensure the context has up-to-date device pixel DPI scaling before using it in calling nsViewManager::SetWindowDimensions. r=mstange a=sledru
layout/base/nsDocumentViewer.cpp
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1913,16 +1913,24 @@ nsDocumentViewer::SetBoundsWithFlags(con
 
   if (mWindow && !mAttachedToParent) {
     // Resize the widget, but don't trigger repaint. Layout will generate
     // repaint requests during reflow.
     mWindow->Resize(aBounds.x, aBounds.y,
                     aBounds.width, aBounds.height,
                     false);
   } else if (mPresContext && mViewManager) {
+    // Ensure presContext's deviceContext is up to date, as we sometimes get
+    // here before a resolution-change notification has been fully handled
+    // during display configuration changes, especially when there are lots
+    // of windows/widgets competing to handle the notifications.
+    // (See bug 1154125.)
+    if (mPresContext->DeviceContext()->CheckDPIChange()) {
+      mPresContext->UIResolutionChanged();
+    }
     int32_t p2a = mPresContext->AppUnitsPerDevPixel();
     mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(mBounds.width, p2a),
                                       NSIntPixelsToAppUnits(mBounds.height, p2a),
                                       !!(aFlags & nsIContentViewer::eDelayResize));
   }
 
   // If there's a previous viewer, it's the one that's actually showing,
   // so be sure to resize it as well so it paints over the right area.