mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 09:57:32 +09:00
Issue #2241 - Part 4.2: Resurrect DOMQuad.bounds, but deprecated.
This also forces DOMQuad.toJSON() to only return the points. Backported from Mozilla bug 1186265.
This commit is contained in:
parent
60c88dd11b
commit
840658ab39
5 changed files with 43 additions and 2 deletions
|
|
@ -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, mPoints[0],
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMQuad, mParent, mBounds, 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)
|
||||||
|
|
@ -101,6 +101,15 @@ DOMQuad::GetVerticalMinMax(double* aY1, double* aY2) const
|
||||||
*aY2 = y2;
|
*aY2 = y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DOMRectReadOnly*
|
||||||
|
DOMQuad::Bounds()
|
||||||
|
{
|
||||||
|
if (!mBounds) {
|
||||||
|
mBounds = GetBounds();
|
||||||
|
}
|
||||||
|
return mBounds;
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRectReadOnly>
|
already_AddRefed<DOMRectReadOnly>
|
||||||
DOMQuad::GetBounds() const
|
DOMQuad::GetBounds() const
|
||||||
{
|
{
|
||||||
|
|
@ -114,3 +123,12 @@ DOMQuad::GetBounds() const
|
||||||
x1, y1, x2 - x1, y2 - y1);
|
x1, y1, x2 - x1, y2 - y1);
|
||||||
return rval.forget();
|
return rval.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DOMQuad::ToJSON(DOMQuadJSON& aInit)
|
||||||
|
{
|
||||||
|
aInit.mP1.Construct(RefPtr<DOMPoint>(P1()).forget());
|
||||||
|
aInit.mP2.Construct(RefPtr<DOMPoint>(P2()).forget());
|
||||||
|
aInit.mP3.Construct(RefPtr<DOMPoint>(P3()).forget());
|
||||||
|
aInit.mP4.Construct(RefPtr<DOMPoint>(P4()).forget());
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace dom {
|
||||||
|
|
||||||
class DOMRectReadOnly;
|
class DOMRectReadOnly;
|
||||||
class DOMPoint;
|
class DOMPoint;
|
||||||
|
struct DOMQuadJSON;
|
||||||
struct DOMPointInit;
|
struct DOMPointInit;
|
||||||
|
|
||||||
class DOMQuad final : public nsWrapperCache
|
class DOMQuad final : public nsWrapperCache
|
||||||
|
|
@ -47,6 +48,7 @@ public:
|
||||||
Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
|
Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
|
||||||
ErrorResult& aRV);
|
ErrorResult& aRV);
|
||||||
|
|
||||||
|
DOMRectReadOnly* Bounds();
|
||||||
already_AddRefed<DOMRectReadOnly> GetBounds() 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]; }
|
||||||
|
|
@ -55,12 +57,15 @@ public:
|
||||||
|
|
||||||
DOMPoint* Point(uint32_t aIndex) const { return mPoints[aIndex]; }
|
DOMPoint* Point(uint32_t aIndex) const { return mPoints[aIndex]; }
|
||||||
|
|
||||||
|
void ToJSON(DOMQuadJSON& aInit);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void GetHorizontalMinMax(double* aX1, double* aX2) const;
|
void GetHorizontalMinMax(double* aX1, double* aX2) const;
|
||||||
void GetVerticalMinMax(double* aY1, double* aY2) const;
|
void GetVerticalMinMax(double* aY1, double* aY2) const;
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> mParent;
|
nsCOMPtr<nsISupports> mParent;
|
||||||
RefPtr<DOMPoint> mPoints[4];
|
RefPtr<DOMPoint> mPoints[4];
|
||||||
|
RefPtr<DOMRectReadOnly> mBounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
||||||
|
|
@ -47,3 +47,4 @@ DEPRECATED_OPERATION(PrefixedFullscreenAPI)
|
||||||
DEPRECATED_OPERATION(LenientSetter)
|
DEPRECATED_OPERATION(LenientSetter)
|
||||||
DEPRECATED_OPERATION(FileLastModifiedDate)
|
DEPRECATED_OPERATION(FileLastModifiedDate)
|
||||||
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
|
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
|
||||||
|
DEPRECATED_OPERATION(DOMQuadBoundsAttr)
|
||||||
|
|
|
||||||
|
|
@ -320,3 +320,4 @@ LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document
|
||||||
PushStateFloodingPrevented=Call to pushState or replaceState ignored due to excessive calls within a short timeframe.
|
PushStateFloodingPrevented=Call to pushState or replaceState ignored due to excessive calls within a short timeframe.
|
||||||
# LOCALIZATION NOTE: Do not translate "Reload"
|
# LOCALIZATION NOTE: Do not translate "Reload"
|
||||||
ReloadFloodingPrevented=Call to Reload ignored due to excessive calls within a short timeframe.
|
ReloadFloodingPrevented=Call to Reload ignored due to excessive calls within a short timeframe.
|
||||||
|
DOMQuadBoundsAttrWarning=DOMQuad.bounds is deprecated in favor of DOMQuad.getBounds()
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,21 @@ interface DOMQuad {
|
||||||
[SameObject] readonly attribute DOMPoint p4;
|
[SameObject] readonly attribute DOMPoint p4;
|
||||||
[NewObject] DOMRectReadOnly getBounds();
|
[NewObject] DOMRectReadOnly getBounds();
|
||||||
|
|
||||||
[Default] object toJSON();
|
[SameObject, Deprecated=DOMQuadBoundsAttr] readonly attribute DOMRectReadOnly bounds;
|
||||||
|
|
||||||
|
DOMQuadJSON toJSON();
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary DOMQuadJSON {
|
||||||
|
DOMPoint p1;
|
||||||
|
DOMPoint p2;
|
||||||
|
DOMPoint p3;
|
||||||
|
DOMPoint p4;
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary DOMQuadInit {
|
||||||
|
DOMPointInit p1;
|
||||||
|
DOMPointInit p2;
|
||||||
|
DOMPointInit p3;
|
||||||
|
DOMPointInit p4;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue