mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 794038 pt 0.9 - provide an unscaledDevicePixelsPerCSSPixel attribute on nsIBaseWindow to expose the default device-pix/css-pix ratio. r=roc
This commit is contained in:
parent
002b80075c
commit
7abd9c1d78
@ -4933,6 +4933,23 @@ nsDocShell::Destroy()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
if (mParentWidget) {
|
||||
*aScale = mParentWidget->GetDefaultScale();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> ownerWindow(do_QueryInterface(mTreeOwner));
|
||||
if (ownerWindow) {
|
||||
return ownerWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
*aScale = 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetPosition(int32_t x, int32_t y)
|
||||
{
|
||||
|
@ -470,6 +470,17 @@ nsDocShellTreeOwner::Destroy()
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
if (mWebBrowser) {
|
||||
return mWebBrowser->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
*aScale = 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
|
@ -1239,6 +1239,12 @@ NS_IMETHODIMP nsWebBrowser::Destroy()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
*aScale = mParentWidget ? mParentWidget->GetDefaultScale() : 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
int32_t cx = 0;
|
||||
|
@ -21,7 +21,7 @@ typedef voidPtr nativeWindow;
|
||||
* but rather a common set that nearly all windowed objects support.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7144AC8B-6702-4A4B-A73D-D1D4E9717E46)]
|
||||
[scriptable, uuid(9DA319F3-EEE6-4504-81A5-6A19CF6215BF)]
|
||||
interface nsIBaseWindow : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -182,7 +182,16 @@ interface nsIBaseWindow : nsISupports
|
||||
lives if it has not had to create its own widget.
|
||||
*/
|
||||
[noscript] readonly attribute nsIWidget mainWidget;
|
||||
|
||||
|
||||
/*
|
||||
The number of device pixels per CSS pixel used on this window's current
|
||||
screen at the default zoom level.
|
||||
This is the value returned by GetDefaultScale() of the underlying widget.
|
||||
Note that this may change if the window is moved between screens with
|
||||
differing resolutions.
|
||||
*/
|
||||
readonly attribute double unscaledDevicePixelsPerCSSPixel;
|
||||
|
||||
/**
|
||||
* Give the window focus.
|
||||
*/
|
||||
|
@ -348,6 +348,12 @@ NS_IMETHODIMP nsChromeTreeOwner::Destroy()
|
||||
return mXULWindow->Destroy();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
|
@ -565,6 +565,12 @@ NS_IMETHODIMP nsContentTreeOwner::Destroy()
|
||||
return mXULWindow->Destroy();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
NS_ENSURE_STATE(mXULWindow);
|
||||
|
@ -531,6 +531,12 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
{
|
||||
*aScale = mWindow ? mWindow->GetDefaultScale() : 1.0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::SetPosition(int32_t aX, int32_t aY)
|
||||
{
|
||||
// Don't reset the window's size mode here - platforms that don't want to move
|
||||
|
Loading…
Reference in New Issue
Block a user