mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1246346 - patch 2 - Correct the origin of the DOM screen coordinates (screen.left, screen.top) for secondary display on a mixed-DPI configuration. r=emk
This commit is contained in:
parent
e0e2bd09f7
commit
ef2b8b8c1a
@ -133,9 +133,15 @@ nsScreen::GetRect(nsRect& aRect)
|
||||
}
|
||||
|
||||
context->GetRect(aRect);
|
||||
LayoutDevicePoint screenTopLeftDev =
|
||||
LayoutDevicePixel::FromAppUnits(aRect.TopLeft(),
|
||||
context->AppUnitsPerDevPixel());
|
||||
DesktopPoint screenTopLeftDesk =
|
||||
screenTopLeftDev / context->GetDesktopToDeviceScale();
|
||||
|
||||
aRect.x = NSToIntRound(screenTopLeftDesk.x);
|
||||
aRect.y = NSToIntRound(screenTopLeftDesk.y);
|
||||
|
||||
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(aRect.x);
|
||||
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(aRect.y);
|
||||
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(aRect.height);
|
||||
aRect.width = nsPresContext::AppUnitsToIntCSSPixels(aRect.width);
|
||||
|
||||
@ -156,10 +162,21 @@ nsScreen::GetAvailRect(nsRect& aRect)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRect r;
|
||||
context->GetRect(r);
|
||||
LayoutDevicePoint screenTopLeftDev =
|
||||
LayoutDevicePixel::FromAppUnits(r.TopLeft(),
|
||||
context->AppUnitsPerDevPixel());
|
||||
DesktopPoint screenTopLeftDesk =
|
||||
screenTopLeftDev / context->GetDesktopToDeviceScale();
|
||||
|
||||
context->GetClientRect(aRect);
|
||||
|
||||
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(aRect.x);
|
||||
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(aRect.y);
|
||||
aRect.x = NSToIntRound(screenTopLeftDesk.x) +
|
||||
nsPresContext::AppUnitsToIntCSSPixels(aRect.x - r.x);
|
||||
aRect.y = NSToIntRound(screenTopLeftDesk.y) +
|
||||
nsPresContext::AppUnitsToIntCSSPixels(aRect.y - r.y);
|
||||
|
||||
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(aRect.height);
|
||||
aRect.width = nsPresContext::AppUnitsToIntCSSPixels(aRect.width);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user