Bug 1264196 - Use the DPI from the parent window, if any, for consistency between popups and their owners when straddling a monitor boundary. r=emk

This commit is contained in:
Jonathan Kew 2016-04-13 14:40:46 +01:00
parent 0dce9cb2f1
commit 91c9694559

View File

@ -145,7 +145,10 @@ public:
*/
static double LogToPhysFactor(HMONITOR aMonitor);
static double LogToPhysFactor(HWND aWnd) {
return LogToPhysFactor(::MonitorFromWindow(aWnd, MONITOR_DEFAULTTOPRIMARY));
// if there's an ancestor window, we want to share its DPI setting
HWND ancestor = ::GetAncestor(aWnd, GA_ROOTOWNER);
return LogToPhysFactor(::MonitorFromWindow(ancestor ? ancestor : aWnd,
MONITOR_DEFAULTTOPRIMARY));
}
static double LogToPhysFactor(HDC aDC) {
return LogToPhysFactor(::WindowFromDC(aDC));