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:
Job Bautista 2023-05-12 13:45:39 +08:00 committed by roytam1
commit c3042a2f41
14 changed files with 404 additions and 16 deletions

View file

@ -132,3 +132,27 @@ DOMQuad::ToJSON(DOMQuadJSON& aInit)
aInit.mP3.Construct(RefPtr<DOMPoint>(P3()).forget());
aInit.mP4.Construct(RefPtr<DOMPoint>(P4()).forget());
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool
DOMQuad::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
{
for (const auto& point : mPoints) {
if (!point->WriteStructuredClone(aWriter)) {
return false;
}
}
return true;
}
bool
DOMQuad::ReadStructuredClone(JSStructuredCloneReader* aReader)
{
for (auto& point : mPoints) {
point = new DOMPoint(mParent);
if (!point->ReadStructuredClone(aReader)) {
return false;
}
}
return true;
}