diff options
-rw-r--r-- | Cargo.lock | 46 | ||||
-rw-r--r-- | components/layout/Cargo.toml (renamed from components/layout_2020/Cargo.toml) | 9 | ||||
-rw-r--r-- | components/layout/cell.rs (renamed from components/layout_2020/cell.rs) | 0 | ||||
-rw-r--r-- | components/layout/construct_modern.rs (renamed from components/layout_2020/construct_modern.rs) | 0 | ||||
-rw-r--r-- | components/layout/context.rs (renamed from components/layout_2020/context.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/background.rs (renamed from components/layout_2020/display_list/background.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/clip_path.rs (renamed from components/layout_2020/display_list/clip_path.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/conversions.rs (renamed from components/layout_2020/display_list/conversions.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/gradient.rs (renamed from components/layout_2020/display_list/gradient.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/mod.rs (renamed from components/layout_2020/display_list/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/display_list/stacking_context.rs (renamed from components/layout_2020/display_list/stacking_context.rs) | 0 | ||||
-rw-r--r-- | components/layout/dom.rs (renamed from components/layout_2020/dom.rs) | 0 | ||||
-rw-r--r-- | components/layout/dom_traversal.rs (renamed from components/layout_2020/dom_traversal.rs) | 0 | ||||
-rw-r--r-- | components/layout/flexbox/geom.rs (renamed from components/layout_2020/flexbox/geom.rs) | 0 | ||||
-rw-r--r-- | components/layout/flexbox/layout.rs (renamed from components/layout_2020/flexbox/layout.rs) | 0 | ||||
-rw-r--r-- | components/layout/flexbox/mod.rs (renamed from components/layout_2020/flexbox/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/construct.rs (renamed from components/layout_2020/flow/construct.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/float.rs (renamed from components/layout_2020/flow/float.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/construct.rs (renamed from components/layout_2020/flow/inline/construct.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/inline_box.rs (renamed from components/layout_2020/flow/inline/inline_box.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/line.rs (renamed from components/layout_2020/flow/inline/line.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/line_breaker.rs (renamed from components/layout_2020/flow/inline/line_breaker.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/mod.rs (renamed from components/layout_2020/flow/inline/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/inline/text_run.rs (renamed from components/layout_2020/flow/inline/text_run.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/mod.rs (renamed from components/layout_2020/flow/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/flow/root.rs (renamed from components/layout_2020/flow/root.rs) | 0 | ||||
-rw-r--r-- | components/layout/formatting_contexts.rs (renamed from components/layout_2020/formatting_contexts.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/base_fragment.rs (renamed from components/layout_2020/fragment_tree/base_fragment.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/box_fragment.rs (renamed from components/layout_2020/fragment_tree/box_fragment.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/containing_block.rs (renamed from components/layout_2020/fragment_tree/containing_block.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/fragment.rs (renamed from components/layout_2020/fragment_tree/fragment.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/fragment_tree.rs (renamed from components/layout_2020/fragment_tree/fragment_tree.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/hoisted_shared_fragment.rs (renamed from components/layout_2020/fragment_tree/hoisted_shared_fragment.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/mod.rs (renamed from components/layout_2020/fragment_tree/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/fragment_tree/positioning_fragment.rs (renamed from components/layout_2020/fragment_tree/positioning_fragment.rs) | 0 | ||||
-rw-r--r-- | components/layout/geom.rs (renamed from components/layout_2020/geom.rs) | 0 | ||||
-rw-r--r-- | components/layout/layout_box_base.rs (renamed from components/layout_2020/layout_box_base.rs) | 0 | ||||
-rw-r--r-- | components/layout/layout_impl.rs (renamed from components/layout_thread_2020/lib.rs) | 35 | ||||
-rw-r--r-- | components/layout/lib.rs (renamed from components/layout_2020/lib.rs) | 5 | ||||
-rw-r--r-- | components/layout/lists.rs (renamed from components/layout_2020/lists.rs) | 0 | ||||
-rw-r--r-- | components/layout/positioned.rs (renamed from components/layout_2020/positioned.rs) | 0 | ||||
-rw-r--r-- | components/layout/query.rs (renamed from components/layout_2020/query.rs) | 0 | ||||
-rw-r--r-- | components/layout/quotes.rs (renamed from components/layout_2020/quotes.rs) | 0 | ||||
-rw-r--r-- | components/layout/replaced.rs (renamed from components/layout_2020/replaced.rs) | 0 | ||||
-rw-r--r-- | components/layout/sizing.rs (renamed from components/layout_2020/sizing.rs) | 0 | ||||
-rw-r--r-- | components/layout/style_ext.rs (renamed from components/layout_2020/style_ext.rs) | 0 | ||||
-rw-r--r-- | components/layout/table/construct.rs (renamed from components/layout_2020/table/construct.rs) | 0 | ||||
-rw-r--r-- | components/layout/table/layout.rs (renamed from components/layout_2020/table/layout.rs) | 0 | ||||
-rw-r--r-- | components/layout/table/mod.rs (renamed from components/layout_2020/table/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/taffy/layout.rs (renamed from components/layout_2020/taffy/layout.rs) | 2 | ||||
-rw-r--r-- | components/layout/taffy/mod.rs (renamed from components/layout_2020/taffy/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/taffy/stylo_taffy/convert.rs (renamed from components/layout_2020/taffy/stylo_taffy/convert.rs) | 0 | ||||
-rw-r--r-- | components/layout/taffy/stylo_taffy/mod.rs (renamed from components/layout_2020/taffy/stylo_taffy/mod.rs) | 0 | ||||
-rw-r--r-- | components/layout/taffy/stylo_taffy/wrapper.rs (renamed from components/layout_2020/taffy/stylo_taffy/wrapper.rs) | 0 | ||||
-rw-r--r-- | components/layout/tests/floats.rs (renamed from components/layout_2020/tests/floats.rs) | 4 | ||||
-rw-r--r-- | components/layout/tests/tables.rs (renamed from components/layout_2020/tests/tables.rs) | 4 | ||||
-rw-r--r-- | components/layout/tests/text.rs (renamed from components/layout_2020/tests/text.rs) | 2 | ||||
-rw-r--r-- | components/layout/traversal.rs (renamed from components/layout_2020/traversal.rs) | 0 | ||||
-rw-r--r-- | components/layout_thread_2020/Cargo.toml | 48 | ||||
-rw-r--r-- | components/servo/Cargo.toml | 12 | ||||
-rw-r--r-- | components/servo/lib.rs | 11 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 2 |
62 files changed, 58 insertions, 122 deletions
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", @@ -4191,43 +4196,6 @@ dependencies = [ ] [[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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -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 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 index 8b35fdf7943..8b35fdf7943 100644 --- a/components/layout_2020/cell.rs +++ b/components/layout/cell.rs diff --git a/components/layout_2020/construct_modern.rs b/components/layout/construct_modern.rs index 22f179d146c..22f179d146c 100644 --- a/components/layout_2020/construct_modern.rs +++ b/components/layout/construct_modern.rs diff --git a/components/layout_2020/context.rs b/components/layout/context.rs index 71372ffe224..71372ffe224 100644 --- a/components/layout_2020/context.rs +++ b/components/layout/context.rs diff --git a/components/layout_2020/display_list/background.rs b/components/layout/display_list/background.rs index f49ddfbe6ce..f49ddfbe6ce 100644 --- a/components/layout_2020/display_list/background.rs +++ b/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 index 419d15c3572..419d15c3572 100644 --- a/components/layout_2020/display_list/clip_path.rs +++ b/components/layout/display_list/clip_path.rs diff --git a/components/layout_2020/display_list/conversions.rs b/components/layout/display_list/conversions.rs index 6d78a17e886..6d78a17e886 100644 --- a/components/layout_2020/display_list/conversions.rs +++ b/components/layout/display_list/conversions.rs diff --git a/components/layout_2020/display_list/gradient.rs b/components/layout/display_list/gradient.rs index 32d011b4454..32d011b4454 100644 --- a/components/layout_2020/display_list/gradient.rs +++ b/components/layout/display_list/gradient.rs diff --git a/components/layout_2020/display_list/mod.rs b/components/layout/display_list/mod.rs index fa313b306f4..fa313b306f4 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/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 index 0c0def9a563..0c0def9a563 100644 --- a/components/layout_2020/display_list/stacking_context.rs +++ b/components/layout/display_list/stacking_context.rs diff --git a/components/layout_2020/dom.rs b/components/layout/dom.rs index 39cd74293c8..39cd74293c8 100644 --- a/components/layout_2020/dom.rs +++ b/components/layout/dom.rs diff --git a/components/layout_2020/dom_traversal.rs b/components/layout/dom_traversal.rs index 42101e3edbc..42101e3edbc 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout/dom_traversal.rs diff --git a/components/layout_2020/flexbox/geom.rs b/components/layout/flexbox/geom.rs index 90145dceafe..90145dceafe 100644 --- a/components/layout_2020/flexbox/geom.rs +++ b/components/layout/flexbox/geom.rs diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout/flexbox/layout.rs index 77069236787..77069236787 100644 --- a/components/layout_2020/flexbox/layout.rs +++ b/components/layout/flexbox/layout.rs diff --git a/components/layout_2020/flexbox/mod.rs b/components/layout/flexbox/mod.rs index e1f8213f1e9..e1f8213f1e9 100644 --- a/components/layout_2020/flexbox/mod.rs +++ b/components/layout/flexbox/mod.rs diff --git a/components/layout_2020/flow/construct.rs b/components/layout/flow/construct.rs index a6471756db8..a6471756db8 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout/flow/construct.rs diff --git a/components/layout_2020/flow/float.rs b/components/layout/flow/float.rs index 0570ce0d0f4..0570ce0d0f4 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout/flow/float.rs diff --git a/components/layout_2020/flow/inline/construct.rs b/components/layout/flow/inline/construct.rs index 7c668751ef6..7c668751ef6 100644 --- a/components/layout_2020/flow/inline/construct.rs +++ b/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 index 97398d6e708..97398d6e708 100644 --- a/components/layout_2020/flow/inline/inline_box.rs +++ b/components/layout/flow/inline/inline_box.rs diff --git a/components/layout_2020/flow/inline/line.rs b/components/layout/flow/inline/line.rs index c42f32c9242..c42f32c9242 100644 --- a/components/layout_2020/flow/inline/line.rs +++ b/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 index 28301fdadf8..28301fdadf8 100644 --- a/components/layout_2020/flow/inline/line_breaker.rs +++ b/components/layout/flow/inline/line_breaker.rs diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout/flow/inline/mod.rs index 490917d95a3..490917d95a3 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/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 index 0d0c6398017..0d0c6398017 100644 --- a/components/layout_2020/flow/inline/text_run.rs +++ b/components/layout/flow/inline/text_run.rs diff --git a/components/layout_2020/flow/mod.rs b/components/layout/flow/mod.rs index f92650ef340..f92650ef340 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout/flow/mod.rs diff --git a/components/layout_2020/flow/root.rs b/components/layout/flow/root.rs index 390b4664e60..390b4664e60 100644 --- a/components/layout_2020/flow/root.rs +++ b/components/layout/flow/root.rs diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout/formatting_contexts.rs index 4661c44592c..4661c44592c 100644 --- a/components/layout_2020/formatting_contexts.rs +++ b/components/layout/formatting_contexts.rs diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout/fragment_tree/base_fragment.rs index 48d672a8547..48d672a8547 100644 --- a/components/layout_2020/fragment_tree/base_fragment.rs +++ b/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 index 30be154caf1..30be154caf1 100644 --- a/components/layout_2020/fragment_tree/box_fragment.rs +++ b/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 index 6edd9bb379b..6edd9bb379b 100644 --- a/components/layout_2020/fragment_tree/containing_block.rs +++ b/components/layout/fragment_tree/containing_block.rs diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout/fragment_tree/fragment.rs index d0d1b9b1104..d0d1b9b1104 100644 --- a/components/layout_2020/fragment_tree/fragment.rs +++ b/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 index bb3c659466c..bb3c659466c 100644 --- a/components/layout_2020/fragment_tree/fragment_tree.rs +++ b/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 index fa3862058da..fa3862058da 100644 --- a/components/layout_2020/fragment_tree/hoisted_shared_fragment.rs +++ b/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 index 8738f2a6af7..8738f2a6af7 100644 --- a/components/layout_2020/fragment_tree/mod.rs +++ b/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 index 853caed6709..853caed6709 100644 --- a/components/layout_2020/fragment_tree/positioning_fragment.rs +++ b/components/layout/fragment_tree/positioning_fragment.rs diff --git a/components/layout_2020/geom.rs b/components/layout/geom.rs index 49f031cbd18..49f031cbd18 100644 --- a/components/layout_2020/geom.rs +++ b/components/layout/geom.rs diff --git a/components/layout_2020/layout_box_base.rs b/components/layout/layout_box_base.rs index 71fbfdeced1..71fbfdeced1 100644 --- a/components/layout_2020/layout_box_base.rs +++ b/components/layout/layout_box_base.rs diff --git a/components/layout_thread_2020/lib.rs b/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 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 index d5a1f863865..d5a1f863865 100644 --- a/components/layout_2020/lists.rs +++ b/components/layout/lists.rs diff --git a/components/layout_2020/positioned.rs b/components/layout/positioned.rs index 5f08e4e86c5..5f08e4e86c5 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout/positioned.rs diff --git a/components/layout_2020/query.rs b/components/layout/query.rs index 08b264deea9..08b264deea9 100644 --- a/components/layout_2020/query.rs +++ b/components/layout/query.rs diff --git a/components/layout_2020/quotes.rs b/components/layout/quotes.rs index 05e9e06fe89..05e9e06fe89 100644 --- a/components/layout_2020/quotes.rs +++ b/components/layout/quotes.rs diff --git a/components/layout_2020/replaced.rs b/components/layout/replaced.rs index 6a6b1979ff9..6a6b1979ff9 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout/replaced.rs diff --git a/components/layout_2020/sizing.rs b/components/layout/sizing.rs index c6e4b7f9498..c6e4b7f9498 100644 --- a/components/layout_2020/sizing.rs +++ b/components/layout/sizing.rs diff --git a/components/layout_2020/style_ext.rs b/components/layout/style_ext.rs index c28511766b2..c28511766b2 100644 --- a/components/layout_2020/style_ext.rs +++ b/components/layout/style_ext.rs diff --git a/components/layout_2020/table/construct.rs b/components/layout/table/construct.rs index f20360d3b56..f20360d3b56 100644 --- a/components/layout_2020/table/construct.rs +++ b/components/layout/table/construct.rs diff --git a/components/layout_2020/table/layout.rs b/components/layout/table/layout.rs index 57b48ae0bca..57b48ae0bca 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout/table/layout.rs diff --git a/components/layout_2020/table/mod.rs b/components/layout/table/mod.rs index 120270fc7cf..120270fc7cf 100644 --- a/components/layout_2020/table/mod.rs +++ b/components/layout/table/mod.rs diff --git a/components/layout_2020/taffy/layout.rs b/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 index 55a678cd89a..55a678cd89a 100644 --- a/components/layout_2020/taffy/mod.rs +++ b/components/layout/taffy/mod.rs diff --git a/components/layout_2020/taffy/stylo_taffy/convert.rs b/components/layout/taffy/stylo_taffy/convert.rs index 03fbec292a4..03fbec292a4 100644 --- a/components/layout_2020/taffy/stylo_taffy/convert.rs +++ b/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 index 05eece6ace7..05eece6ace7 100644 --- a/components/layout_2020/taffy/stylo_taffy/mod.rs +++ b/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 index 35b19aa7838..35b19aa7838 100644 --- a/components/layout_2020/taffy/stylo_taffy/wrapper.rs +++ b/components/layout/taffy/stylo_taffy/wrapper.rs diff --git a/components/layout_2020/tests/floats.rs b/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 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<usize> { table.slots.iter().map(|row| row.len()).collect() diff --git a/components/layout_2020/tests/text.rs b/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 index 40281b640c9..40281b640c9 100644 --- a/components/layout_2020/traversal.rs +++ b/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::<script::ScriptThread, script::ServiceWorkerManager>::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", |