From 54175e64751cdc1e87edd5509734b5d20e871e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 17 Oct 2018 02:20:15 +0000 Subject: [PATCH] Bug 1498860 - Add window.screenLeft / window.screenTop as aliases of screenX / screenY. r=smaug Tests are at https://github.com/web-platform-tests/wpt/pull/13543. Spec is waiting on those, but this matches all other browsers. Differential Revision: https://phabricator.services.mozilla.com/D8917 --HG-- extra : moz-landing-system : lando --- dom/base/nsGlobalWindowInner.h | 13 +++++++++++++ dom/webidl/Window.webidl | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/dom/base/nsGlobalWindowInner.h b/dom/base/nsGlobalWindowInner.h index 3b5561f55a05..4d75ebefbc0a 100644 --- a/dom/base/nsGlobalWindowInner.h +++ b/dom/base/nsGlobalWindowInner.h @@ -816,6 +816,19 @@ public: { return GetScrollY(aError); } + + int32_t GetScreenLeft(mozilla::dom::CallerType aCallerType, + mozilla::ErrorResult& aError) + { + return GetScreenX(aCallerType, aError); + } + + int32_t GetScreenTop(mozilla::dom::CallerType aCallerType, + mozilla::ErrorResult& aError) + { + return GetScreenY(aCallerType, aError); + } + void GetScreenX(JSContext* aCx, JS::MutableHandle aValue, mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aError); diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl index a185f232b34c..e7f9d24da1d4 100644 --- a/dom/webidl/Window.webidl +++ b/dom/webidl/Window.webidl @@ -188,6 +188,10 @@ partial interface Window { [Replaceable, Throws] readonly attribute double scrollY; [Replaceable, Throws] readonly attribute double pageYOffset; + // Aliases for screenX / screenY. + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenLeft; + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenTop; + // client // These are writable because we allow chrome to write them. And they need // to use 'any' as the type, because non-chrome writing them needs to act