mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 890156 - patch 2 - Expose DevicePixelsPerDesktopPixel through nsIBaseWindow and its implementations. r=emk
This commit is contained in:
parent
ac01696be2
commit
db11f6d02a
@ -5782,6 +5782,23 @@ nsDocShell::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetDevicePixelsPerDesktopPixel(double* aScale)
|
||||
{
|
||||
if (mParentWidget) {
|
||||
*aScale = mParentWidget->GetDesktopToDeviceScale().scale;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> ownerWindow(do_QueryInterface(mTreeOwner));
|
||||
if (ownerWindow) {
|
||||
return ownerWindow->GetDevicePixelsPerDesktopPixel(aScale);
|
||||
}
|
||||
|
||||
*aScale = 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
|
@ -560,6 +560,17 @@ nsDocShellTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::GetDevicePixelsPerDesktopPixel(double* aScale)
|
||||
{
|
||||
if (mWebBrowser) {
|
||||
return mWebBrowser->GetDevicePixelsPerDesktopPixel(aScale);
|
||||
}
|
||||
|
||||
*aScale = 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
|
@ -1294,6 +1294,14 @@ nsWebBrowser::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowser::GetDevicePixelsPerDesktopPixel(double* aScale)
|
||||
{
|
||||
*aScale = mParentWidget ? mParentWidget->GetDesktopToDeviceScale().scale
|
||||
: 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowser::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ typedef voidPtr nativeWindow;
|
||||
* but rather a common set that nearly all windowed objects support.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(9DA319F3-EEE6-4504-81A5-6A19CF6215BF)]
|
||||
[scriptable, uuid(ca635529-a977-4552-9b8a-66187e54d882)]
|
||||
interface nsIBaseWindow : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -192,6 +192,20 @@ interface nsIBaseWindow : nsISupports
|
||||
*/
|
||||
readonly attribute double unscaledDevicePixelsPerCSSPixel;
|
||||
|
||||
/*
|
||||
The number of device pixels per display pixel on this window's current
|
||||
screen. (The meaning of "display pixel" varies across OS environments;
|
||||
it is the pixel units used by the desktop environment to manage screen
|
||||
real estate and window positioning, which may correspond to (per-screen)
|
||||
device pixels, or may be a virtual coordinate space that covers a multi-
|
||||
monitor, mixed-dpi desktop space.)
|
||||
This is the value returned by DevicePixelsPerDesktopPixel() of the underlying
|
||||
widget.
|
||||
Note that this may change if the window is moved between screens with
|
||||
differing resolutions.
|
||||
*/
|
||||
readonly attribute double devicePixelsPerDesktopPixel;
|
||||
|
||||
/**
|
||||
* Give the window focus.
|
||||
*/
|
||||
|
@ -382,6 +382,12 @@ NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double *aSca
|
||||
return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::GetDevicePixelsPerDesktopPixel(double *aScale)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
|
@ -621,6 +621,12 @@ NS_IMETHODIMP nsContentTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double* aSc
|
||||
return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::GetDevicePixelsPerDesktopPixel(double* aScale)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
|
@ -557,6 +557,12 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::GetDevicePixelsPerDesktopPixel(double *aScale)
|
||||
{
|
||||
*aScale = mWindow ? mWindow->GetDesktopToDeviceScale().scale : 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
*aScale = mWindow ? mWindow->GetDefaultScale().scale : 1.0;
|
||||
|
Loading…
Reference in New Issue
Block a user