Bug 1186265 - Update DOMPointReadOnly to the most recent spec. r=bz
☠☠ backed out by 50aeb30fd283 ☠ ☠
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 30 Mar 2018 10:55:40 -0700
changeset 467450 2ba85ec7c9daf168c55c6240617720583f31cde4
parent 467449 f3a0b2686f45f6d3300901a78e5a770b79f93005
child 467451 d8986aead3e05be3a7f15252c098e7da173c42aa
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1186265
milestone61.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 1186265 - Update DOMPointReadOnly to the most recent spec. r=bz The most recent specification gives DOMPointReadOnly a constructor as well as a static fromPoint method. This fixes several failing wpt tests. MozReview-Commit-ID: 4mPhMm5yhJA
dom/base/DOMPoint.cpp
dom/base/DOMPoint.h
dom/bindings/Bindings.conf
dom/webidl/DOMPoint.webidl
testing/web-platform/meta/css/geometry/DOMMatrix-003.html.ini
testing/web-platform/meta/css/geometry/DOMPoint-002.html.ini
testing/web-platform/meta/css/geometry/interfaces.html.ini
--- a/dom/base/DOMPoint.cpp
+++ b/dom/base/DOMPoint.cpp
@@ -12,16 +12,40 @@
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMPointReadOnly, mParent)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMPointReadOnly, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMPointReadOnly, Release)
 
+already_AddRefed<DOMPointReadOnly>
+DOMPointReadOnly::FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams)
+{
+  RefPtr<DOMPointReadOnly> obj =
+    new DOMPointReadOnly(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
+                         aParams.mZ, aParams.mW);
+  return obj.forget();
+}
+
+already_AddRefed<DOMPointReadOnly>
+DOMPointReadOnly::Constructor(const GlobalObject& aGlobal, double aX, double aY,
+                              double aZ, double aW, ErrorResult& aRV)
+{
+  RefPtr<DOMPointReadOnly> obj =
+    new DOMPointReadOnly(aGlobal.GetAsSupports(), aX, aY, aZ, aW);
+  return obj.forget();
+}
+
+JSObject*
+DOMPointReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+  return DOMPointReadOnlyBinding::Wrap(aCx, this, aGivenProto);
+}
+
 already_AddRefed<DOMPoint>
 DOMPoint::FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams)
 {
   RefPtr<DOMPoint> obj =
     new DOMPoint(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
                  aParams.mZ, aParams.mW);
   return obj.forget();
 }
--- a/dom/base/DOMPoint.h
+++ b/dom/base/DOMPoint.h
@@ -29,24 +29,33 @@ public:
     : mParent(aParent)
     , mX(aX)
     , mY(aY)
     , mZ(aZ)
     , mW(aW)
   {
   }
 
+  static already_AddRefed<DOMPointReadOnly>
+  FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
+  static already_AddRefed<DOMPointReadOnly>
+  Constructor(const GlobalObject& aGlobal, double aX, double aY,
+              double aZ, double aW, ErrorResult& aRV);
+
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMPointReadOnly)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPointReadOnly)
 
   double X() const { return mX; }
   double Y() const { return mY; }
   double Z() const { return mZ; }
   double W() const { return mW; }
 
+  nsISupports* GetParentObject() const { return mParent; }
+  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
 protected:
   virtual ~DOMPointReadOnly() {}
 
   nsCOMPtr<nsISupports> mParent;
   double mX, mY, mZ, mW;
 };
 
 class DOMPoint final : public DOMPointReadOnly
@@ -58,17 +67,16 @@ public:
   {}
 
   static already_AddRefed<DOMPoint>
   FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
   static already_AddRefed<DOMPoint>
   Constructor(const GlobalObject& aGlobal, double aX, double aY,
               double aZ, double aW, ErrorResult& aRV);
 
