Truly independent web browser
LibWeb: Hand a block-level run its inline size in its input cells
Aliaksandr Kalenik4b962852c071
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rsindex c289409ff9b..2e8e874e9a1 100644--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs@@ -2805,9 +2805,13 @@ impl<'pass> BlockFormattingContext<'pass> {containing_block_rect_in_root_now,&mut probe,);- if !has_independent_formatting_context && let Some(content_inline_size) = probe.content_inline_size {- self.cells_laid_out_here(sized_child)- .set_content_inline_size(content_inline_size);+ if let Some(content_inline_size) = probe.content_inline_size {+ self.update_cells_of(sized_child, |cells| cells.set_content_inline_size(content_inline_size));+ } else {+ debug_assert!(+ !has_independent_formatting_context || !facts.is_table_wrapper(),+ "a block-level table wrapper arrives at its run with the inline size its parent resolved for it"+ );}let content_inline_size_now = probe.content_inline_size@@ -2949,9 +2953,6 @@ impl<'pass> BlockFormattingContext<'pass> {} else {geometry::PackedOptionalCssPixels::from(None)},- block_parent_resolved_content_inline_size: geometry::PackedOptionalCssPixels::from(- probe.content_inline_size,- ),table_box_content_block_offset_in_wrapper: geometry::PackedOptionalCssPixels::from(is_table_formatting_context.then_some(content_block_offset),),diff --git a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rsindex 69d1fe1b5f6..8a86f41e74d 100644--- a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs+++ b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs@@ -76,7 +76,6 @@ fn root_input_cells_match_ignoring_unobserved(return cells;}used_values::RootInputCells {- content_inline_size: CssPixels::default(),margin_left: CssPixels::default(),margin_right: CssPixels::default(),..cells@@ -289,7 +288,6 @@ fn sizing_directives_match_ignoring_unobserved(let RootSizingDirectives {forced_content_block_size,forced_min_border_box_block_size,- block_parent_resolved_content_inline_size,table_box_content_block_offset_in_wrapper,content_block_size_after_run,outer_float_intrusion_before_list_item_children,@@ -299,7 +297,6 @@ fn sizing_directives_match_ignoring_unobserved(} = *a;forced_content_block_size == b.forced_content_block_size&& forced_min_border_box_block_size == b.forced_min_border_box_block_size- && block_parent_resolved_content_inline_size == b.block_parent_resolved_content_inline_size&& table_box_content_block_offset_in_wrapper == b.table_box_content_block_offset_in_wrapper&& (content_block_size_after_run == b.content_block_size_after_run|| content_block_size_adopted_after_run_unobserved)diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rsindex 38cea889fdc..b3c011ee410 100644--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs@@ -1771,9 +1771,9 @@ fn dimension_block_level_root(body_input}-/// Gives the root of a block-level run the inline size its block formatting context resolved for it, and resolves its-/// block size where that follows without laying out its contents. Answers the space a flex root resolves its own-/// automatic block size in, if it does.+/// Resolves the block size of the root of a block-level run, which arrives with the inline size its block formatting+/// context resolved for it, where that follows without laying out its contents. Answers the space a flex root resolves+/// its own automatic block size in, if it does.fn size_block_level_root_ahead_of_its_contents(run: &FormattingContextRun,sized_root: sizing_context::SizedCells<'_>,@@ -1784,9 +1784,6 @@ fn size_block_level_root_ahead_of_its_contents(let constraints = input.containing_block_constraints;let sizing = run.sizing();let facts = NodeFacts::new(&run.callbacks, node);- if let Some(content_inline_size) = input.sizing.block_parent_resolved_content_inline_size.get() {- root.set_content_inline_size(content_inline_size);- }let flex_self_resolution_space =flex_self_block_size_resolution_space(&sizing, sized_root.sized_box(), input.available_space, constraints);let resolution_space = sizing.available_space_for_block_size_resolution(node, input.available_space, constraints);@@ -3379,7 +3376,6 @@ fn is_run_of_table_wrapper_sized_by_its_parent() -> bool {fc_type == FormattingContextType::Block&& input.participation == ParticipationInParentFormattingContext::BlockLevel- && input.sizing.block_parent_resolved_content_inline_size.is_some()&& NodeFacts::new(&run.callbacks, run.box_).is_table_wrapper()}diff --git a/Libraries/LibWeb/Rust/src/layout/geometry.rs b/Libraries/LibWeb/Rust/src/layout/geometry.rsindex c144e35ba19..987908d68b8 100644--- a/Libraries/LibWeb/Rust/src/layout/geometry.rs+++ b/Libraries/LibWeb/Rust/src/layout/geometry.rs@@ -328,10 +328,6 @@ impl PackedOptionalCssPixels {(self.0 != Self::NONE_RAW_VALUE).then(|| CssPixels::from_raw(self.0))}- pub(crate) fn is_some(self) -> bool {- self.0 != Self::NONE_RAW_VALUE- }-pub(crate) fn is_none(self) -> bool {self.0 == Self::NONE_RAW_VALUE}@@ -357,9 +353,6 @@ pub(crate) struct RootSizingDirectives {// Input-only: a fieldset's content wrapper fills the fieldset's definite content block size.pub(crate) forced_content_block_size: PackedOptionalCssPixels,pub(crate) forced_min_border_box_block_size: PackedOptionalCssPixels,- // Input-only: the parent block formatting context supplies the inline size it resolved while- // positioning an independent child, so the child's run prelude can commit it without resolving it again.- pub(crate) block_parent_resolved_content_inline_size: PackedOptionalCssPixels,// Input-only: the wrapper's BFC tells the table formatting context where the table box's// content box sits in the wrapper, so rows and row groups (whose containing block is the// wrapper) can be placed in wrapper coordinates.