Bug 1408310 - Part 3: Replace DOMMatrixReadOnly::Identity with IsIdentity. draft
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 21 Nov 2017 16:44:49 +0800
changeset 703606 06c7a1137de1756b79716bf008d46741d3b5dc74
parent 703605 66aa5e059b169091b5d8dac33bbbae390b8a4957
child 703607 50ef50b6abd05a753e5d6432e89341d8d56c0d9d
push id90886
push userbmo:boris.chiou@gmail.com
push dateMon, 27 Nov 2017 07:09:53 +0000
bugs1408310
milestone59.0a1
Bug 1408310 - Part 3: Replace DOMMatrixReadOnly::Identity with IsIdentity. According to the spec: https://drafts.fxtf.org/geometry/#dommatrixreadonly, we should use IsIdentity(), to pass most of the test cases. MozReview-Commit-ID: 7qBAmuxwhUn
dom/base/DOMMatrix.cpp
dom/base/DOMMatrix.h
dom/webidl/DOMMatrix.webidl
testing/web-platform/meta/css/geometry/DOMMatrix-001.html.ini
testing/web-platform/meta/css/geometry/interfaces.html.ini
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -180,17 +180,17 @@ DOMMatrixReadOnly::Inverse() const
 
 bool
 DOMMatrixReadOnly::Is2D() const
 {
   return !mMatrix3D;
 }
 
 bool
-DOMMatrixReadOnly::Identity() const
+DOMMatrixReadOnly::IsIdentity() const
 {
   if (mMatrix3D) {
     return mMatrix3D->IsIdentity();
   }
 
   return mMatrix2D->IsIdentity();
 }
 
