mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 799078. Part 2: Get Mac plugin content scale factor from the device context instead of guessing. r=smichaud
--HG-- extra : rebase_source : e6157857bb6a3b698fc1d22383cdb05d259a0d1b
This commit is contained in:
parent
12170091be
commit
ba0c33ffae
@ -3730,24 +3730,10 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
|
||||
// for plugins. On other platforms, plugin coordinates are always in device
|
||||
// pixels.
|
||||
#if defined(XP_MACOSX)
|
||||
if (mWidget) {
|
||||
scaleFactor = mWidget->GetDefaultScale();
|
||||
} else {
|
||||
nsCOMPtr<nsIScreenManager> screenMgr =
|
||||
do_GetService("@mozilla.org/gfx/screenmanager;1");
|
||||
if (screenMgr) {
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
nsIntRect screenRect = mObjectFrame->GetScreenRect();
|
||||
screenMgr->ScreenForRect(screenRect.x, screenRect.y,
|
||||
screenRect.width, screenRect.height,
|
||||
getter_AddRefs(screen));
|
||||
if (screen) {
|
||||
nsresult rv = screen->GetContentsScaleFactor(&scaleFactor);
|
||||
if (NS_FAILED(rv)) {
|
||||
scaleFactor = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(mContent->OwnerDoc());
|
||||
if (presShell) {
|
||||
scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
|
||||
presShell->GetPresContext()->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
}
|
||||
#endif
|
||||
*result = scaleFactor;
|
||||
|
Loading…
Reference in New Issue
Block a user