diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-03-29 17:25:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 16:25:47 +0000 |
commit | b7d089930ea075a580a20bede881c677a0ba0fb0 (patch) | |
tree | c85d7bf011d80d5f3c47a2a5b5df2948134ec1b8 /components/script/dom/documentorshadowroot.rs | |
parent | 07391e346b0ff3e89485ddc7e8f3c448ef1de4f4 (diff) | |
download | servo-b7d089930ea075a580a20bede881c677a0ba0fb0.tar.gz servo-b7d089930ea075a580a20bede881c677a0ba0fb0.zip |
layout: Remove LayoutRPC and query layout via the `Layout` trait (#31937)
Instead of the tricky `LayoutRPC` interface, query layout using the
`Layout` trait. This means that now queries will requires calling layout
and then running the query. During layout an enum is used to indicate
what kind of layout is necessary.
This change also removes the mutex-locked `rw_data` from both layout
threads. It's no longer necessary since layout runs synchronously. The
one downside here is that for resolved style queries, we now have to
create two StyleContexts. One for layout and one for the query itself.
The creation of this context should not be very expensive though.
`LayoutRPC` used to be necessary because layout used to run
asynchronously from script, but that no longer happens. With this
change, it becomes possible to safely pass nodes to layout from script
-- a cleanup that can happen in a followup change.
Diffstat (limited to 'components/script/dom/documentorshadowroot.rs')
-rw-r--r-- | components/script/dom/documentorshadowroot.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/components/script/dom/documentorshadowroot.rs b/components/script/dom/documentorshadowroot.rs index fec2b6372db..59e84acf13c 100644 --- a/components/script/dom/documentorshadowroot.rs +++ b/components/script/dom/documentorshadowroot.rs @@ -84,16 +84,15 @@ impl DocumentOrShadowRoot { pub fn nodes_from_point( &self, client_point: &Point2D<f32>, - reflow_goal: NodesFromPointQueryType, + query_type: NodesFromPointQueryType, ) -> Vec<UntrustedNodeAddress> { - if !self - .window - .layout_reflow(QueryMsg::NodesFromPointQuery(*client_point, reflow_goal)) - { + if !self.window.layout_reflow(QueryMsg::NodesFromPointQuery) { return vec![]; }; - self.window.layout_rpc().nodes_from_point_response() + self.window + .with_layout(|layout| layout.query_nodes_from_point(*client_point, query_type)) + .unwrap_or_default() } #[allow(unsafe_code)] |