bug 829963 - fix hi-/lo-dpi scaling in window opened from script with explicit size on secondary display. r=roc
authorJonathan Kew <jkew@mozilla.com>
Wed, 30 Jan 2013 12:04:19 +0000
changeset 120366 538d00d025c41f4b5d6f4f7f88e42147ab2478d1
parent 120365 7ae2b53bd0b732f3a98578285a89b0b8df810712
child 120367 de2b4e74861fa4540921882f8e3c2e90e11ed912
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs829963
milestone21.0a1
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
bug 829963 - fix hi-/lo-dpi scaling in window opened from script with explicit size on secondary display. r=roc
layout/base/nsPresContext.cpp
view/src/nsView.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1642,19 +1642,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) {