mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 564815 - Implement window.devicePixelRatio [r=jst, sr=sicking]
--HG-- extra : rebase_source : 392c6636fabe2a3ec519abd03ef1b1cf44ba464e
This commit is contained in:
parent
1be60a7fb4
commit
dd28aab718
@ -1439,17 +1439,9 @@ nsDOMWindowUtils::FindElementWithViewId(nsViewID aID,
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetScreenPixelsPerCSSPixel(float* aScreenPixels)
|
||||
{
|
||||
*aScreenPixels = 1;
|
||||
|
||||
if (!nsContentUtils::IsCallerTrustedForRead())
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_OK;
|
||||
|
||||
*aScreenPixels = float(nsPresContext::AppUnitsPerCSSPixel())/
|
||||
presContext->AppUnitsPerDevPixel();
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
return window->GetDevicePixelRatio(aScreenPixels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3866,6 +3866,26 @@ nsGlobalWindow::GetMozInnerScreenY(float* aScreenY)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetDevicePixelRatio(float* aRatio)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetDevicePixelRatio, (aRatio), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
*aRatio = 1.0;
|
||||
|
||||
if (!mDocShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
return NS_OK;
|
||||
|
||||
*aRatio = float(nsPresContext::AppUnitsPerCSSPixel())/
|
||||
presContext->AppUnitsPerDevPixel();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetMozPaintCount(uint64_t* aResult)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ interface nsIDOMMozURLProperty : nsISupports
|
||||
* @see <http://www.whatwg.org/html/#window>
|
||||
*/
|
||||
|
||||
[scriptable, uuid(A1AF6CD9-C6E7-4037-99F8-DBCA1B03E345)]
|
||||
[scriptable, uuid(afeb6529-06f1-47e8-98c6-c7bfadb4c1ff)]
|
||||
interface nsIDOMWindow : nsISupports
|
||||
{
|
||||
// the current browsing context
|
||||
@ -375,6 +375,7 @@ interface nsIDOMWindow : nsISupports
|
||||
|
||||
readonly attribute float mozInnerScreenX;
|
||||
readonly attribute float mozInnerScreenY;
|
||||
readonly attribute float devicePixelRatio;
|
||||
|
||||
/* The maximum offset that the window can be scrolled to
|
||||
(i.e., the document width/height minus the scrollport width/height) */
|
||||
|
Loading…
Reference in New Issue
Block a user