Bug 943668 - ensure window.screenX and .screenY return css pixels. r=roc

This commit is contained in:
Mark Hammond 2013-12-03 16:36:33 +11:00
parent 2f884a142f
commit abca27fb7c
2 changed files with 6 additions and 2 deletions

View File

@ -4726,7 +4726,7 @@ nsGlobalWindow::SetOuterHeight(int32_t aOuterHeight)
nsIntPoint nsIntPoint
nsGlobalWindow::GetScreenXY(ErrorResult& aError) nsGlobalWindow::GetScreenXY(ErrorResult& aError)
{ {
FORWARD_TO_OUTER_OR_THROW(GetScreenXY, (aError), aError, nsIntPoint(0, 0)); MOZ_ASSERT(IsOuterWindow());
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow(); nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
if (!treeOwnerAsWin) { if (!treeOwnerAsWin) {
@ -4742,6 +4742,8 @@ nsGlobalWindow::GetScreenXY(ErrorResult& aError)
int32_t int32_t
nsGlobalWindow::GetScreenX(ErrorResult& aError) nsGlobalWindow::GetScreenX(ErrorResult& aError)
{ {
FORWARD_TO_OUTER_OR_THROW(GetScreenX, (aError), aError, 0);
return DevToCSSIntPixels(GetScreenXY(aError).x); return DevToCSSIntPixels(GetScreenXY(aError).x);
} }
@ -5091,6 +5093,8 @@ nsGlobalWindow::SetScreenX(int32_t aScreenX)
int32_t int32_t
nsGlobalWindow::GetScreenY(ErrorResult& aError) nsGlobalWindow::GetScreenY(ErrorResult& aError)
{ {
FORWARD_TO_OUTER_OR_THROW(GetScreenY, (aError), aError, 0);
return DevToCSSIntPixels(GetScreenXY(aError).y); return DevToCSSIntPixels(GetScreenXY(aError).y);
} }

View File

@ -1291,7 +1291,7 @@ protected:
void PreloadLocalStorage(); void PreloadLocalStorage();
// Returns device pixels. // Returns device pixels. Outer windows only.
nsIntPoint GetScreenXY(mozilla::ErrorResult& aError); nsIntPoint GetScreenXY(mozilla::ErrorResult& aError);
int32_t RequestAnimationFrame(const nsIDocument::FrameRequestCallbackHolder& aCallback, int32_t RequestAnimationFrame(const nsIDocument::FrameRequestCallbackHolder& aCallback,