@@ -430,17 +430,17 @@ void DOMMatrix::Ensure3DMatrix()
     mMatrix3D = new gfx::Matrix4x4(gfx::Matrix4x4::From2D(*mMatrix2D));
     mMatrix2D = nullptr;
   }
 }
 
 DOMMatrix*
 DOMMatrix::MultiplySelf(const DOMMatrix& aOther)
 {
-  if (aOther.Identity()) {
+  if (aOther.IsIdentity()) {
     return this;
   }
 
   if (aOther.Is2D()) {
     if (mMatrix3D) {
       *mMatrix3D = gfx::Matrix4x4::From2D(*aOther.mMatrix2D) * *mMatrix3D;
     } else {
       *mMatrix2D = *aOther.mMatrix2D * *mMatrix2D;
@@ -451,17 +451,17 @@ DOMMatrix::MultiplySelf(const DOMMatrix&
   }
 
   return this;
 }
 
 DOMMatrix*
 DOMMatrix::PreMultiplySelf(const DOMMatrix& aOther)
 {
-  if (aOther.Identity()) {
+  if (aOther.IsIdentity()) {
     return this;
   }
 
   if (aOther.Is2D()) {
     if (mMatrix3D) {
       *mMatrix3D = *mMatrix3D * gfx::Matrix4x4::From2D(*aOther.mMatrix2D);
     } else {
       *mMatrix2D = *mMatrix2D * *aOther.mMatrix2D;
--- a/dom/base/DOMMatrix.h
+++ b/dom/base/DOMMatrix.h
@@ -123,17 +123,17 @@ public:
   already_AddRefed<DOMMatrix> SkewX(double aSx) const;
   already_AddRefed<DOMMatrix> SkewY(double aSy) const;
   already_AddRefed<DOMMatrix> Multiply(const DOMMatrix& aOther) const;
   already_AddRefed<DOMMatrix> FlipX() const;
   already_AddRefed<DOMMatrix> FlipY() const;
   already_AddRefed<DOMMatrix> Inverse() const;
 
   bool                        Is2D() const;
-  bool                        Identity() const;
+  bool                        IsIdentity() const;
   already_AddRefed<DOMPoint>  TransformPoint(const DOMPointInit& aPoint) const;
   void                        ToFloat32Array(JSContext* aCx,
                                              JS::MutableHandle<JSObject*> aResult,
                                              ErrorResult& aRv) const;
   void                        ToFloat64Array(JSContext* aCx,
                                              JS::MutableHandle<JSObject*> aResult,
                                              ErrorResult& aRv) const;
   void                        Stringify(nsAString& aResult);
--- a/dom/webidl/DOMMatrix.webidl
+++ b/dom/webidl/DOMMatrix.webidl
@@ -67,17 +67,17 @@ interface DOMMatrixReadOnly {
     DOMMatrix skewY(unrestricted double sy);
     DOMMatrix multiply(DOMMatrix other);
     DOMMatrix flipX();
     DOMMatrix flipY();
     DOMMatrix inverse();
 
     // Helper methods
     readonly attribute boolean is2D;
-    readonly attribute boolean identity;
+    readonly attribute boolean isIdentity;
     DOMPoint                   transformPoint(optional DOMPointInit point);
     [Throws] Float32Array      toFloat32Array();
     [Throws] Float64Array      toFloat64Array();
                                stringifier;
 };
 
 [Pref="layout.css.DOMMatrix.enabled",
  Constructor,
--- a/testing/web-platform/meta/css/geometry/DOMMatrix-001.html.ini
+++ b/testing/web-platform/meta/css/geometry/DOMMatrix-001.html.ini
@@ -34,67 +34,28 @@
     expected: FAIL
 
   [testConstructor12]
     expected: FAIL
 
   [testConstructor13]
     expected: FAIL
 
-  [new DOMMatrix()]
-    expected: FAIL
-
   [new DOMMatrix(undefined)]
     expected: FAIL
 
-  [new DOMMatrix(new DOMMatrix())]
-    expected: FAIL
-
-  [new DOMMatrix("none")]
-    expected: FAIL
-
-  [new DOMMatrix(" none")]
-    expected: FAIL
-
-  [new DOMMatrix("none ")]
-    expected: FAIL
-
-  [new DOMMatrix("NONE")]
-    expected: FAIL
-
-  [new DOMMatrix("none/**/")]
-    expected: FAIL
-
-  [new DOMMatrix("/**/none")]
-    expected: FAIL
-
-  [new DOMMatrix("")]
-    expected: FAIL
-
   [new DOMMatrix(float32Array) 16 elements]
     expected: FAIL
 
-  [new DOMMatrix(float32Array) 6 elements]
-    expected: FAIL
-
   [new DOMMatrix(float64Array) 16 elements]
     expected: FAIL
 
-  [new DOMMatrix((float64Array) 6 elements]
-    expected: FAIL
-
   [new DOMMatrix(sequence) 16 elements]
     expected: FAIL
 
-  [new DOMMatrix(sequence) 6 elements]
-    expected: FAIL
-
-  [new DOMMatrix("scale(2) translateX(5px) translateY(5px)")]
-    expected: FAIL
-
   [new DOMMatrix(sequence)]
     expected: FAIL
 
   [new DOMMatrix(matrix)]
     expected: FAIL
 
   [new DOMMatrix(sequence) 17 elements]
     expected: FAIL
@@ -235,22 +196,16 @@
     expected: FAIL
 
   [new DOMMatrixReadOnly(matrix)]
     expected: FAIL
 
   [new DOMMatrixReadOnly("scale(2, 2), translateX(5px) translateY(5px)")]
     expected: FAIL
 
-  [new DOMMatrix("scale(2, 2) translateX(5px) translateY(5px)")]
-    expected: FAIL
-
-  [new DOMMatrix("scale(2)translateX(5px)translateY(5px)")]
-    expected: FAIL
-
   [new DOMMatrix("scale(2) translateX(calc(2 * 2.5px)) translateY(5px)")]
     expected: FAIL
 
   [new DOMMatrix("scale(2) translateX(5px) translateY(5px) rotate(5deg) rotate(-5deg)")]
     expected: FAIL
 
   [new DOMMatrixReadOnly("scale(2, 2) translateX(5px) translateY(5px)")]
     expected: FAIL
--- a/testing/web-platform/meta/css/geometry/interfaces.html.ini
+++ b/testing/web-platform/meta/css/geometry/interfaces.html.ini
@@ -109,19 +109,16 @@
     expected: FAIL
 
   [DOMMatrixReadOnly interface: operation fromFloat32Array(Float32Array)]
     expected: FAIL
 
   [DOMMatrixReadOnly interface: operation fromFloat64Array(Float64Array)]
     expected: FAIL
 
-  [DOMMatrixReadOnly interface: attribute isIdentity]
-    expected: FAIL
-
   [DOMMatrixReadOnly interface: operation translate(unrestricted double,unrestricted double,unrestricted double)]
     expected: FAIL
 
   [DOMMatrixReadOnly interface: operation scale(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double)]
     expected: FAIL
 
   [DOMMatrixReadOnly interface: operation scale3d(unrestricted double,unrestricted double,unrestricted double,unrestricted double)]
     expected: FAIL
@@ -1264,19 +1261,16 @@
     expected: FAIL
 
   [DOMMatrixReadOnly interface: calling fromFloat32Array(Float32Array) on new DOMMatrix() with too few arguments must throw TypeError]
     expected: FAIL
 
   [DOMMatrixReadOnly interface: calling fromFloat64Array(Float64Array) on new DOMMatrix() with too few arguments must throw TypeError]
     expected: FAIL
 
-  [DOMMatrixReadOnly interface: new DOMMatrix() must inherit property "isIdentity" with the proper type]
-    expected: FAIL
-
   [DOMMatrix interface: DOMMatrix.fromMatrix({is2D: false}) must inherit property "fromMatrix(DOMMatrixInit)" with the proper type]
     expected: FAIL
 
   [DOMMatrix interface: DOMMatrix.fromMatrix({is2D: false}) must inherit property "fromFloat32Array(Float32Array)" with the proper type]
     expected: FAIL
 
   [DOMMatrix interface: DOMMatrix.fromMatrix({is2D: false}) must inherit property "fromFloat64Array(Float64Array)" with the proper type]
     expected: FAIL