From 7787cab521ccc6b4d8533ebe9b45563046e0463d Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Sat, 19 Apr 2025 12:17:03 +0200 Subject: [PATCH] layout: Combine `layout_2020` and `layout_thread_2020` into a crate called `layout` (#36613) Now that legacy layout has been removed, the name `layout_2020` doesn't make much sense any longer, also it's 2025 now for better or worse. The split between the "layout thread" and "layout" also doesn't make as much sense since layout doesn't run on it's own thread. There's a possibility that it will in the future, but that should be something that the user of the crate controls rather than layout iself. This is part of the larger layout interface cleanup and optimization that @Looriool and I are doing. Testing: Covered by existing tests as this is just code movement. Signed-off-by: Martin Robinson --- Cargo.lock | 46 +++--------------- components/{layout_2020 => layout}/Cargo.toml | 9 +++- components/{layout_2020 => layout}/cell.rs | 0 .../construct_modern.rs | 0 components/{layout_2020 => layout}/context.rs | 0 .../display_list/background.rs | 0 .../display_list/clip_path.rs | 0 .../display_list/conversions.rs | 0 .../display_list/gradient.rs | 0 .../display_list/mod.rs | 0 .../display_list/stacking_context.rs | 0 components/{layout_2020 => layout}/dom.rs | 0 .../{layout_2020 => layout}/dom_traversal.rs | 0 .../{layout_2020 => layout}/flexbox/geom.rs | 0 .../{layout_2020 => layout}/flexbox/layout.rs | 0 .../{layout_2020 => layout}/flexbox/mod.rs | 0 .../{layout_2020 => layout}/flow/construct.rs | 0 .../{layout_2020 => layout}/flow/float.rs | 0 .../flow/inline/construct.rs | 0 .../flow/inline/inline_box.rs | 0 .../flow/inline/line.rs | 0 .../flow/inline/line_breaker.rs | 0 .../flow/inline/mod.rs | 0 .../flow/inline/text_run.rs | 0 .../{layout_2020 => layout}/flow/mod.rs | 0 .../{layout_2020 => layout}/flow/root.rs | 0 .../formatting_contexts.rs | 0 .../fragment_tree/base_fragment.rs | 0 .../fragment_tree/box_fragment.rs | 0 .../fragment_tree/containing_block.rs | 0 .../fragment_tree/fragment.rs | 0 .../fragment_tree/fragment_tree.rs | 0 .../fragment_tree/hoisted_shared_fragment.rs | 0 .../fragment_tree/mod.rs | 0 .../fragment_tree/positioning_fragment.rs | 0 components/{layout_2020 => layout}/geom.rs | 0 .../layout_box_base.rs | 0 .../lib.rs => layout/layout_impl.rs} | 35 +++++++------- components/{layout_2020 => layout}/lib.rs | 5 ++ components/{layout_2020 => layout}/lists.rs | 0 .../{layout_2020 => layout}/positioned.rs | 0 components/{layout_2020 => layout}/query.rs | 0 components/{layout_2020 => layout}/quotes.rs | 0 .../{layout_2020 => layout}/replaced.rs | 0 components/{layout_2020 => layout}/sizing.rs | 0 .../{layout_2020 => layout}/style_ext.rs | 0 .../table/construct.rs | 0 .../{layout_2020 => layout}/table/layout.rs | 0 .../{layout_2020 => layout}/table/mod.rs | 0 .../{layout_2020 => layout}/taffy/layout.rs | 2 +- .../{layout_2020 => layout}/taffy/mod.rs | 0 .../taffy/stylo_taffy/convert.rs | 0 .../taffy/stylo_taffy/mod.rs | 0 .../taffy/stylo_taffy/wrapper.rs | 0 .../{layout_2020 => layout}/tests/floats.rs | 4 +- .../{layout_2020 => layout}/tests/tables.rs | 4 +- .../{layout_2020 => layout}/tests/text.rs | 2 +- .../{layout_2020 => layout}/traversal.rs | 0 components/layout_thread_2020/Cargo.toml | 48 ------------------- components/servo/Cargo.toml | 12 ++++- components/servo/lib.rs | 11 +++-- python/servo/testing_commands.py | 2 +- 62 files changed, 58 insertions(+), 122 deletions(-) rename components/{layout_2020 => layout}/Cargo.toml (88%) rename components/{layout_2020 => layout}/cell.rs (100%) rename components/{layout_2020 => layout}/construct_modern.rs (100%) rename components/{layout_2020 => layout}/context.rs (100%) rename components/{layout_2020 => layout}/display_list/background.rs (100%) rename components/{layout_2020 => layout}/display_list/clip_path.rs (100%) rename components/{layout_2020 => layout}/display_list/conversions.rs (100%) rename components/{layout_2020 => layout}/display_list/gradient.rs (100%) rename components/{layout_2020 => layout}/display_list/mod.rs (100%) rename components/{layout_2020 => layout}/display_list/stacking_context.rs (100%) rename components/{layout_2020 => layout}/dom.rs (100%) rename components/{layout_2020 => layout}/dom_traversal.rs (100%) rename components/{layout_2020 => layout}/flexbox/geom.rs (100%) rename components/{layout_2020 => layout}/flexbox/layout.rs (100%) rename components/{layout_2020 => layout}/flexbox/mod.rs (100%) rename components/{layout_2020 => layout}/flow/construct.rs (100%) rename components/{layout_2020 => layout}/flow/float.rs (100%) rename components/{layout_2020 => layout}/flow/inline/construct.rs (100%) rename components/{layout_2020 => layout}/flow/inline/inline_box.rs (100%) rename components/{layout_2020 => layout}/flow/inline/line.rs (100%) rename components/{layout_2020 => layout}/flow/inline/line_breaker.rs (100%) rename components/{layout_2020 => layout}/flow/inline/mod.rs (100%) rename components/{layout_2020 => layout}/flow/inline/text_run.rs (100%) rename components/{layout_2020 => layout}/flow/mod.rs (100%) rename components/{layout_2020 => layout}/flow/root.rs (100%) rename components/{layout_2020 => layout}/formatting_contexts.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/base_fragment.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/box_fragment.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/containing_block.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/fragment.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/fragment_tree.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/hoisted_shared_fragment.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/mod.rs (100%) rename components/{layout_2020 => layout}/fragment_tree/positioning_fragment.rs (100%) rename components/{layout_2020 => layout}/geom.rs (100%) rename components/{layout_2020 => layout}/layout_box_base.rs (100%) rename components/{layout_thread_2020/lib.rs => layout/layout_impl.rs} (98%) rename components/{layout_2020 => layout}/lib.rs (97%) rename components/{layout_2020 => layout}/lists.rs (100%) rename components/{layout_2020 => layout}/positioned.rs (100%) rename components/{layout_2020 => layout}/query.rs (100%) rename components/{layout_2020 => layout}/quotes.rs (100%) rename components/{layout_2020 => layout}/replaced.rs (100%) rename components/{layout_2020 => layout}/sizing.rs (100%) rename components/{layout_2020 => layout}/style_ext.rs (100%) rename components/{layout_2020 => layout}/table/construct.rs (100%) rename components/{layout_2020 => layout}/table/layout.rs (100%) rename components/{layout_2020 => layout}/table/mod.rs (100%) rename components/{layout_2020 => layout}/taffy/layout.rs (99%) rename components/{layout_2020 => layout}/taffy/mod.rs (100%) rename components/{layout_2020 => layout}/taffy/stylo_taffy/convert.rs (100%) rename components/{layout_2020 => layout}/taffy/stylo_taffy/mod.rs (100%) rename components/{layout_2020 => layout}/taffy/stylo_taffy/wrapper.rs (100%) rename components/{layout_2020 => layout}/tests/floats.rs (99%) rename components/{layout_2020 => layout}/tests/tables.rs (98%) rename components/{layout_2020 => layout}/tests/text.rs (97%) rename components/{layout_2020 => layout}/traversal.rs (100%) delete mode 100644 components/layout_thread_2020/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 903fa07d3a5..915f2330c33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4142,7 +4142,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] -name = "layout_2020" +name = "layout" version = "0.0.1" dependencies = [ "app_units", @@ -4151,6 +4151,7 @@ dependencies = [ "bitflags 2.9.0", "canvas_traits", "compositing_traits", + "constellation_traits", "data-url", "embedder_traits", "euclid", @@ -4169,10 +4170,13 @@ dependencies = [ "num-traits", "parking_lot", "pixels", + "profile_traits", "quickcheck", "range", "rayon", + "script", "script_layout_interface", + "script_traits", "selectors", "servo_arc", "servo_config", @@ -4180,6 +4184,7 @@ dependencies = [ "servo_malloc_size_of", "servo_url", "stylo", + "stylo_atoms", "stylo_traits", "taffy", "tracing", @@ -4190,43 +4195,6 @@ dependencies = [ "xi-unicode", ] -[[package]] -name = "layout_thread_2020" -version = "0.0.1" -dependencies = [ - "app_units", - "base", - "compositing_traits", - "constellation_traits", - "embedder_traits", - "euclid", - "fnv", - "fonts", - "fonts_traits", - "fxhash", - "ipc-channel", - "layout_2020", - "log", - "metrics", - "net_traits", - "parking_lot", - "profile_traits", - "script", - "script_layout_interface", - "script_traits", - "servo_allocator", - "servo_arc", - "servo_config", - "servo_malloc_size_of", - "servo_url", - "stylo", - "stylo_atoms", - "stylo_traits", - "tracing", - "url", - "webrender_api", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -4334,7 +4302,7 @@ dependencies = [ "http 1.3.1", "ipc-channel", "keyboard-types", - "layout_thread_2020", + "layout", "libservo", "log", "media", diff --git a/components/layout_2020/Cargo.toml b/components/layout/Cargo.toml similarity index 88% rename from components/layout_2020/Cargo.toml rename to components/layout/Cargo.toml index 1501c52c7e2..0505581fba7 100644 --- a/components/layout_2020/Cargo.toml +++ b/components/layout/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "layout_2020" +name = "layout" version.workspace = true authors.workspace = true license.workspace = true @@ -8,7 +8,7 @@ publish.workspace = true rust-version.workspace = true [lib] -name = "layout_2020" +name = "layout" path = "lib.rs" test = true doctest = false @@ -23,6 +23,7 @@ base = { workspace = true } bitflags = { workspace = true } canvas_traits = { workspace = true } compositing_traits = { workspace = true } +constellation_traits = { workspace = true } data-url = { workspace = true } embedder_traits = { workspace = true } euclid = { workspace = true } @@ -41,15 +42,19 @@ malloc_size_of_derive = { workspace = true } net_traits = { workspace = true } parking_lot = { workspace = true } pixels = { path = "../pixels" } +profile_traits = { workspace = true } range = { path = "../range" } rayon = { workspace = true } +script = { path = "../script" } script_layout_interface = { workspace = true } +script_traits = { workspace = true } selectors = { workspace = true } servo_arc = { workspace = true } servo_config = { path = "../config" } servo_geometry = { path = "../geometry" } servo_url = { path = "../url" } stylo = { workspace = true } +stylo_atoms = { workspace = true } stylo_traits = { workspace = true } taffy = { workspace = true } tracing = { workspace = true, optional = true } diff --git a/components/layout_2020/cell.rs b/components/layout/cell.rs similarity index 100% rename from components/layout_2020/cell.rs rename to components/layout/cell.rs diff --git a/components/layout_2020/construct_modern.rs b/components/layout/construct_modern.rs similarity index 100% rename from components/layout_2020/construct_modern.rs rename to components/layout/construct_modern.rs diff --git a/components/layout_2020/context.rs b/components/layout/context.rs similarity index 100% rename from components/layout_2020/context.rs rename to components/layout/context.rs diff --git a/components/layout_2020/display_list/background.rs b/components/layout/display_list/background.rs similarity index 100% rename from components/layout_2020/display_list/background.rs rename to components/layout/display_list/background.rs diff --git a/components/layout_2020/display_list/clip_path.rs b/components/layout/display_list/clip_path.rs similarity index 100% rename from components/layout_2020/display_list/clip_path.rs rename to components/layout/display_list/clip_path.rs diff --git a/components/layout_2020/display_list/conversions.rs b/components/layout/display_list/conversions.rs similarity index 100% rename from components/layout_2020/display_list/conversions.rs rename to components/layout/display_list/conversions.rs diff --git a/components/layout_2020/display_list/gradient.rs b/components/layout/display_list/gradient.rs similarity index 100% rename from components/layout_2020/display_list/gradient.rs rename to components/layout/display_list/gradient.rs diff --git a/components/layout_2020/display_list/mod.rs b/components/layout/display_list/mod.rs similarity index 100% rename from components/layout_2020/display_list/mod.rs rename to components/layout/display_list/mod.rs diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout/display_list/stacking_context.rs similarity index 100% rename from components/layout_2020/display_list/stacking_context.rs rename to components/layout/display_list/stacking_context.rs diff --git a/components/layout_2020/dom.rs b/components/layout/dom.rs similarity index 100% rename from components/layout_2020/dom.rs rename to components/layout/dom.rs diff --git a/components/layout_2020/dom_traversal.rs b/components/layout/dom_traversal.rs similarity index 100% rename from components/layout_2020/dom_traversal.rs rename to components/layout/dom_traversal.rs diff --git a/components/layout_2020/flexbox/geom.rs b/components/layout/flexbox/geom.rs similarity index 100% rename from components/layout_2020/flexbox/geom.rs rename to components/layout/flexbox/geom.rs diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout/flexbox/layout.rs similarity index 100% rename from components/layout_2020/flexbox/layout.rs rename to components/layout/flexbox/layout.rs diff --git a/components/layout_2020/flexbox/mod.rs b/components/layout/flexbox/mod.rs similarity index 100% rename from components/layout_2020/flexbox/mod.rs rename to components/layout/flexbox/mod.rs diff --git a/components/layout_2020/flow/construct.rs b/components/layout/flow/construct.rs similarity index 100% rename from components/layout_2020/flow/construct.rs rename to components/layout/flow/construct.rs diff --git a/components/layout_2020/flow/float.rs b/components/layout/flow/float.rs similarity index 100% rename from components/layout_2020/flow/float.rs rename to components/layout/flow/float.rs diff --git a/components/layout_2020/flow/inline/construct.rs b/components/layout/flow/inline/construct.rs similarity index 100% rename from components/layout_2020/flow/inline/construct.rs rename to components/layout/flow/inline/construct.rs diff --git a/components/layout_2020/flow/inline/inline_box.rs b/components/layout/flow/inline/inline_box.rs similarity index 100% rename from components/layout_2020/flow/inline/inline_box.rs rename to components/layout/flow/inline/inline_box.rs diff --git a/components/layout_2020/flow/inline/line.rs b/components/layout/flow/inline/line.rs similarity index 100% rename from components/layout_2020/flow/inline/line.rs rename to components/layout/flow/inline/line.rs diff --git a/components/layout_2020/flow/inline/line_breaker.rs b/components/layout/flow/inline/line_breaker.rs similarity index 100% rename from components/layout_2020/flow/inline/line_breaker.rs rename to components/layout/flow/inline/line_breaker.rs diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout/flow/inline/mod.rs similarity index 100% rename from components/layout_2020/flow/inline/mod.rs rename to components/layout/flow/inline/mod.rs diff --git a/components/layout_2020/flow/inline/text_run.rs b/components/layout/flow/inline/text_run.rs similarity index 100% rename from components/layout_2020/flow/inline/text_run.rs rename to components/layout/flow/inline/text_run.rs diff --git a/components/layout_2020/flow/mod.rs b/components/layout/flow/mod.rs similarity index 100% rename from components/layout_2020/flow/mod.rs rename to components/layout/flow/mod.rs diff --git a/components/layout_2020/flow/root.rs b/components/layout/flow/root.rs similarity index 100% rename from components/layout_2020/flow/root.rs rename to components/layout/flow/root.rs diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout/formatting_contexts.rs similarity index 100% rename from components/layout_2020/formatting_contexts.rs rename to components/layout/formatting_contexts.rs diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout/fragment_tree/base_fragment.rs similarity index 100% rename from components/layout_2020/fragment_tree/base_fragment.rs rename to components/layout/fragment_tree/base_fragment.rs diff --git a/components/layout_2020/fragment_tree/box_fragment.rs b/components/layout/fragment_tree/box_fragment.rs similarity index 100% rename from components/layout_2020/fragment_tree/box_fragment.rs rename to components/layout/fragment_tree/box_fragment.rs diff --git a/components/layout_2020/fragment_tree/containing_block.rs b/components/layout/fragment_tree/containing_block.rs similarity index 100% rename from components/layout_2020/fragment_tree/containing_block.rs rename to components/layout/fragment_tree/containing_block.rs diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout/fragment_tree/fragment.rs similarity index 100% rename from components/layout_2020/fragment_tree/fragment.rs rename to components/layout/fragment_tree/fragment.rs diff --git a/components/layout_2020/fragment_tree/fragment_tree.rs b/components/layout/fragment_tree/fragment_tree.rs similarity index 100% rename from components/layout_2020/fragment_tree/fragment_tree.rs rename to components/layout/fragment_tree/fragment_tree.rs diff --git a/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs b/components/layout/fragment_tree/hoisted_shared_fragment.rs similarity index 100% rename from components/layout_2020/fragment_tree/hoisted_shared_fragment.rs rename to components/layout/fragment_tree/hoisted_shared_fragment.rs diff --git a/components/layout_2020/fragment_tree/mod.rs b/components/layout/fragment_tree/mod.rs similarity index 100% rename from components/layout_2020/fragment_tree/mod.rs rename to components/layout/fragment_tree/mod.rs diff --git a/components/layout_2020/fragment_tree/positioning_fragment.rs b/components/layout/fragment_tree/positioning_fragment.rs similarity index 100% rename from components/layout_2020/fragment_tree/positioning_fragment.rs rename to components/layout/fragment_tree/positioning_fragment.rs diff --git a/components/layout_2020/geom.rs b/components/layout/geom.rs similarity index 100% rename from components/layout_2020/geom.rs rename to components/layout/geom.rs diff --git a/components/layout_2020/layout_box_base.rs b/components/layout/layout_box_base.rs similarity index 100% rename from components/layout_2020/layout_box_base.rs rename to components/layout/layout_box_base.rs diff --git a/components/layout_thread_2020/lib.rs b/components/layout/layout_impl.rs similarity index 98% rename from components/layout_thread_2020/lib.rs rename to components/layout/layout_impl.rs index 89a12341bbf..61550df2723 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout/layout_impl.rs @@ -2,11 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// Work around https://github.com/rust-lang/rust/issues/62132 -#![recursion_limit = "128"] - -//! Layout. Performs layout on the DOM, builds display lists and sends them to be -//! painted. +#![allow(unsafe_code)] use std::cell::{Cell, LazyCell, RefCell}; use std::collections::{HashMap, HashSet}; @@ -29,15 +25,6 @@ use fonts::{FontContext, FontContextWebFontMethods}; use fonts_traits::StylesheetWebFontLoadFinishedCallback; use fxhash::{FxHashMap, FxHashSet}; use ipc_channel::ipc::IpcSender; -use layout::context::LayoutContext; -use layout::display_list::{DisplayList, WebRenderImageInfo}; -use layout::query::{ - get_the_text_steps, process_content_box_request, process_content_boxes_request, - process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query, - process_resolved_font_style_query, process_resolved_style_request, process_text_index_request, -}; -use layout::traversal::RecalcStyle; -use layout::{BoxTree, FragmentTree}; use log::{debug, error}; use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOf, MallocSizeOfOps}; use net_traits::image_cache::{ImageCache, UsePlaceholder}; @@ -87,8 +74,18 @@ use style::{Zero, driver}; use style_traits::{CSSPixel, SpeculativePainter}; use stylo_atoms::Atom; use url::Url; -use webrender_api::units::{DevicePixel, LayoutPixel}; -use webrender_api::{ExternalScrollId, HitTestFlags, units}; +use webrender_api::units::{DevicePixel, DevicePoint, LayoutPixel, LayoutPoint, LayoutSize}; +use webrender_api::{ExternalScrollId, HitTestFlags}; + +use crate::context::LayoutContext; +use crate::display_list::{DisplayList, WebRenderImageInfo}; +use crate::query::{ + get_the_text_steps, process_content_box_request, process_content_boxes_request, + process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query, + process_resolved_font_style_query, process_resolved_style_request, process_text_index_request, +}; +use crate::traversal::RecalcStyle; +use crate::{BoxTree, FragmentTree}; // This mutex is necessary due to syncronisation issues between two different types of thread-local storage // which manifest themselves when the layout thread tries to layout iframes in parallel with the main page @@ -283,7 +280,7 @@ impl Layout for LayoutThread { // particular pipeline, so we need to tell WebRender about that. flags.insert(HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT); - let client_point = units::DevicePoint::from_untyped(point); + let client_point = DevicePoint::from_untyped(point); let results = self .compositor_api .hit_test(Some(self.id.into()), client_point, flags); @@ -838,7 +835,7 @@ impl LayoutThread { self.compositor_api.send_scroll_node( self.webview_id, self.id.into(), - units::LayoutPoint::from_untyped(point), + LayoutPoint::from_untyped(point), state.scroll_id, ); } @@ -867,7 +864,7 @@ impl LayoutThread { epoch.next(); self.epoch.set(epoch); - let viewport_size = units::LayoutSize::from_untyped(Size2D::new( + let viewport_size = LayoutSize::from_untyped(Size2D::new( self.viewport_size.width.to_f32_px(), self.viewport_size.height.to_f32_px(), )); diff --git a/components/layout_2020/lib.rs b/components/layout/lib.rs similarity index 97% rename from components/layout_2020/lib.rs rename to components/layout/lib.rs index e649c8090b2..af7d432c4d8 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout/lib.rs @@ -4,6 +4,9 @@ #![deny(unsafe_code)] +//! Layout. Performs layout on the DOM, builds display lists and sends them to be +//! painted. + mod cell; pub mod context; pub mod display_list; @@ -15,6 +18,7 @@ mod formatting_contexts; mod fragment_tree; pub mod geom; mod layout_box_base; +mod layout_impl; mod taffy; #[macro_use] mod construct_modern; @@ -32,6 +36,7 @@ use app_units::Au; pub use cell::ArcRefCell; pub use flow::BoxTree; pub use fragment_tree::FragmentTree; +pub use layout_impl::LayoutFactoryImpl; use malloc_size_of_derive::MallocSizeOf; use style::logical_geometry::WritingMode; use style::properties::ComputedValues; diff --git a/components/layout_2020/lists.rs b/components/layout/lists.rs similarity index 100% rename from components/layout_2020/lists.rs rename to components/layout/lists.rs diff --git a/components/layout_2020/positioned.rs b/components/layout/positioned.rs similarity index 100% rename from components/layout_2020/positioned.rs rename to components/layout/positioned.rs diff --git a/components/layout_2020/query.rs b/components/layout/query.rs similarity index 100% rename from components/layout_2020/query.rs rename to components/layout/query.rs diff --git a/components/layout_2020/quotes.rs b/components/layout/quotes.rs similarity index 100% rename from components/layout_2020/quotes.rs rename to components/layout/quotes.rs diff --git a/components/layout_2020/replaced.rs b/components/layout/replaced.rs similarity index 100% rename from components/layout_2020/replaced.rs rename to components/layout/replaced.rs diff --git a/components/layout_2020/sizing.rs b/components/layout/sizing.rs similarity index 100% rename from components/layout_2020/sizing.rs rename to components/layout/sizing.rs diff --git a/components/layout_2020/style_ext.rs b/components/layout/style_ext.rs similarity index 100% rename from components/layout_2020/style_ext.rs rename to components/layout/style_ext.rs diff --git a/components/layout_2020/table/construct.rs b/components/layout/table/construct.rs similarity index 100% rename from components/layout_2020/table/construct.rs rename to components/layout/table/construct.rs diff --git a/components/layout_2020/table/layout.rs b/components/layout/table/layout.rs similarity index 100% rename from components/layout_2020/table/layout.rs rename to components/layout/table/layout.rs diff --git a/components/layout_2020/table/mod.rs b/components/layout/table/mod.rs similarity index 100% rename from components/layout_2020/table/mod.rs rename to components/layout/table/mod.rs diff --git a/components/layout_2020/taffy/layout.rs b/components/layout/taffy/layout.rs similarity index 99% rename from components/layout_2020/taffy/layout.rs rename to components/layout/taffy/layout.rs index 6bb4f06dcd1..a7581136bf2 100644 --- a/components/layout_2020/taffy/layout.rs +++ b/components/layout/taffy/layout.rs @@ -133,7 +133,7 @@ impl taffy::LayoutPartialTree for TaffyContainerContext<'_> { with_independant_formatting_context( &mut child.taffy_level_box, |independent_context| -> taffy::LayoutOutput { - // TODO: re-evaluate sizing constraint conversions in light of recent layout_2020 changes + // TODO: re-evaluate sizing constraint conversions in light of recent layout changes let containing_block = &self.content_box_size_override; let style = independent_context.style(); diff --git a/components/layout_2020/taffy/mod.rs b/components/layout/taffy/mod.rs similarity index 100% rename from components/layout_2020/taffy/mod.rs rename to components/layout/taffy/mod.rs diff --git a/components/layout_2020/taffy/stylo_taffy/convert.rs b/components/layout/taffy/stylo_taffy/convert.rs similarity index 100% rename from components/layout_2020/taffy/stylo_taffy/convert.rs rename to components/layout/taffy/stylo_taffy/convert.rs diff --git a/components/layout_2020/taffy/stylo_taffy/mod.rs b/components/layout/taffy/stylo_taffy/mod.rs similarity index 100% rename from components/layout_2020/taffy/stylo_taffy/mod.rs rename to components/layout/taffy/stylo_taffy/mod.rs diff --git a/components/layout_2020/taffy/stylo_taffy/wrapper.rs b/components/layout/taffy/stylo_taffy/wrapper.rs similarity index 100% rename from components/layout_2020/taffy/stylo_taffy/wrapper.rs rename to components/layout/taffy/stylo_taffy/wrapper.rs diff --git a/components/layout_2020/tests/floats.rs b/components/layout/tests/floats.rs similarity index 99% rename from components/layout_2020/tests/floats.rs rename to components/layout/tests/floats.rs index 9cf8df6ecfb..018da593e90 100644 --- a/components/layout_2020/tests/floats.rs +++ b/components/layout/tests/floats.rs @@ -11,11 +11,11 @@ use std::sync::{Mutex, MutexGuard}; use std::{thread, u32}; use app_units::Au; -use layout_2020::flow::float::{ +use layout::flow::float::{ Clear, ContainingBlockPositionInfo, FloatBand, FloatBandNode, FloatBandTree, FloatContext, FloatSide, PlacementInfo, }; -use layout_2020::geom::{LogicalRect, LogicalVec2}; +use layout::geom::{LogicalRect, LogicalVec2}; use num_traits::identities::Zero; use quickcheck::{Arbitrary, Gen}; diff --git a/components/layout_2020/tests/tables.rs b/components/layout/tests/tables.rs similarity index 98% rename from components/layout_2020/tests/tables.rs rename to components/layout/tests/tables.rs index 559a409d19b..0c4549c34ee 100644 --- a/components/layout_2020/tests/tables.rs +++ b/components/layout/tests/tables.rs @@ -6,8 +6,8 @@ mod tables { use euclid::Vector2D; - use layout_2020::ArcRefCell; - use layout_2020::table::{Table, TableBuilder, TableSlot, TableSlotCell, TableSlotOffset}; + use layout::ArcRefCell; + use layout::table::{Table, TableBuilder, TableSlot, TableSlotCell, TableSlotOffset}; fn row_lengths(table: &Table) -> Vec { table.slots.iter().map(|row| row.len()).collect() diff --git a/components/layout_2020/tests/text.rs b/components/layout/tests/text.rs similarity index 97% rename from components/layout_2020/tests/text.rs rename to components/layout/tests/text.rs index 74ed9c6d263..4d4407c9500 100644 --- a/components/layout_2020/tests/text.rs +++ b/components/layout/tests/text.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ mod text { - use layout_2020::flow::inline::construct::WhitespaceCollapse; + use layout::flow::inline::construct::WhitespaceCollapse; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; #[test] diff --git a/components/layout_2020/traversal.rs b/components/layout/traversal.rs similarity index 100% rename from components/layout_2020/traversal.rs rename to components/layout/traversal.rs diff --git a/components/layout_thread_2020/Cargo.toml b/components/layout_thread_2020/Cargo.toml deleted file mode 100644 index dba63a79404..00000000000 --- a/components/layout_thread_2020/Cargo.toml +++ /dev/null @@ -1,48 +0,0 @@ -[package] -name = "layout_thread_2020" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true -publish.workspace = true -rust-version.workspace = true - -[lib] -name = "layout_thread_2020" -path = "lib.rs" - -[features] -tracing = ["dep:tracing", "layout/tracing"] - -[dependencies] -app_units = { workspace = true } -base = { workspace = true } -compositing_traits = { workspace = true } -constellation_traits = { workspace = true } -embedder_traits = { workspace = true } -euclid = { workspace = true } -fnv = { workspace = true } -fonts = { path = "../fonts" } -fonts_traits = { workspace = true } -fxhash = { workspace = true } -ipc-channel = { workspace = true } -layout = { path = "../layout_2020", package = "layout_2020" } -log = { workspace = true } -malloc_size_of = { workspace = true } -metrics = { path = "../metrics" } -net_traits = { workspace = true } -parking_lot = { workspace = true } -profile_traits = { workspace = true } -script = { path = "../script" } -script_layout_interface = { workspace = true } -script_traits = { workspace = true } -servo_allocator = { path = "../allocator" } -servo_arc = { workspace = true } -servo_config = { path = "../config" } -servo_url = { path = "../url" } -stylo = { workspace = true } -stylo_atoms = { workspace = true } -stylo_traits = { workspace = true } -tracing = { workspace = true, optional = true } -url = { workspace = true } -webrender_api = { workspace = true } diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 49669a0b376..0c4eaf40904 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -34,7 +34,15 @@ no-wgl = ["mozangle/egl", "mozangle/build_dlls", "surfman/sm-angle-default", "co dynamic_freetype = ["webrender/dynamic_freetype"] profilemozjs = ["script/profilemozjs"] refcell_backtrace = ["script/refcell_backtrace"] -tracing = ["dep:tracing", "compositing/tracing", "constellation/tracing", "fonts/tracing", "layout_thread_2020/tracing", "profile_traits/tracing", "script/tracing"] +tracing = [ + "dep:tracing", + "compositing/tracing", + "constellation/tracing", + "fonts/tracing", + "layout/tracing", + "profile_traits/tracing", + "script/tracing", +] webdriver = ["webdriver_server"] webgl_backtrace = [ "script/webgl_backtrace", @@ -79,7 +87,7 @@ gleam = { workspace = true } gstreamer = { workspace = true, optional = true } ipc-channel = { workspace = true } keyboard-types = { workspace = true } -layout_thread_2020 = { path = "../layout_thread_2020" } +layout = { path = "../layout" } log = { workspace = true } media = { path = "../media" } mozangle = { workspace = true } diff --git a/components/servo/lib.rs b/components/servo/lib.rs index eea9f414dfe..be56ffd5c1f 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -84,6 +84,7 @@ use gleam::gl::RENDERER; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; pub use keyboard_types::*; +use layout::LayoutFactoryImpl; use log::{Log, Metadata, Record, debug, warn}; use media::{GlApi, NativeDisplay, WindowGLContext}; use net::protocols::ProtocolRegistry; @@ -109,9 +110,9 @@ use webview::WebViewInner; pub use webxr; pub use { background_hang_monitor, base, canvas, canvas_traits, devtools, devtools_traits, euclid, fonts, - ipc_channel, layout_thread_2020, media, net, net_traits, profile, profile_traits, script, - script_layout_interface, script_traits, servo_config as config, servo_config, servo_geometry, - servo_url, style, style_traits, webrender_api, + ipc_channel, media, net, net_traits, profile, profile_traits, script, script_layout_interface, + script_traits, servo_config as config, servo_config, servo_geometry, servo_url, style, + style_traits, webrender_api, }; #[cfg(feature = "bluetooth")] pub use {bluetooth, bluetooth_traits}; @@ -1079,7 +1080,7 @@ fn create_constellation( user_content_manager, }; - let layout_factory = Arc::new(layout_thread_2020::LayoutFactoryImpl()); + let layout_factory = Arc::new(LayoutFactoryImpl()); Constellation::::start( initial_state, @@ -1156,7 +1157,7 @@ pub fn run_content_process(token: String) { set_logger(content.script_to_constellation_chan().clone()); let background_hang_monitor_register = content.register_with_background_hang_monitor(); - let layout_factory = Arc::new(layout_thread_2020::LayoutFactoryImpl()); + let layout_factory = Arc::new(LayoutFactoryImpl()); content.register_system_memory_reporter(); diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 33e088fe71f..7d91a190bd1 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -168,7 +168,7 @@ class MachCommands(CommandBase): "devtools", "fonts", "hyper_serde", - "layout_2020", + "layout", "libservo", "metrics", "net",