mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #2241 - Part 5: Expose Geometry interfaces to web workers.
Exposes DOMMatrix, DOMPoint, DOMQuad, and DOMRect to workers. Backported from Mozilla bug 1420580.
This commit is contained in:
parent
69e45fd84e
commit
c3042a2f41
14 changed files with 404 additions and 16 deletions
|
|
@ -36,6 +36,42 @@ DOMRectReadOnly::Constructor(const GlobalObject& aGlobal, double aX, double aY,
|
|||
return obj.forget();
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#structured-serialization
|
||||
bool
|
||||
DOMRectReadOnly::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
|
||||
{
|
||||
#define WriteDouble(d) \
|
||||
JS_WriteUint32Pair(aWriter, (BitwiseCast<uint64_t>(d) >> 32) & 0xffffffff, \
|
||||
BitwiseCast<uint64_t>(d) & 0xffffffff)
|
||||
|
||||
return WriteDouble(mX) && WriteDouble(mY) && WriteDouble(mWidth) &&
|
||||
WriteDouble(mHeight);
|
||||
|
||||
#undef WriteDouble
|
||||
}
|
||||
|
||||
bool
|
||||
DOMRectReadOnly::ReadStructuredClone(JSStructuredCloneReader* aReader)
|
||||
{
|
||||
uint32_t high;
|
||||
uint32_t low;
|
||||
|
||||
#define ReadDouble(d) \
|
||||
if (!JS_ReadUint32Pair(aReader, &high, &low)) { \
|
||||
return false; \
|
||||
} \
|
||||
(*(d) = BitwiseCast<double>(static_cast<uint64_t>(high) << 32 | low))
|
||||
|
||||
ReadDouble(&mX);
|
||||
ReadDouble(&mY);
|
||||
ReadDouble(&mWidth);
|
||||
ReadDouble(&mHeight);
|
||||
|
||||
return true;
|
||||
|
||||
#undef ReadDouble
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(DOMRect, DOMRectReadOnly, nsIDOMClientRect)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue