Skip to content

Truly independent web browser

LibWeb: Place a replaced box's content wrapper from its value

Aliaksandr Kalenik10329f6f7403
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index 22936a834fe..f0e974cba8e 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -2108,6 +2108,11 @@ pub(crate) struct ChildRunOutcome {
}
impl ChildRunOutcome {
+ /// What placing the child in `run` takes of the box its run hands back.
+ pub(crate) fn placed_child_in(&self, run: &FormattingContextRun) -> PlacedChild {
+ PlacedChild::of_laid_out_box(&self.laid_out_box, self.line_data.clone(), run.callbacks.frame)
+ }
+
/// Hands the laid out box to `run`, the run that holds `child`, and returns the rest of the outcome.
pub(crate) fn hand_box_back_to(
self,
diff --git a/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs
index 57d3ef07299..ffd2b1fde95 100644
--- a/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs
@@ -46,7 +46,7 @@ pub(super) fn layout_replaced_with_children(
.keep_child_for_its_run(&run.callbacks, wrapper, wrapper_constraints);
wrapper_cells.set_content_inline_size(content_inline_size);
- let (wrapper_result, fragment_arrival) = formatting_context::run_formatting_context(
+ let wrapper_outcome = formatting_context::run_formatting_context(
run.fragments.as_deref(),
wrapper_cells,
wrapper,
@@ -65,8 +65,9 @@ pub(super) fn layout_replaced_with_children(
participation: geometry::ParticipationInParentFormattingContext::Item,
},
None,
- )
- .hand_box_back_to(run, wrapper);
+ );
+ let placed_wrapper = wrapper_outcome.placed_child_in(run);
+ let (wrapper_result, fragment_arrival) = wrapper_outcome.hand_box_back_to(run, wrapper);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
run.records,
&run.callbacks,
@@ -76,7 +77,7 @@ pub(super) fn layout_replaced_with_children(
formatting_context::place_laid_out_child(
run,
wrapper,
- formatting_context::PlacedChild::read_from_records(run, wrapper),
+ placed_wrapper,
used_values::FfiCssPixelPoint::default(),
None,
fragment_arrival,