Make DOM geometry structs serializable (#38828)

Makes the following DOM geometry structs serializable:
- `DOMRect`
- `DOMRectReadOnly`
- `DOMQuad`
- `DOMMatrix`
- `DOMMatrixReadOnly`

Testing: Covered by WPT (`css/geometry/structured-serialization.html`).

---------

Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
lumiscosity 2025-08-22 01:19:42 +02:00 committed by GitHub
parent e00f39d827
commit 39f3ce7a2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 529 additions and 89 deletions

View file

@ -11,8 +11,8 @@ mod transferable;
use std::collections::HashMap;
use base::id::{
BlobId, DomExceptionId, DomPointId, ImageBitmapId, MessagePortId, OffscreenCanvasId,
QuotaExceededErrorId,
BlobId, DomExceptionId, DomMatrixId, DomPointId, DomQuadId, DomRectId, ImageBitmapId,
MessagePortId, OffscreenCanvasId, QuotaExceededErrorId,
};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
@ -31,6 +31,12 @@ pub struct StructuredSerializedData {
pub blobs: Option<HashMap<BlobId, BlobImpl>>,
/// Serialized point objects.
pub points: Option<HashMap<DomPointId, DomPoint>>,
/// Serialized rect objects.
pub rects: Option<HashMap<DomRectId, DomRect>>,
/// Serialized quad objects.
pub quads: Option<HashMap<DomQuadId, DomQuad>>,
/// Serialized matrix objects.
pub matrices: Option<HashMap<DomMatrixId, DomMatrix>>,
/// Serialized exception objects.
pub exceptions: Option<HashMap<DomExceptionId, DomException>>,
/// Serialized quota exceeded errors.