bug 829963 - fix hi-/lo-dpi scaling in window opened from script with explicit size on secondary display. r=roc a=bajaj
authorJonathan Kew <jkew@mozilla.com>
Wed, 30 Jan 2013 09:38:17 +0000
changeset 127476 f87b14a1329944a760dc243d29fca9c4936395bd
parent 127475 052ba6eac8a727c189bcd23fb92a988a8aea7d05
child 127477 c70f78759651a936fae17f3a098d591cf4600eef
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, bajaj
bugs829963
milestone20.0a2
bug 829963 - fix hi-/lo-dpi scaling in window opened from script with explicit size on secondary display. r=roc a=bajaj
layout/base/nsPresContext.cpp
view/src/nsView.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1657,19 +1657,18 @@ nsPresContext::UIResolutionChangedSubdoc
   return true;
 }
 
 void
 nsPresContext::UIResolutionChangedInternal()
 {
   mPendingUIResolutionChanged = false;
 
-  if (mDeviceContext->CheckDPIChange()) {
-    AppUnitsPerDevPixelChanged();
-  }
+  mDeviceContext->CheckDPIChange();
+  AppUnitsPerDevPixelChanged();
 
   mDocument->EnumerateSubDocuments(UIResolutionChangedSubdocumentCallback,
                                    nullptr);
 }
 
 void
 nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint)
 {
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -914,16 +914,19 @@ bool
 nsView::WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight)
 {
   // The root view may not be set if this is the resize associated with
   // window creation
   SetForcedRepaint(true);
   if (this == mViewManager->GetRootView()) {
     nsRefPtr<nsDeviceContext> devContext;
     mViewManager->GetDeviceContext(*getter_AddRefs(devContext));
+    // ensure DPI is up-to-date, in case of window being opened and sized
+    // on a non-default-dpi display (bug 829963)
+    devContext->CheckDPIChange();
     int32_t p2a = devContext->AppUnitsPerDevPixel();
     mViewManager->SetWindowDimensions(NSIntPixelsToAppUnits(aWidth, p2a),
                                       NSIntPixelsToAppUnits(aHeight, p2a));
     return true;
   }
   else if (IsPopupWidget(aWidget)) {
     nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
     if (pm) {