mirror of
https://github.com/servo/servo
synced 2026-05-09 16:42:16 +02:00
each webview will have an AccessKit subtree, and each pipeline representing a document will have an AccessKit subtree for its layout. but to graft the subtree of a pipeline into that of a webview (for top-level documents) or another pipeline (for documents in iframes etc), the parent tree needs to know the [TreeId](https://docs.rs/accesskit/0.24.0/accesskit/struct.TreeId.html) of the child tree. this is annoying for pipelines, because they run in a separate thread (or process) to the constellation, and they may run in a separate script thread (or web content process) to other pipelines. if the pipeline generates a random (UUIDv4) TreeId as internal state, it has to communicate that to the constellation (or parent pipeline) over IPC, which takes time and makes it harder for us to obey AccessKit’s subtree invariants (notably, the subtree must not send updates before a graft node is created for it in some other subtree). this patch defines a deterministic and pure conversion from PipelineId to a UUIDv5-based TreeId, allowing anyone that knows a PipelineId to derive its TreeId. one consequence of this approach is that it precludes having multiple instances of [Servo](https://doc.servo.org/servo/struct.Servo.html) in a single application, but i’m not sure that was an intended use case (or even possible). Testing: this patch includes a unit test Fixes: part of #4344, extracted from our work in #42338 <img width="521" height="400" alt="grafts drawio" src="https://github.com/user-attachments/assets/39efa426-ba21-41dc-874b-c3e4fcb17593" /> Signed-off-by: delan azabani <dazabani@igalia.com> Co-authored-by: Alice Boxhall <alice@igalia.com>