servo/components/layout_2020
Martin Robinson 9c0561536d
script: Do not run layout in a thread (#31346)
* script: Do not run layout in a thread

Instead of spawning a thread for layout that almost always runs
synchronously with script, simply run layout in the script thread.

This is a resurrection of #28708, taking just the bits that remove the
layout thread. It's a complex change and thus is just a first step
toward cleaning up the interface between script and layout. Messages are
still passed from script to layout via a `process()` method and script
proxies some messages to layout from other threads as well.

Big changes:

1. Layout is created in the script thread on Document load, thus every
   live document is guaranteed to have a layout. This isn't completely
   hidden in the interface, but we can safely `unwrap()` on a Document's
   layout.
2. Layout configuration is abstracted away into a LayoutConfig struct
   and the LayoutFactory is a struct passed around by the Constellation.
   This is to avoid having to monomorphize the entire script thread
   for each layout.
3. Instead of having the Constellation block on the layout thread to
   figure out the current epoch and whether there are pending web fonts
   loading, updates are sent synchronously to the Constellation when
   rendering to a screenshot. This practically only used by the WPT.

A couple tests start to fail, which is probably inevitable since removing
the layout thread has introduced timing changes in "exit after load" and
screenshot behavior.

Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* Update test expectations

* Fix some issues found during review

* Clarify some comments

* Address review comments

---------

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-02-23 08:14:10 +00:00
..
display_list script: Do not run layout in a thread (#31346) 2024-02-23 08:14:10 +00:00
flexbox make ContainingBlock use Au for inline_size and block_size (#31370) 2024-02-20 09:14:44 +00:00
flow layout: Add initial support for text-transform (#31396) 2024-02-22 14:15:59 +00:00
fragment_tree layout: Add support for table rows, columns, rowgroups and colgroups (#31341) 2024-02-20 13:22:02 +00:00
table layout: Add support for table rows, columns, rowgroups and colgroups (#31341) 2024-02-20 13:22:02 +00:00
tests layout: Add initial support for text-transform (#31396) 2024-02-22 14:15:59 +00:00
Cargo.toml layout: Add initial support for text-transform (#31396) 2024-02-22 14:15:59 +00:00
cell.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
context.rs Lint layout_2020 with clippy (#31169) 2024-01-25 09:03:31 +00:00
dom.rs Lint layout_2020 with clippy (#31169) 2024-01-25 09:03:31 +00:00
dom_traversal.rs Lint layout_2020 with clippy (#31169) 2024-01-25 09:03:31 +00:00
formatting_contexts.rs layout: Start work on table row height and vertical-align (#31246) 2024-02-10 08:03:01 +00:00
geom.rs make ContainingBlock use Au for inline_size and block_size (#31370) 2024-02-20 09:14:44 +00:00
layout_debug.rs Lint layout_2020 with clippy (#31169) 2024-01-25 09:03:31 +00:00
lib.rs make ContainingBlock use Au for inline_size and block_size (#31370) 2024-02-20 09:14:44 +00:00
lists.rs rustdoc: Fix many rustdoc errors (#31147) 2024-01-22 13:13:48 +00:00
positioned.rs layout: Add support for table rows, columns, rowgroups and colgroups (#31341) 2024-02-20 13:22:02 +00:00
query.rs script: Do not run layout in a thread (#31346) 2024-02-23 08:14:10 +00:00
replaced.rs style: Remove dependency on servo_url (#31358) 2024-02-16 11:56:35 +00:00
sizing.rs layout: Implement computation of table column widths (#31165) 2024-01-25 23:13:13 +00:00
style_ext.rs make ContainingBlock use Au for inline_size and block_size (#31370) 2024-02-20 09:14:44 +00:00
traversal.rs Lint layout_2020 with clippy (#31169) 2024-01-25 09:03:31 +00:00