mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 00:57:30 +09:00
Issue #2241 - Part 4.1: Get DOMPoint, DOMQuad, DOMRect, DOMMatrix a bit closer to spec.
Backported from Mozilla bug 1186265's part 1.
This commit is contained in:
parent
d2c3ea08eb
commit
60c88dd11b
14 changed files with 252 additions and 198 deletions
|
|
@ -20,6 +20,10 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static void
|
||||||
|
SetDataInMatrix(DOMMatrixReadOnly* aMatrix, const T* aData, int aLength, ErrorResult& aRv);
|
||||||
|
|
||||||
static const double radPerDegree = 2.0 * M_PI / 360.0;
|
static const double radPerDegree = 2.0 * M_PI / 360.0;
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMMatrixReadOnly, mParent)
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMMatrixReadOnly, mParent)
|
||||||
|
|
@ -27,6 +31,39 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMMatrixReadOnly, mParent)
|
||||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMMatrixReadOnly, AddRef)
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMMatrixReadOnly, AddRef)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMMatrixReadOnly, Release)
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMMatrixReadOnly, Release)
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
DOMMatrixReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
|
{
|
||||||
|
return DOMMatrixReadOnlyBinding::Wrap(aCx, this, aGivenProto);
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMMatrixReadOnly>
|
||||||
|
DOMMatrixReadOnly::Constructor(
|
||||||
|
const GlobalObject& aGlobal,
|
||||||
|
const Optional<StringOrUnrestrictedDoubleSequence>& aArg,
|
||||||
|
ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
RefPtr<DOMMatrixReadOnly> rval = new DOMMatrixReadOnly(aGlobal.GetAsSupports());
|
||||||
|
if (!aArg.WasPassed()) {
|
||||||
|
return rval.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& arg = aArg.Value();
|
||||||
|
if (arg.IsString()) {
|
||||||
|
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
|
||||||
|
if (!win) {
|
||||||
|
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
rval->SetMatrixValue(arg.GetAsString(), aRv);
|
||||||
|
} else {
|
||||||
|
const auto& sequence = arg.GetAsUnrestrictedDoubleSequence();
|
||||||
|
SetDataInMatrix(rval, sequence.Elements(), sequence.Length(), aRv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval.forget();
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMMatrix>
|
already_AddRefed<DOMMatrix>
|
||||||
DOMMatrixReadOnly::Translate(double aTx,
|
DOMMatrixReadOnly::Translate(double aTx,
|
||||||
double aTy,
|
double aTy,
|
||||||
|
|
@ -330,7 +367,9 @@ DOMMatrix::Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOt
|
||||||
return obj.forget();
|
return obj.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> void SetDataInMatrix(DOMMatrix* aMatrix, const T* aData, int aLength, ErrorResult& aRv)
|
template <typename T>
|
||||||
|
static void
|
||||||
|
SetDataInMatrix(DOMMatrixReadOnly* aMatrix, const T* aData, int aLength, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (aLength == 16) {
|
if (aLength == 16) {
|
||||||
aMatrix->SetM11(aData[0]);
|
aMatrix->SetM11(aData[0]);
|
||||||
|
|
@ -357,7 +396,9 @@ template <typename T> void SetDataInMatrix(DOMMatrix* aMatrix, const T* aData, i
|
||||||
aMatrix->SetE(aData[4]);
|
aMatrix->SetE(aData[4]);
|
||||||
aMatrix->SetF(aData[5]);
|
aMatrix->SetF(aData[5]);
|
||||||
} else {
|
} else {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
nsAutoString lengthStr;
|
||||||
|
lengthStr.AppendInt(aLength);
|
||||||
|
aRv.ThrowTypeError<MSG_MATRIX_INIT_LENGTH_WRONG>(lengthStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -390,7 +431,8 @@ DOMMatrix::Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNum
|
||||||
return obj.forget();
|
return obj.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DOMMatrix::Ensure3DMatrix()
|
void
|
||||||
|
DOMMatrixReadOnly::Ensure3DMatrix()
|
||||||
{
|
{
|
||||||
if (!mMatrix3D) {
|
if (!mMatrix3D) {
|
||||||
mMatrix3D = new gfx::Matrix4x4(gfx::Matrix4x4::From2D(*mMatrix2D));
|
mMatrix3D = new gfx::Matrix4x4(gfx::Matrix4x4::From2D(*mMatrix2D));
|
||||||
|
|
@ -617,8 +659,8 @@ DOMMatrix::InvertSelf()
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
DOMMatrix*
|
DOMMatrixReadOnly*
|
||||||
DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
DOMMatrixReadOnly::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
SVGTransformListParser parser(aTransformList);
|
SVGTransformListParser parser(aTransformList);
|
||||||
if (!parser.Parse()) {
|
if (!parser.Parse()) {
|
||||||
|
|
@ -644,6 +686,13 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DOMMatrix*
|
||||||
|
DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
DOMMatrixReadOnly::SetMatrixValue(aTransformList, aRv);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
DOMMatrix::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
DOMMatrix::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ namespace dom {
|
||||||
class GlobalObject;
|
class GlobalObject;
|
||||||
class DOMMatrix;
|
class DOMMatrix;
|
||||||
class DOMPoint;
|
class DOMPoint;
|
||||||
|
class StringOrUnrestrictedDoubleSequence;
|
||||||
struct DOMPointInit;
|
struct DOMPointInit;
|
||||||
|
|
||||||
class DOMMatrixReadOnly : public nsWrapperCache
|
class DOMMatrixReadOnly : public nsWrapperCache
|
||||||
|
|
@ -51,6 +52,12 @@ public:
|
||||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMMatrixReadOnly)
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMMatrixReadOnly)
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMMatrixReadOnly)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMMatrixReadOnly)
|
||||||
|
|
||||||
|
nsISupports* GetParentObject() const { return mParent; }
|
||||||
|
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
|
static already_AddRefed<DOMMatrixReadOnly>
|
||||||
|
Constructor(const GlobalObject& aGlobal, const Optional<StringOrUnrestrictedDoubleSequence>& aArg, ErrorResult& aRv);
|
||||||
|
|
||||||
#define GetMatrixMember(entry2D, entry3D, default) \
|
#define GetMatrixMember(entry2D, entry3D, default) \
|
||||||
{ \
|
{ \
|
||||||
if (mMatrix3D) { \
|
if (mMatrix3D) { \
|
||||||
|
|
@ -94,6 +101,51 @@ public:
|
||||||
#undef GetMatrixMember
|
#undef GetMatrixMember
|
||||||
#undef Get3DMatrixMember
|
#undef Get3DMatrixMember
|
||||||
|
|
||||||
|
// Defined here so we can construct DOMMatrixReadOnly objects.
|
||||||
|
#define Set2DMatrixMember(entry2D, entry3D) \
|
||||||
|
{ \
|
||||||
|
if (mMatrix3D) { \
|
||||||
|
mMatrix3D->entry3D = v; \
|
||||||
|
} else { \
|
||||||
|
mMatrix2D->entry2D = v; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define Set3DMatrixMember(entry3D, default) \
|
||||||
|
{ \
|
||||||
|
if (mMatrix3D || (v != default)) { \
|
||||||
|
Ensure3DMatrix(); \
|
||||||
|
mMatrix3D->entry3D = v; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetA(double v) Set2DMatrixMember(_11, _11)
|
||||||
|
void SetB(double v) Set2DMatrixMember(_12, _12)
|
||||||
|
void SetC(double v) Set2DMatrixMember(_21, _21)
|
||||||
|
void SetD(double v) Set2DMatrixMember(_22, _22)
|
||||||
|
void SetE(double v) Set2DMatrixMember(_31, _41)
|
||||||
|
void SetF(double v) Set2DMatrixMember(_32, _42)
|
||||||
|
|
||||||
|
void SetM11(double v) Set2DMatrixMember(_11, _11)
|
||||||
|
void SetM12(double v) Set2DMatrixMember(_12, _12)
|
||||||
|
void SetM13(double v) Set3DMatrixMember(_13, 0)
|
||||||
|
void SetM14(double v) Set3DMatrixMember(_14, 0)
|
||||||
|
void SetM21(double v) Set2DMatrixMember(_21, _21)
|
||||||
|
void SetM22(double v) Set2DMatrixMember(_22, _22)
|
||||||
|
void SetM23(double v) Set3DMatrixMember(_23, 0)
|
||||||
|
void SetM24(double v) Set3DMatrixMember(_24, 0)
|
||||||
|
void SetM31(double v) Set3DMatrixMember(_31, 0)
|
||||||
|
void SetM32(double v) Set3DMatrixMember(_32, 0)
|
||||||
|
void SetM33(double v) Set3DMatrixMember(_33, 1.0)
|
||||||
|
void SetM34(double v) Set3DMatrixMember(_34, 0)
|
||||||
|
void SetM41(double v) Set2DMatrixMember(_31, _41)
|
||||||
|
void SetM42(double v) Set2DMatrixMember(_32, _42)
|
||||||
|
void SetM43(double v) Set3DMatrixMember(_43, 0)
|
||||||
|
void SetM44(double v) Set3DMatrixMember(_44, 1.0)
|
||||||
|
|
||||||
|
#undef Set2DMatrixMember
|
||||||
|
#undef Set3DMatrixMember
|
||||||
|
|
||||||
already_AddRefed<DOMMatrix> Translate(double aTx,
|
already_AddRefed<DOMMatrix> Translate(double aTx,
|
||||||
double aTy,
|
double aTy,
|
||||||
double aTz = 0) const;
|
double aTz = 0) const;
|
||||||
|
|
@ -143,6 +195,9 @@ protected:
|
||||||
|
|
||||||
virtual ~DOMMatrixReadOnly() {}
|
virtual ~DOMMatrixReadOnly() {}
|
||||||
|
|
||||||
|
DOMMatrixReadOnly* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
|
||||||
|
void Ensure3DMatrix();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DOMMatrixReadOnly() = delete;
|
DOMMatrixReadOnly() = delete;
|
||||||
DOMMatrixReadOnly(const DOMMatrixReadOnly&) = delete;
|
DOMMatrixReadOnly(const DOMMatrixReadOnly&) = delete;
|
||||||
|
|
@ -177,53 +232,8 @@ public:
|
||||||
static already_AddRefed<DOMMatrix>
|
static already_AddRefed<DOMMatrix>
|
||||||
Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv);
|
Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv);
|
||||||
|
|
||||||
nsISupports* GetParentObject() const { return mParent; }
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
#define Set2DMatrixMember(entry2D, entry3D) \
|
|
||||||
{ \
|
|
||||||
if (mMatrix3D) { \
|
|
||||||
mMatrix3D->entry3D = v; \
|
|
||||||
} else { \
|
|
||||||
mMatrix2D->entry2D = v; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define Set3DMatrixMember(entry3D, default) \
|
|
||||||
{ \
|
|
||||||
if (mMatrix3D || (v != default)) { \
|
|
||||||
Ensure3DMatrix(); \
|
|
||||||
mMatrix3D->entry3D = v; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetA(double v) Set2DMatrixMember(_11, _11)
|
|
||||||
void SetB(double v) Set2DMatrixMember(_12, _12)
|
|
||||||
void SetC(double v) Set2DMatrixMember(_21, _21)
|
|
||||||
void SetD(double v) Set2DMatrixMember(_22, _22)
|
|
||||||
void SetE(double v) Set2DMatrixMember(_31, _41)
|
|
||||||
void SetF(double v) Set2DMatrixMember(_32, _42)
|
|
||||||
|
|
||||||
void SetM11(double v) Set2DMatrixMember(_11, _11)
|
|
||||||
void SetM12(double v) Set2DMatrixMember(_12, _12)
|
|
||||||
void SetM13(double v) Set3DMatrixMember(_13, 0)
|
|
||||||
void SetM14(double v) Set3DMatrixMember(_14, 0)
|
|
||||||
void SetM21(double v) Set2DMatrixMember(_21, _21)
|
|
||||||
void SetM22(double v) Set2DMatrixMember(_22, _22)
|
|
||||||
void SetM23(double v) Set3DMatrixMember(_23, 0)
|
|
||||||
void SetM24(double v) Set3DMatrixMember(_24, 0)
|
|
||||||
void SetM31(double v) Set3DMatrixMember(_31, 0)
|
|
||||||
void SetM32(double v) Set3DMatrixMember(_32, 0)
|
|
||||||
void SetM33(double v) Set3DMatrixMember(_33, 1.0)
|
|
||||||
void SetM34(double v) Set3DMatrixMember(_34, 0)
|
|
||||||
void SetM41(double v) Set2DMatrixMember(_31, _41)
|
|
||||||
void SetM42(double v) Set2DMatrixMember(_32, _42)
|
|
||||||
void SetM43(double v) Set3DMatrixMember(_43, 0)
|
|
||||||
void SetM44(double v) Set3DMatrixMember(_44, 1.0)
|
|
||||||
|
|
||||||
#undef Set2DMatrixMember
|
|
||||||
#undef Set3DMatrixMember
|
|
||||||
|
|
||||||
DOMMatrix* MultiplySelf(const DOMMatrix& aOther);
|
DOMMatrix* MultiplySelf(const DOMMatrix& aOther);
|
||||||
DOMMatrix* PreMultiplySelf(const DOMMatrix& aOther);
|
DOMMatrix* PreMultiplySelf(const DOMMatrix& aOther);
|
||||||
DOMMatrix* TranslateSelf(double aTx,
|
DOMMatrix* TranslateSelf(double aTx,
|
||||||
|
|
@ -255,8 +265,6 @@ public:
|
||||||
DOMMatrix* SkewYSelf(double aSy);
|
DOMMatrix* SkewYSelf(double aSy);
|
||||||
DOMMatrix* InvertSelf();
|
DOMMatrix* InvertSelf();
|
||||||
DOMMatrix* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
|
DOMMatrix* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
|
||||||
protected:
|
|
||||||
void Ensure3DMatrix();
|
|
||||||
|
|
||||||
virtual ~DOMMatrix() {}
|
virtual ~DOMMatrix() {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,32 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMPointReadOnly, mParent)
|
||||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMPointReadOnly, AddRef)
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMPointReadOnly, AddRef)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMPointReadOnly, Release)
|
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>
|
already_AddRefed<DOMPoint>
|
||||||
DOMPoint::Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams,
|
DOMPoint::FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams)
|
||||||
ErrorResult& aRV)
|
|
||||||
{
|
{
|
||||||
RefPtr<DOMPoint> obj =
|
RefPtr<DOMPoint> obj =
|
||||||
new DOMPoint(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
|
new DOMPoint(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,12 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMPointReadOnly)
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPointReadOnly)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPointReadOnly)
|
||||||
|
|
||||||
|
|
@ -41,6 +47,9 @@ public:
|
||||||
double Z() const { return mZ; }
|
double Z() const { return mZ; }
|
||||||
double W() const { return mW; }
|
double W() const { return mW; }
|
||||||
|
|
||||||
|
nsISupports* GetParentObject() const { return mParent; }
|
||||||
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DOMPointReadOnly() {}
|
virtual ~DOMPointReadOnly() {}
|
||||||
|
|
||||||
|
|
@ -57,13 +66,11 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static already_AddRefed<DOMPoint>
|
static already_AddRefed<DOMPoint>
|
||||||
Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams,
|
FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
|
||||||
ErrorResult& aRV);
|
|
||||||
static already_AddRefed<DOMPoint>
|
static already_AddRefed<DOMPoint>
|
||||||
Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
||||||
double aZ, double aW, ErrorResult& aRV);
|
double aZ, double aW, ErrorResult& aRV);
|
||||||
|
|
||||||
nsISupports* GetParentObject() const { return mParent; }
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
void SetX(double aX) { mX = aX; }
|
void SetX(double aX) { mX = aX; }
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMQuad, mParent, mBounds, mPoints[0],
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMQuad, mParent, mPoints[0],
|
||||||
mPoints[1], mPoints[2], mPoints[3])
|
mPoints[1], mPoints[2], mPoints[3])
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMQuad, AddRef)
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMQuad, AddRef)
|
||||||
|
|
@ -52,10 +52,10 @@ DOMQuad::Constructor(const GlobalObject& aGlobal,
|
||||||
ErrorResult& aRV)
|
ErrorResult& aRV)
|
||||||
{
|
{
|
||||||
RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
|
RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
|
||||||
obj->mPoints[0] = DOMPoint::Constructor(aGlobal, aP1, aRV);
|
obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aP1);
|
||||||
obj->mPoints[1] = DOMPoint::Constructor(aGlobal, aP2, aRV);
|
obj->mPoints[1] = DOMPoint::FromPoint(aGlobal, aP2);
|
||||||
obj->mPoints[2] = DOMPoint::Constructor(aGlobal, aP3, aRV);
|
obj->mPoints[2] = DOMPoint::FromPoint(aGlobal, aP3);
|
||||||
obj->mPoints[3] = DOMPoint::Constructor(aGlobal, aP4, aRV);
|
obj->mPoints[3] = DOMPoint::FromPoint(aGlobal, aP4);
|
||||||
return obj.forget();
|
return obj.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,87 +73,44 @@ DOMQuad::Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
|
||||||
return obj.forget();
|
return obj.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
class DOMQuad::QuadBounds final : public DOMRectReadOnly
|
void
|
||||||
|
DOMQuad::GetHorizontalMinMax(double* aX1, double* aX2) const
|
||||||
{
|
{
|
||||||
public:
|
double x1, x2;
|
||||||
explicit QuadBounds(DOMQuad* aQuad)
|
x1 = x2 = Point(0)->X();
|
||||||
: DOMRectReadOnly(aQuad->GetParentObject())
|
for (uint32_t i = 1; i < 4; ++i) {
|
||||||
, mQuad(aQuad)
|
double x = Point(i)->X();
|
||||||
{}
|
x1 = std::min(x1, x);
|
||||||
|
x2 = std::max(x2, x);
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(QuadBounds, DOMRectReadOnly)
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
|
||||||
|
|
||||||
virtual double X() const override
|
|
||||||
{
|
|
||||||
double x1, x2;
|
|
||||||
GetHorizontalMinMax(&x1, &x2);
|
|
||||||
return x1;
|
|
||||||
}
|
}
|
||||||
virtual double Y() const override
|
*aX1 = x1;
|
||||||
{
|
*aX2 = x2;
|
||||||
double y1, y2;
|
}
|
||||||
GetVerticalMinMax(&y1, &y2);
|
|
||||||
return y1;
|
void
|
||||||
}
|
DOMQuad::GetVerticalMinMax(double* aY1, double* aY2) const
|
||||||
virtual double Width() const override
|
{
|
||||||
{
|
double y1, y2;
|
||||||
double x1, x2;
|
y1 = y2 = Point(0)->Y();
|
||||||
GetHorizontalMinMax(&x1, &x2);
|
for (uint32_t i = 1; i < 4; ++i) {
|
||||||
return x2 - x1;
|
double y = Point(i)->Y();
|
||||||
}
|
y1 = std::min(y1, y);
|
||||||
virtual double Height() const override
|
y2 = std::max(y2, y);
|
||||||
{
|
}
|
||||||
double y1, y2;
|
*aY1 = y1;
|
||||||
GetVerticalMinMax(&y1, &y2);
|
*aY2 = y2;
|
||||||
return y2 - y1;
|
}
|
||||||
}
|
|
||||||
|
already_AddRefed<DOMRectReadOnly>
|
||||||
void GetHorizontalMinMax(double* aX1, double* aX2) const
|
DOMQuad::GetBounds() const
|
||||||
{
|
{
|
||||||
double x1, x2;
|
double x1, x2;
|
||||||
x1 = x2 = mQuad->Point(0)->X();
|
double y1, y2;
|
||||||
for (uint32_t i = 1; i < 4; ++i) {
|
|
||||||
double x = mQuad->Point(i)->X();
|
GetHorizontalMinMax(&x1, &x2);
|
||||||
x1 = std::min(x1, x);
|
GetVerticalMinMax(&y1, &y2);
|
||||||
x2 = std::max(x2, x);
|
|
||||||
}
|
RefPtr<DOMRectReadOnly> rval = new DOMRectReadOnly(GetParentObject(),
|
||||||
*aX1 = x1;
|
x1, y1, x2 - x1, y2 - y1);
|
||||||
*aX2 = x2;
|
return rval.forget();
|
||||||
}
|
|
||||||
|
|
||||||
void GetVerticalMinMax(double* aY1, double* aY2) const
|
|
||||||
{
|
|
||||||
double y1, y2;
|
|
||||||
y1 = y2 = mQuad->Point(0)->Y();
|
|
||||||
for (uint32_t i = 1; i < 4; ++i) {
|
|
||||||
double y = mQuad->Point(i)->Y();
|
|
||||||
y1 = std::min(y1, y);
|
|
||||||
y2 = std::max(y2, y);
|
|
||||||
}
|
|
||||||
*aY1 = y1;
|
|
||||||
*aY2 = y2;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~QuadBounds() {}
|
|
||||||
|
|
||||||
RefPtr<DOMQuad> mQuad;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly, mQuad)
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMQuad::QuadBounds)
|
|
||||||
NS_INTERFACE_MAP_END_INHERITING(DOMRectReadOnly)
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly)
|
|
||||||
NS_IMPL_RELEASE_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly)
|
|
||||||
|
|
||||||
DOMRectReadOnly*
|
|
||||||
DOMQuad::Bounds() const
|
|
||||||
{
|
|
||||||
if (!mBounds) {
|
|
||||||
mBounds = new QuadBounds(const_cast<DOMQuad*>(this));
|
|
||||||
}
|
|
||||||
return mBounds;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,20 +47,20 @@ public:
|
||||||
Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
|
Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
|
||||||
ErrorResult& aRV);
|
ErrorResult& aRV);
|
||||||
|
|
||||||
DOMRectReadOnly* Bounds() const;
|
already_AddRefed<DOMRectReadOnly> GetBounds() const;
|
||||||
DOMPoint* P1() const { return mPoints[0]; }
|
DOMPoint* P1() const { return mPoints[0]; }
|
||||||
DOMPoint* P2() const { return mPoints[1]; }
|
DOMPoint* P2() const { return mPoints[1]; }
|
||||||
DOMPoint* P3() const { return mPoints[2]; }
|
DOMPoint* P3() const { return mPoints[2]; }
|
||||||
DOMPoint* P4() const { return mPoints[3]; }
|
DOMPoint* P4() const { return mPoints[3]; }
|
||||||
|
|
||||||
DOMPoint* Point(uint32_t aIndex) { return mPoints[aIndex]; }
|
DOMPoint* Point(uint32_t aIndex) const { return mPoints[aIndex]; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class QuadBounds;
|
void GetHorizontalMinMax(double* aX1, double* aX2) const;
|
||||||
|
void GetVerticalMinMax(double* aY1, double* aY2) const;
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> mParent;
|
nsCOMPtr<nsISupports> mParent;
|
||||||
RefPtr<DOMPoint> mPoints[4];
|
RefPtr<DOMPoint> mPoints[4];
|
||||||
mutable RefPtr<QuadBounds> mBounds; // allocated lazily
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,15 @@ DOMRectReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
return DOMRectReadOnlyBinding::Wrap(aCx, this, aGivenProto);
|
return DOMRectReadOnlyBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMRectReadOnly>
|
||||||
|
DOMRectReadOnly::Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
||||||
|
double aWidth, double aHeight, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
RefPtr<DOMRectReadOnly> obj =
|
||||||
|
new DOMRectReadOnly(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
|
||||||
|
return obj.forget();
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED(DOMRect, DOMRectReadOnly, nsIDOMClientRect)
|
NS_IMPL_ISUPPORTS_INHERITED(DOMRect, DOMRectReadOnly, nsIDOMClientRect)
|
||||||
|
|
@ -53,17 +62,9 @@ DOMRect::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
return DOMRectBinding::Wrap(aCx, this, aGivenProto);
|
return DOMRectBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRect>
|
|
||||||
DOMRect::Constructor(const GlobalObject& aGlobal, ErrorResult& aRV)
|
|
||||||
{
|
|
||||||
RefPtr<DOMRect> obj =
|
|
||||||
new DOMRect(aGlobal.GetAsSupports(), 0.0, 0.0, 0.0, 0.0);
|
|
||||||
return obj.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<DOMRect>
|
already_AddRefed<DOMRect>
|
||||||
DOMRect::Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
DOMRect::Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
||||||
double aWidth, double aHeight, ErrorResult& aRV)
|
double aWidth, double aHeight, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
RefPtr<DOMRect> obj =
|
RefPtr<DOMRect> obj =
|
||||||
new DOMRect(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
|
new DOMRect(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,13 @@ public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectReadOnly)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectReadOnly)
|
||||||
|
|
||||||
explicit DOMRectReadOnly(nsISupports* aParent)
|
explicit DOMRectReadOnly(nsISupports* aParent, double aX = 0, double aY = 0,
|
||||||
|
double aWidth = 0, double aHeight = 0)
|
||||||
: mParent(aParent)
|
: mParent(aParent)
|
||||||
|
, mX(aX)
|
||||||
|
, mY(aY)
|
||||||
|
, mWidth(aWidth)
|
||||||
|
, mHeight(aHeight)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,10 +49,26 @@ public:
|
||||||
}
|
}
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
virtual double X() const = 0;
|
static already_AddRefed<DOMRectReadOnly>
|
||||||
virtual double Y() const = 0;
|
Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
||||||
virtual double Width() const = 0;
|
double aWidth, double aHeight, ErrorResult& aRv);
|
||||||
virtual double Height() const = 0;
|
|
||||||
|
double X() const
|
||||||
|
{
|
||||||
|
return mX;
|
||||||
|
}
|
||||||
|
double Y() const
|
||||||
|
{
|
||||||
|
return mY;
|
||||||
|
}
|
||||||
|
double Width() const
|
||||||
|
{
|
||||||
|
return mWidth;
|
||||||
|
}
|
||||||
|
double Height() const
|
||||||
|
{
|
||||||
|
return mHeight;
|
||||||
|
}
|
||||||
|
|
||||||
double Left() const
|
double Left() const
|
||||||
{
|
{
|
||||||
|
|
@ -72,6 +93,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsCOMPtr<nsISupports> mParent;
|
nsCOMPtr<nsISupports> mParent;
|
||||||
|
double mX, mY, mWidth, mHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DOMRect final : public DOMRectReadOnly
|
class DOMRect final : public DOMRectReadOnly
|
||||||
|
|
@ -80,22 +102,16 @@ class DOMRect final : public DOMRectReadOnly
|
||||||
public:
|
public:
|
||||||
explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0,
|
explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0,
|
||||||
double aWidth = 0, double aHeight = 0)
|
double aWidth = 0, double aHeight = 0)
|
||||||
: DOMRectReadOnly(aParent)
|
: DOMRectReadOnly(aParent, aX, aY, aWidth, aHeight)
|
||||||
, mX(aX)
|
|
||||||
, mY(aY)
|
|
||||||
, mWidth(aWidth)
|
|
||||||
, mHeight(aHeight)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_NSIDOMCLIENTRECT
|
NS_DECL_NSIDOMCLIENTRECT
|
||||||
|
|
||||||
static already_AddRefed<DOMRect>
|
|
||||||
Constructor(const GlobalObject& aGlobal, ErrorResult& aRV);
|
|
||||||
static already_AddRefed<DOMRect>
|
static already_AddRefed<DOMRect>
|
||||||
Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
||||||
double aWidth, double aHeight, ErrorResult& aRV);
|
double aWidth, double aHeight, ErrorResult& aRv);
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
|
|
@ -104,23 +120,6 @@ public:
|
||||||
}
|
}
|
||||||
void SetLayoutRect(const nsRect& aLayoutRect);
|
void SetLayoutRect(const nsRect& aLayoutRect);
|
||||||
|
|
||||||
virtual double X() const override
|
|
||||||
{
|
|
||||||
return mX;
|
|
||||||
}
|
|
||||||
virtual double Y() const override
|
|
||||||
{
|
|
||||||
return mY;
|
|
||||||
}
|
|
||||||
virtual double Width() const override
|
|
||||||
{
|
|
||||||
return mWidth;
|
|
||||||
}
|
|
||||||
virtual double Height() const override
|
|
||||||
{
|
|
||||||
return mHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetX(double aX)
|
void SetX(double aX)
|
||||||
{
|
{
|
||||||
mX = aX;
|
mX = aX;
|
||||||
|
|
@ -138,11 +137,8 @@ public:
|
||||||
mHeight = aHeight;
|
mHeight = aHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
double mX, mY, mWidth, mHeight;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~DOMRect() {};
|
~DOMRect() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DOMRectList final : public nsIDOMClientRectList,
|
class DOMRectList final : public nsIDOMClientRectList,
|
||||||
|
|
|
||||||
|
|
@ -253,12 +253,10 @@ DOMInterfaces = {
|
||||||
|
|
||||||
'DOMMatrixReadOnly': {
|
'DOMMatrixReadOnly': {
|
||||||
'headerFile': 'mozilla/dom/DOMMatrix.h',
|
'headerFile': 'mozilla/dom/DOMMatrix.h',
|
||||||
'concrete': False,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'DOMPointReadOnly': {
|
'DOMPointReadOnly': {
|
||||||
'headerFile': 'mozilla/dom/DOMPoint.h',
|
'headerFile': 'mozilla/dom/DOMPoint.h',
|
||||||
'concrete': False,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'DOMRectList': {
|
'DOMRectList': {
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ MSG_DEF(MSG_TIME_VALUE_OUT_OF_RANGE, 1, JSEXN_TYPEERR, "{0} is outside the suppo
|
||||||
MSG_DEF(MSG_ONLY_IF_CACHED_WITHOUT_SAME_ORIGIN, 1, JSEXN_TYPEERR, "Request mode '{0}' was used, but request cache mode 'only-if-cached' can only be used with request mode 'same-origin'.")
|
MSG_DEF(MSG_ONLY_IF_CACHED_WITHOUT_SAME_ORIGIN, 1, JSEXN_TYPEERR, "Request mode '{0}' was used, but request cache mode 'only-if-cached' can only be used with request mode 'same-origin'.")
|
||||||
MSG_DEF(MSG_THRESHOLD_RANGE_ERROR, 0, JSEXN_RANGEERR, "Threshold values must all be in the range [0, 1].")
|
MSG_DEF(MSG_THRESHOLD_RANGE_ERROR, 0, JSEXN_RANGEERR, "Threshold values must all be in the range [0, 1].")
|
||||||
MSG_DEF(MSG_CACHE_OPEN_FAILED, 0, JSEXN_TYPEERR, "CacheStorage.open() failed to access the storage system.")
|
MSG_DEF(MSG_CACHE_OPEN_FAILED, 0, JSEXN_TYPEERR, "CacheStorage.open() failed to access the storage system.")
|
||||||
|
MSG_DEF(MSG_MATRIX_INIT_LENGTH_WRONG, 1, JSEXN_TYPEERR, "Matrix init sequence must have a length of 6 or 16 (actual value: {0})")
|
||||||
MSG_DEF(MSG_NO_NEGATIVE_ATTR, 1, JSEXN_TYPEERR, "Given attribute {0} cannot be negative.")
|
MSG_DEF(MSG_NO_NEGATIVE_ATTR, 1, JSEXN_TYPEERR, "Given attribute {0} cannot be negative.")
|
||||||
MSG_DEF(MSG_PMO_NO_SEPARATE_ENDMARK, 0, JSEXN_TYPEERR, "Cannot provide separate endMark argument if PerformanceMeasureOptions argument is given.")
|
MSG_DEF(MSG_PMO_NO_SEPARATE_ENDMARK, 0, JSEXN_TYPEERR, "Cannot provide separate endMark argument if PerformanceMeasureOptions argument is given.")
|
||||||
MSG_DEF(MSG_PMO_MISSING_STARTENDMARK, 0, JSEXN_TYPEERR, "PerformanceMeasureOptions must have start and/or end member.")
|
MSG_DEF(MSG_PMO_MISSING_STARTENDMARK, 0, JSEXN_TYPEERR, "PerformanceMeasureOptions must have start and/or end member.")
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
* liability, trademark and document use rules apply.
|
* liability, trademark and document use rules apply.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Pref="layout.css.DOMMatrix.enabled"]
|
[Pref="layout.css.DOMMatrix.enabled",
|
||||||
|
Constructor(optional (DOMString or sequence<unrestricted double>) init)]
|
||||||
interface DOMMatrixReadOnly {
|
interface DOMMatrixReadOnly {
|
||||||
// These attributes are simple aliases for certain elements of the 4x4 matrix
|
// These attributes are simple aliases for certain elements of the 4x4 matrix
|
||||||
readonly attribute unrestricted double a;
|
readonly attribute unrestricted double a;
|
||||||
|
|
@ -77,6 +78,7 @@ interface DOMMatrixReadOnly {
|
||||||
[Throws] Float32Array toFloat32Array();
|
[Throws] Float32Array toFloat32Array();
|
||||||
[Throws] Float64Array toFloat64Array();
|
[Throws] Float64Array toFloat64Array();
|
||||||
stringifier;
|
stringifier;
|
||||||
|
[Default] object toJSON();
|
||||||
};
|
};
|
||||||
|
|
||||||
[Pref="layout.css.DOMMatrix.enabled",
|
[Pref="layout.css.DOMMatrix.enabled",
|
||||||
|
|
|
||||||
|
|
@ -10,19 +10,26 @@
|
||||||
* liability, trademark and document use rules apply.
|
* 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 {
|
interface DOMPointReadOnly {
|
||||||
|
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other);
|
||||||
|
|
||||||
readonly attribute unrestricted double x;
|
readonly attribute unrestricted double x;
|
||||||
readonly attribute unrestricted double y;
|
readonly attribute unrestricted double y;
|
||||||
readonly attribute unrestricted double z;
|
readonly attribute unrestricted double z;
|
||||||
readonly attribute unrestricted double w;
|
readonly attribute unrestricted double w;
|
||||||
|
|
||||||
|
[Default] object toJSON();
|
||||||
};
|
};
|
||||||
|
|
||||||
[Pref="layout.css.DOMPoint.enabled",
|
[Pref="layout.css.DOMPoint.enabled",
|
||||||
Constructor(optional DOMPointInit point),
|
Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
|
||||||
Constructor(unrestricted double x, unrestricted double y,
|
|
||||||
optional unrestricted double z = 0, optional unrestricted double w = 1)]
|
optional unrestricted double z = 0, optional unrestricted double w = 1)]
|
||||||
interface DOMPoint : DOMPointReadOnly {
|
interface DOMPoint : DOMPointReadOnly {
|
||||||
|
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other);
|
||||||
|
|
||||||
inherit attribute unrestricted double x;
|
inherit attribute unrestricted double x;
|
||||||
inherit attribute unrestricted double y;
|
inherit attribute unrestricted double y;
|
||||||
inherit attribute unrestricted double z;
|
inherit attribute unrestricted double z;
|
||||||
|
|
@ -34,4 +41,4 @@ dictionary DOMPointInit {
|
||||||
unrestricted double y = 0;
|
unrestricted double y = 0;
|
||||||
unrestricted double z = 0;
|
unrestricted double z = 0;
|
||||||
unrestricted double w = 1;
|
unrestricted double w = 1;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,7 @@ interface DOMQuad {
|
||||||
[SameObject] readonly attribute DOMPoint p2;
|
[SameObject] readonly attribute DOMPoint p2;
|
||||||
[SameObject] readonly attribute DOMPoint p3;
|
[SameObject] readonly attribute DOMPoint p3;
|
||||||
[SameObject] readonly attribute DOMPoint p4;
|
[SameObject] readonly attribute DOMPoint p4;
|
||||||
[SameObject] readonly attribute DOMRectReadOnly bounds;
|
[NewObject] DOMRectReadOnly getBounds();
|
||||||
};
|
|
||||||
|
[Default] object toJSON();
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,8 @@
|
||||||
* liability, trademark and document use rules apply.
|
* liability, trademark and document use rules apply.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Constructor,
|
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
|
||||||
Constructor(unrestricted double x, unrestricted double y,
|
optional unrestricted double width = 0, optional unrestricted double height = 0)]
|
||||||
unrestricted double width, unrestricted double height)]
|
|
||||||
interface DOMRect : DOMRectReadOnly {
|
interface DOMRect : DOMRectReadOnly {
|
||||||
inherit attribute unrestricted double x;
|
inherit attribute unrestricted double x;
|
||||||
inherit attribute unrestricted double y;
|
inherit attribute unrestricted double y;
|
||||||
|
|
@ -20,6 +19,8 @@ interface DOMRect : DOMRectReadOnly {
|
||||||
inherit attribute unrestricted double height;
|
inherit attribute unrestricted double height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
|
||||||
|
optional unrestricted double width = 0, optional unrestricted double height = 0)]
|
||||||
interface DOMRectReadOnly {
|
interface DOMRectReadOnly {
|
||||||
readonly attribute unrestricted double x;
|
readonly attribute unrestricted double x;
|
||||||
readonly attribute unrestricted double y;
|
readonly attribute unrestricted double y;
|
||||||
|
|
@ -29,6 +30,8 @@ interface DOMRectReadOnly {
|
||||||
readonly attribute unrestricted double right;
|
readonly attribute unrestricted double right;
|
||||||
readonly attribute unrestricted double bottom;
|
readonly attribute unrestricted double bottom;
|
||||||
readonly attribute unrestricted double left;
|
readonly attribute unrestricted double left;
|
||||||
|
|
||||||
|
[Default] object toJSON();
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary DOMRectInit {
|
dictionary DOMRectInit {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue