Bug 1351329 - Fix Windows implementation of defaultCSSScaleFactor. r?kanru
Unlike contentsScaleFactor, defaultCSSScaleFactor always uses WinUtils::LogToPhysFactor regardless of the DPI awareness.
Bug 1194751 broke the implementation (probably unknowingly).
MozReview-Commit-ID: KjtnT2ebgHK
--- a/widget/windows/ScreenHelperWin.cpp
+++ b/widget/windows/ScreenHelperWin.cpp
@@ -22,25 +22,26 @@ CollectMonitors(HMONITOR aMon, HDC, LPRE
BOOL success = FALSE;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
success = ::GetMonitorInfoW(aMon, &info);
if (!success) {
MOZ_LOG(sScreenLog, LogLevel::Error, ("GetMonitorInfoW failed"));
return TRUE; // continue the enumeration
}
+ double scale = WinUtils::LogToPhysFactor(aMon);
DesktopToLayoutDeviceScale contentsScaleFactor;
if (WinUtils::IsPerMonitorDPIAware()) {
contentsScaleFactor.scale = 1.0;
} else {
- contentsScaleFactor.scale = WinUtils::LogToPhysFactor(aMon);
+ contentsScaleFactor.scale = scale;
}
CSSToLayoutDeviceScale defaultCssScaleFactor(nsIWidget::DefaultScaleOverride());
if (defaultCssScaleFactor.scale <= 0.0) {
- defaultCssScaleFactor.scale = contentsScaleFactor.scale;
+ defaultCssScaleFactor.scale = scale;
}
LayoutDeviceIntRect rect(info.rcMonitor.left, info.rcMonitor.top,
info.rcMonitor.right - info.rcMonitor.left,
info.rcMonitor.bottom - info.rcMonitor.top);
LayoutDeviceIntRect availRect(info.rcWork.left, info.rcWork.top,
info.rcWork.right - info.rcWork.left,
info.rcWork.bottom - info.rcWork.top);
//XXX not sure how to get this info for multiple monitors, this might be ok...