зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1563504: Implement DOMPoint matrixTransform() r=bzbarsky
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=619248c60ce6a3f432c13abe7e7bc5bbf03c4184 (7 unexpected passes in wpt8 here have been removed) Differential Revision: https://phabricator.services.mozilla.com/D36915 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2487eaaf06
Коммит
76dc4579b9
|
@ -147,19 +147,26 @@ void DOMMatrixReadOnly::SetDataFromMatrixInit(DOMMatrixInit& aMatrixInit) {
|
|||
}
|
||||
|
||||
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromMatrix(
|
||||
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
|
||||
ErrorResult& aRv) {
|
||||
nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv) {
|
||||
DOMMatrixInit matrixInit(aMatrixInit);
|
||||
if (!ValidateAndFixupMatrixInit(matrixInit, aRv)) {
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
RefPtr<DOMMatrixReadOnly> rval =
|
||||
new DOMMatrixReadOnly(aGlobal.GetAsSupports(), matrixInit.mIs2D.Value());
|
||||
new DOMMatrixReadOnly(aParent, matrixInit.mIs2D.Value());
|
||||
rval->SetDataFromMatrixInit(matrixInit);
|
||||
return rval.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromMatrix(
|
||||
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
|
||||
ErrorResult& aRv) {
|
||||
RefPtr<DOMMatrixReadOnly> matrix =
|
||||
FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat32Array(
|
||||
const GlobalObject& aGlobal, const Float32Array& aArray32,
|
||||
ErrorResult& aRv) {
|
||||
|
|
|
@ -56,6 +56,9 @@ class DOMMatrixReadOnly : public nsWrapperCache {
|
|||
virtual JSObject* WrapObject(JSContext* cx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
static already_AddRefed<DOMMatrixReadOnly> FromMatrix(
|
||||
nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<DOMMatrixReadOnly> FromMatrix(
|
||||
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
|
||||
ErrorResult& aRv);
|
||||
|
|
|
@ -37,6 +37,22 @@ JSObject* DOMPointReadOnly::WrapObject(JSContext* aCx,
|
|||
return DOMPointReadOnly_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMPoint> DOMPointReadOnly::MatrixTransform(
|
||||
const DOMMatrixInit& aInit, ErrorResult& aRv) {
|
||||
RefPtr<DOMMatrixReadOnly> matrix =
|
||||
DOMMatrixReadOnly::FromMatrix(mParent, aInit, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
DOMPointInit init;
|
||||
init.mX = this->mX;
|
||||
init.mY = this->mY;
|
||||
init.mZ = this->mZ;
|
||||
init.mW = this->mW;
|
||||
RefPtr<DOMPoint> point = matrix->TransformPoint(init);
|
||||
return point.forget();
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#structured-serialization
|
||||
bool DOMPointReadOnly::WriteStructuredClone(
|
||||
JSContext* aCx, JSStructuredCloneWriter* aWriter) const {
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace dom {
|
|||
|
||||
class GlobalObject;
|
||||
struct DOMPointInit;
|
||||
struct DOMMatrixInit;
|
||||
|
||||
class DOMPointReadOnly : public nsWrapperCache {
|
||||
public:
|
||||
|
@ -44,6 +45,9 @@ class DOMPointReadOnly : public nsWrapperCache {
|
|||
double Z() const { return mZ; }
|
||||
double W() const { return mW; }
|
||||
|
||||
already_AddRefed<DOMPoint> MatrixTransform(const DOMMatrixInit& aInit,
|
||||
ErrorResult& aRv);
|
||||
|
||||
nsISupports* GetParentObject() const { return mParent; }
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
|
|
@ -21,7 +21,9 @@ interface DOMPointReadOnly {
|
|||
readonly attribute unrestricted double x;
|
||||
readonly attribute unrestricted double y;
|
||||
readonly attribute unrestricted double z;
|
||||
readonly attribute unrestricted double w;
|
||||
readonly attribute unrestricted double w;
|
||||
|
||||
[NewObject, Throws] DOMPoint matrixTransform(optional DOMMatrixInit matrix = {});
|
||||
|
||||
[Default] object toJSON();
|
||||
};
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[DOMPoint-002.html]
|
||||
[test DOMPoint matrixTransform]
|
||||
expected: FAIL
|
||||
|
||||
[test DOMPointReadOnly matrixTransform]
|
||||
expected: FAIL
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[historical.html]
|
||||
[DOMPointReadOnly matrixTransform number of required arguments]
|
||||
expected: FAIL
|
|
@ -1,25 +1,9 @@
|
|||
[interfaces.html]
|
||||
[DOMPointReadOnly interface: operation matrixTransform(DOMMatrixInit)]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
|
||||
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
|
||||
|
||||
[DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPoint() with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[DOMRect interface: legacy window alias]
|
||||
expected: FAIL
|
||||
|
||||
[DOMMatrix interface: legacy window alias]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
[interfaces.worker.html]
|
||||
[DOMPointReadOnly interface: operation matrixTransform(DOMMatrixInit)]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: new DOMPointReadOnly() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPointReadOnly() with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPoint() with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
|
@ -1,7 +1,3 @@
|
|||
[spec-examples.html]
|
||||
[matrixTransform]
|
||||
expected: FAIL
|
||||
|
||||
[DOMMatrix NaN]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче