Bug 1498860 - Add window.screenLeft / window.screenTop as aliases of screenX / screenY. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 17 Oct 2018 02:20:15 +0000
changeset 500038 7b427b1667424b7d673dafc10629590a840ea688
parent 500037 37d35eb8428123975a589ae2068d733f35d48cd0
child 500039 daf3e491e6fff54278e1564b7b7c25f115076e1c
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1498860, 13543
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/base/nsGlobalWindowInner.h
dom/webidl/Window.webidl
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -811,16 +811,29 @@ public:
   {
     return GetScrollX(aError);
   }
   double GetScrollY(mozilla::ErrorResult& aError);
   double GetPageYOffset(mozilla::ErrorResult& aError)
   {
     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<JS::Value> aValue,
                   mozilla::dom::CallerType aCallerType,
                   mozilla::ErrorResult& aError);
   void SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
                   mozilla::dom::CallerType aCallerType,
                   mozilla::ErrorResult& aError);
   void GetScreenY(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
                   mozilla::dom::CallerType aCallerType,
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -183,16 +183,20 @@ partial interface Window {
   [ChromeOnly] void mozScrollSnap();
   // The four properties below are double per spec at the moment, but whether
   // that will continue is unclear.
   [Replaceable, Throws] readonly attribute double scrollX;
   [Replaceable, Throws] readonly attribute double pageXOffset;
   [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
   // like a [Replaceable] attribute would, which needs the original JS value.
   //[Replaceable, Throws] readonly attribute double screenX;
   //[Replaceable, Throws] readonly attribute double screenY;
   //[Replaceable, Throws] readonly attribute double outerWidth;
   //[Replaceable, Throws] readonly attribute double outerHeight;