-  nsISupports* GetParentObject() const { return mParent; }
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   void SetX(double aX) { mX = aX; }
   void SetY(double aY) { mY = aY; }
   void SetZ(double aZ) { mZ = aZ; }
   void SetW(double aW) { mW = aW; }
 };
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -259,17 +259,16 @@ DOMInterfaces = {
 
 'DOMMatrixReadOnly': {
     'headerFile': 'mozilla/dom/DOMMatrix.h',
     'concrete': False,
 },
 
 'DOMPointReadOnly': {
     'headerFile': 'mozilla/dom/DOMPoint.h',
-    'concrete': False,
 },
 
 'DOMRectList': {
     'headerFile': 'mozilla/dom/DOMRect.h',
 },
 
 'DOMRectReadOnly': {
     'headerFile': 'mozilla/dom/DOMRect.h',
--- a/dom/webidl/DOMPoint.webidl
+++ b/dom/webidl/DOMPoint.webidl
@@ -5,26 +5,32 @@
  *
  * The origin of this IDL file is
  * http://dev.w3.org/fxtf/geometry/
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[Pref="layout.css.DOMPoint.enabled"]
+[Pref="layout.css.DOMPoint.enabled",
+ Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+             optional unrestricted double z = 0, optional unrestricted double w = 1)]
 interface DOMPointReadOnly {
+    [NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other);
+
     readonly attribute unrestricted double x;
     readonly attribute unrestricted double y;
     readonly attribute unrestricted double z;
     readonly attribute unrestricted double w; 
+
+    jsonifier;
 };
 
 [Pref="layout.css.DOMPoint.enabled",
- Constructor(unrestricted double x, unrestricted double y,
+ Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
              optional unrestricted double z = 0, optional unrestricted double w = 1)]
 interface DOMPoint : DOMPointReadOnly {
     [NewObject] static DOMPoint fromPoint(optional DOMPointInit other);
 
     inherit attribute unrestricted double x;
     inherit attribute unrestricted double y;
     inherit attribute unrestricted double z;
     inherit attribute unrestricted double w;
--- a/testing/web-platform/meta/css/geometry/DOMMatrix-003.html.ini
+++ b/testing/web-platform/meta/css/geometry/DOMMatrix-003.html.ini
@@ -32,15 +32,8 @@
   [test multiply with inverse is identity]
     expected: FAIL
 
   [test flipX()]
     expected: FAIL
 
   [test flipY()]
     expected: FAIL
-
-  [test transformPoint() - 2d matrix]
-    expected: FAIL
-
-  [test transformPoint() - 3d matrix]
-    expected: FAIL
-
--- a/testing/web-platform/meta/css/geometry/DOMPoint-002.html.ini
+++ b/testing/web-platform/meta/css/geometry/DOMPoint-002.html.ini
@@ -1,94 +1,6 @@
 [DOMPoint-002.html]
-  [test DOMPoint Constructor one args]
-    expected: FAIL
-
-  [test DOMPoint Constructor with undefined]
-    expected: FAIL
-
-  [test DOMPoint Constructor with empty object]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with empty object]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x, y]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x, y, z]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x, y, z, w]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x, y, z, w, v]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with x, z]
-    expected: FAIL
-
-  [test DOMPoint fromPoint with undefined value]
-    expected: FAIL
-
   [test DOMPoint matrixTransform]
     expected: FAIL
 
-  [test DOMPointReadOnly Constructor no args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor one args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor two args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor three args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor four args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor more then four args]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor with undefined]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor with string]
-    expected: FAIL
-
-  [test DOMPointReadOnly Constructor with object]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with empty object]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x, y]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x, y, z]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x, y, z, w]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x, y, z, w, v]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with x, z]
-    expected: FAIL
-
-  [test DOMPointReadOnly fromPoint with undefined value]
-    expected: FAIL
-
   [test DOMPointReadOnly matrixTransform]
     expected: FAIL
-
-  [test DOMPointReadOnly Attributes undefined]
-    expected: FAIL
-
--- a/testing/web-platform/meta/css/geometry/interfaces.html.ini
+++ b/testing/web-platform/meta/css/geometry/interfaces.html.ini
@@ -1,51 +1,21 @@
 [interfaces.html]
-  [DOMPointReadOnly interface: operation fromPoint(DOMPointInit)]
-    expected: FAIL
-
   [DOMPointReadOnly interface: operation matrixTransform(DOMMatrixInit)]
     expected: FAIL
 
-  [DOMPointReadOnly must be primary interface of new DOMPointReadOnly()]
-    expected: FAIL
-
-  [Stringification of new DOMPointReadOnly()]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "fromPoint" with the proper type (0)]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: calling fromPoint(DOMPointInit) on new DOMPointReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "x" with the proper type (1)]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "y" with the proper type (2)]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "z" with the proper type (3)]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "w" with the proper type (4)]
-    expected: FAIL
-
   [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "matrixTransform" with the proper type (5)]
     expected: FAIL
 
   [DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPointReadOnly() with too few arguments must throw TypeError]
     expected: FAIL
 
   [DOMPoint interface: legacy window alias]
     expected: FAIL
 
-  [DOMPoint interface: operation fromPoint(DOMPointInit)]
-    expected: FAIL
-
   [DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform" with the proper type (5)]
     expected: FAIL
 
   [DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPoint() with too few arguments must throw TypeError]
     expected: FAIL
 
   [DOMRectReadOnly interface: operation fromRect(DOMRectInit)]
     expected: FAIL
@@ -849,40 +819,19 @@
     expected: FAIL
 
   [DOMMatrixReadOnly interface: DOMMatrix.fromMatrix({is2D: false}) must inherit property "toFloat64Array" with the proper type (41)]
     expected: FAIL
 
   [Stringification of [object DOMRect\]]
     expected: FAIL
 
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "fromPoint(DOMPointInit)" with the proper type]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "x" with the proper type]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "y" with the proper type]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "z" with the proper type]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "w" with the proper type]
-    expected: FAIL
-
   [DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
     expected: FAIL
 
-  [DOMPoint interface: calling fromPoint(DOMPointInit) on new DOMPoint() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMPointReadOnly interface: calling fromPoint(DOMPointInit) on new DOMPoint() with too few arguments must throw TypeError]
-    expected: FAIL
-
   [DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
     expected: FAIL
 
   [DOMRectReadOnly interface: new DOMRectReadOnly() must inherit property "fromRect(DOMRectInit)" with the proper type]
     expected: FAIL
 
   [DOMRectReadOnly interface: new DOMRectReadOnly() must inherit property "x" with the proper type]
     expected: FAIL