summaryrefslogtreecommitdiff
path: root/dom/base/DOMMatrix.h
diff options
context:
space:
mode:
authorJob Bautista <jobbautista9@aol.com>2023-05-12 15:42:46 +0800
committerJob Bautista <jobbautista9@aol.com>2023-05-12 16:26:06 +0800
commitb2889d844f8c2f826100588b23b741f73e96cbbc (patch)
treee14cb0225f044641194ce5f09839af9aba2a434e /dom/base/DOMMatrix.h
parentfdfe7a8245eb33db252f2a9a3474ac931f15a7d8 (diff)
downloaduxp-b2889d844f8c2f826100588b23b741f73e96cbbc.tar.gz
Issue #2241 - Part 6: Implement DOMMatrix.fromMatrix.
Also fixes .multiply() to use DOMMatrixInit. Backported from Mozilla bug 1560462.
Diffstat (limited to 'dom/base/DOMMatrix.h')
-rw-r--r--dom/base/DOMMatrix.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/dom/base/DOMMatrix.h b/dom/base/DOMMatrix.h
index fe1325c594..9bbdef688f 100644
--- a/dom/base/DOMMatrix.h
+++ b/dom/base/DOMMatrix.h
@@ -25,6 +25,7 @@ class DOMMatrix;
class DOMPoint;
class StringOrUnrestrictedDoubleSequence;
struct DOMPointInit;
+struct DOMMatrixInit;
class DOMMatrixReadOnly : public nsWrapperCache
{
@@ -57,6 +58,9 @@ public:
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<DOMMatrixReadOnly>
+ FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
+
+ static already_AddRefed<DOMMatrixReadOnly>
Constructor(const GlobalObject& aGlobal, const Optional<StringOrUnrestrictedDoubleSequence>& aArg, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly>
@@ -180,7 +184,8 @@ public:
double aAngle) const;
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> Multiply(const DOMMatrixInit& aOther,
+ ErrorResult& aRv) const;
already_AddRefed<DOMMatrix> FlipX() const;
already_AddRefed<DOMMatrix> FlipY() const;
already_AddRefed<DOMMatrix> Inverse() const;
@@ -204,6 +209,13 @@ protected:
virtual ~DOMMatrixReadOnly() {}
+ /**
+ * Sets data from a fully validated and fixed-up matrix init,
+ * where all of its members are properly defined.
+ * The init dictionary's dimension must match the matrix one.
+ */
+ void SetDataFromMatrixInit(DOMMatrixInit& aMatrixInit);
+
DOMMatrixReadOnly* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
void Ensure3DMatrix();
@@ -237,6 +249,11 @@ public:
{}
static already_AddRefed<DOMMatrix>
+ FromMatrix(nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
+ static already_AddRefed<DOMMatrix>
+ FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
+
+ static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv);
@@ -254,8 +271,8 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
- DOMMatrix* MultiplySelf(const DOMMatrix& aOther);
- DOMMatrix* PreMultiplySelf(const DOMMatrix& aOther);
+ DOMMatrix* MultiplySelf(const DOMMatrixInit& aOther, ErrorResult& aRv);
+ DOMMatrix* PreMultiplySelf(const DOMMatrixInit& aOther, ErrorResult& aRv);
DOMMatrix* TranslateSelf(double aTx,
double aTy,
double aTz = 0);