Skip to content

Truly independent web browser

LibWeb: Name what a layout run keeps after its purpose

Aliaksandr Kalenik513e8ae8c517
diff --git a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
index a757703a7c0..494bcea02f5 100644
--- a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
+++ b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
@@ -137,14 +137,14 @@ pub(crate) struct OutOfFlowBox<'a> {
pub(crate) node: Node,
pub(crate) cells: &'a Cell<used_values::RootInputCells>,
pub(crate) frame: geometry::Frame,
- used_insets: &'a Cell<run_records::UsedInsets>,
+ used_insets: &'a Cell<run_state::UsedInsets>,
anchor_resolved_values: Option<&'a style_values::AnchorResolvedValues>,
}
impl<'a> OutOfFlowBox<'a> {
pub(crate) fn new(
sized: sizing_context::SizedCells<'a>,
- used_insets: &'a Cell<run_records::UsedInsets>,
+ used_insets: &'a Cell<run_state::UsedInsets>,
anchor_resolved_values: Option<&'a style_values::AnchorResolvedValues>,
) -> Self {
Self {
@@ -166,7 +166,7 @@ impl<'a> OutOfFlowBox<'a> {
}
pub(crate) struct AbsposEngine<'pass> {
- records: &'pass RunRecords<'pass>,
+ state: &'pass RunState<'pass>,
callbacks: LayoutPass<'pass>,
fragments: Option<std::rc::Rc<fragment_tree::RunFragmentBuilder>>,
}
@@ -174,7 +174,7 @@ pub(crate) struct AbsposEngine<'pass> {
impl<'pass> AbsposEngine<'pass> {
pub(crate) fn for_run(run: &FormattingContextRun<'pass>) -> Self {
Self {
- records: run.records,
+ state: run.state,
callbacks: run.callbacks,
fragments: run.fragments.clone(),
}
@@ -247,7 +247,7 @@ impl<'pass> AbsposEngine<'pass> {
return FfiCssPixelPoint::default();
}
let mut merge_point = from_space;
- while merge_point != to_space && !self.callbacks.is_ancestor(merge_point, to_space, self.records.root()) {
+ while merge_point != to_space && !self.callbacks.is_ancestor(merge_point, to_space, self.state.root()) {
merge_point = self.placement_containing_block(merge_point);
assert!(!merge_point.is_invalid());
}
@@ -280,7 +280,7 @@ impl<'pass> AbsposEngine<'pass> {
}
/// Where the run placed `node`, if it placed the box.
- fn placement_of(&self, node: Node) -> Option<run_records::BoxPlacement> {
+ fn placement_of(&self, node: Node) -> Option<run_state::BoxPlacement> {
self.placed_box_fragments().placement_of(node)
}
@@ -291,7 +291,7 @@ impl<'pass> AbsposEngine<'pass> {
#[inline]
fn sizing(&self) -> sizing_context::SizingContext<'pass, 'static> {
- sizing_context::SizingContext::new(self.records, self.callbacks)
+ sizing_context::SizingContext::new(self.state, self.callbacks)
}
#[inline]
@@ -542,7 +542,7 @@ impl AbsposEngine<'_> {
if self.facts(ancestor).is_scroll_container() {
return ancestor;
}
- if ancestor == self.records.root() {
+ if ancestor == self.state.root() {
break;
}
ancestor = self.placement_containing_block(ancestor);
@@ -2290,7 +2290,7 @@ impl AbsposEngine<'_> {
fn set_used_inline_insets(sized: OutOfFlowBox<'_>, left: CssPixels, right: CssPixels) {
let insets = sized.used_insets;
- insets.set(run_records::UsedInsets {
+ insets.set(run_state::UsedInsets {
left,
right,
..insets.get()
@@ -2299,7 +2299,7 @@ impl AbsposEngine<'_> {
fn set_used_block_insets(sized: OutOfFlowBox<'_>, top: CssPixels, bottom: CssPixels) {
let insets = sized.used_insets;
- insets.set(run_records::UsedInsets {
+ insets.set(run_state::UsedInsets {
top,
bottom,
..insets.get()
@@ -3862,7 +3862,7 @@ impl<'pass> AbsposEngine<'pass> {
return insets;
}
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- self.records,
+ self.state,
&self.callbacks,
node,
false,
@@ -3899,7 +3899,7 @@ impl<'pass> AbsposEngine<'pass> {
block_axis_inset_value(style.inset_bottom(), treat_block_axis_percentage_insets_as_auto),
percentage_basis.block_size,
);
- insets.used_insets = Some(run_records::UsedInsets {
+ insets.used_insets = Some(run_state::UsedInsets {
left,
right,
top,
@@ -3910,14 +3910,14 @@ impl<'pass> AbsposEngine<'pass> {
}
pub(crate) fn drain_abspos_with_placed_containing_blocks(
- records: &RunRecords<'_>,
+ state: &RunState<'_>,
callbacks: LayoutPass<'_>,
should_collect_devtools_layout_data: bool,
entry_fragments: &std::rc::Rc<fragment_tree::RunFragmentBuilder>,
) {
let accumulator_root = entry_fragments.root_node();
let run = FormattingContextRun {
- records,
+ state,
box_: accumulator_root,
callbacks,
should_collect_devtools_layout_data,
@@ -3938,7 +3938,7 @@ pub(crate) fn drain_abspos_with_placed_containing_blocks(
/// its anchor() insets compensate for.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(crate) struct InFlowBoxInsets {
- pub(crate) used_insets: Option<run_records::UsedInsets>,
+ pub(crate) used_insets: Option<run_state::UsedInsets>,
pub(crate) default_scroll_shift: Option<abspos_inputs::DefaultScrollShift>,
}
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index fdc2d0d601f..3f75ff966c9 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -156,9 +156,9 @@ struct LaidOutBlockLevelBox {
collapses_through: bool,
/// The box as its layout left it: as a run of its own handed it back, or as this flow laid it out in cells its
/// layout owns.
- laid_out_box: run_records::LaidOutChildBox,
+ laid_out_box: run_state::LaidOutChildBox,
/// What this flow decided the box's fragment shows of it.
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
/// The offset of the content box in the containing block, where this flow placed the box.
content_offset: Option<FfiCssPixelPoint>,
/// The block end of the margin box in the containing block, where this flow found it.
@@ -170,8 +170,8 @@ impl LaidOutBlockLevelBox {
/// A box laid out as `laid_out_box` with `fragment_facts`, which neither broke inside nor let margins collapse
/// through it, and which this flow did not place.
fn of_box(
- laid_out_box: run_records::LaidOutChildBox,
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ laid_out_box: run_state::LaidOutChildBox,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
) -> Self {
Self {
broken_inside: None,
@@ -817,7 +817,7 @@ impl<'pass> BlockFormattingContext<'pass> {
#[inline]
pub(crate) fn sizing(&self) -> sizing_context::SizingContext<'pass, '_> {
- sizing_context::SizingContext::new(self.run.records, self.run.callbacks)
+ sizing_context::SizingContext::new(self.run.state, self.run.callbacks)
}
/// The sizes, size constraints and box sides of `child`, a box this block formatting context sizes.
@@ -2212,7 +2212,7 @@ impl<'pass> BlockFormattingContext<'pass> {
) -> (
Option<formatting_context::ChildLayoutResult>,
Option<fragment_tree::ChildFragmentArrival>,
- run_records::LaidOutChildBox,
+ run_state::LaidOutChildBox,
) {
let formatting_context::ChildLayout {
outcome,
@@ -2371,9 +2371,9 @@ impl<'pass> BlockFormattingContext<'pass> {
};
let _percentage_block_size_dependency_tracking = self
.run
- .records
+ .state
.track_percentage_block_size_dependency_while_laying_out(node);
- let mut fragment_facts = run_records::FragmentFactsDecidedByParent::default();
+ let mut fragment_facts = run_state::FragmentFactsDecidedByParent::default();
if self.laying_out_invisible_line_clamp_content.get() {
fragment_facts.is_invisible_for_line_clamp = true;
}
@@ -2522,7 +2522,7 @@ impl<'pass> BlockFormattingContext<'pass> {
// vertical metrics have been resolved.
eprintln!("FIXME: Block-level box is not BlockContainer but does not create formatting context");
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- run.records,
+ run.state,
&self.run.callbacks,
node,
self.sizing().resolve_percentage_block_size_dependency(node),
@@ -2997,7 +2997,7 @@ impl<'pass> BlockFormattingContext<'pass> {
if dependency_was_not_reported_by_a_child_run {
depends_on_percentage_block_size = self.sizing().resolve_percentage_block_size_dependency(node);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- run.records,
+ run.state,
&self.run.callbacks,
node,
depends_on_percentage_block_size,
@@ -3118,8 +3118,8 @@ impl<'pass> BlockFormattingContext<'pass> {
fn laid_out_box_of_box_laid_out_here(
child: ChildSizedHere<'_>,
baselines: DerivedBaselines,
- ) -> run_records::LaidOutChildBox {
- run_records::LaidOutChildBox::sized_here(
+ ) -> run_state::LaidOutChildBox {
+ run_state::LaidOutChildBox::sized_here(
child
.cells_laid_out_here()
.expect("a box laid out in this flow is laid out in cells its layout owns")
@@ -3226,7 +3226,7 @@ impl<'pass> BlockFormattingContext<'pass> {
let flow_position = self.flow_position();
*self.margin_state.borrow_mut() = entry.outgoing_margins.clone();
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- self.run.records,
+ self.run.state,
&self.run.callbacks,
node,
entry.depends_on_percentage_block_size,
@@ -4263,7 +4263,7 @@ impl<'pass> BlockFormattingContext<'pass> {
);
if outputs.result.depends_on_percentage_block_size {
self.run
- .records
+ .state
.note_descendant_depends_on_percentage_block_size(self.run.box_);
}
let mut outcome = fragmentainer.take_outcome();
@@ -4756,10 +4756,10 @@ impl<'pass> BlockFormattingContext<'pass> {
containing_block_position_in_root: FfiCssPixelPoint,
block_offset: CssPixels,
mut line_builder: Option<&mut line_builder::LineBuilder<'_, '_>>,
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
) -> (
abspos_engine::InFlowBoxInsets,
- Option<run_records::LaidOutChildBox>,
+ Option<run_state::LaidOutChildBox>,
Option<FfiCssPixelPoint>,
) {
let node = sized_float.node;
diff --git a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
index 0fb484208d7..40770840da7 100644
--- a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
@@ -289,7 +289,7 @@ impl<'pass> FlexFormattingContext<'pass> {
#[inline]
fn sizing(&self) -> sizing_context::SizingContext<'pass, '_> {
- sizing_context::SizingContext::new(self.run.records, self.run.callbacks).with_child_run_shapes(self)
+ sizing_context::SizingContext::new(self.run.state, self.run.callbacks).with_child_run_shapes(self)
}
fn keep_item_for_its_run(&self, node: Node) -> used_values::RootInputCells {
@@ -4316,7 +4316,7 @@ mod stretch_cross_limit_tests {
use crate::css::style_value::{RetainedStyleValueData, StyleValueData};
use crate::css::table_group_builder::group_index;
use crate::layout::node_data::{NodeConstructionFacts, StylePayloadsRef};
- use crate::layout::run_records::LayoutScratch;
+ use crate::layout::run_state::LayoutScratch;
fn length(value: i32) -> ComputedSize {
ComputedSize::from_data(&RetainedStyleValueData::from_owned(StyleValueData::Length {
@@ -4541,9 +4541,9 @@ mod stretch_cross_limit_tests {
..ContainingBlockConstraints::default()
};
let container_cells = used_values::cells_before_sizing(&callbacks, container, constraints);
- RunRecords::with_root(callbacks, container, Node::INVALID, None, |records, callbacks| {
+ RunState::with_root(callbacks, container, Node::INVALID, None, |state, callbacks| {
let run = FormattingContextRun {
- records,
+ state,
box_: container,
callbacks,
should_collect_devtools_layout_data: false,
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index c6f95ee3d13..e01d71a570e 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -351,7 +351,7 @@ pub(crate) fn lay_out_pending_abspos_children(
pub(crate) struct PlacedChild {
pub(crate) geometry: fragment_tree::FragmentGeometry,
/// What the parent decided about the child before placing it, which placing it adds the placement to.
- pub(crate) facts_decided_by_parent: run_records::FactsDecidedByParent,
+ pub(crate) facts_decided_by_parent: run_state::FactsDecidedByParent,
/// The offset the relative positioning of the fragmented inline boxes a block-level child interrupts gives the
/// child's committed fragment.
pub(crate) offset_from_relatively_positioned_inline_ancestors: FfiCssPixelPoint,
@@ -365,14 +365,14 @@ impl PlacedChild {
pub(crate) fn new(geometry: fragment_tree::FragmentGeometry) -> Self {
Self {
geometry,
- facts_decided_by_parent: run_records::FactsDecidedByParent::default(),
+ facts_decided_by_parent: run_state::FactsDecidedByParent::default(),
offset_from_relatively_positioned_inline_ancestors: FfiCssPixelPoint::default(),
abspos_layout_inputs: None,
}
}
/// A child whose run handed back the box `laid_out`, before its parent decided anything about it.
- pub(crate) fn of_laid_out_box(laid_out: &run_records::LaidOutChildBox) -> Self {
+ pub(crate) fn of_laid_out_box(laid_out: &run_state::LaidOutChildBox) -> Self {
Self::new(fragment_tree::FragmentGeometry {
cells: laid_out.cells,
line_data: laid_out.line_data.clone(),
@@ -419,7 +419,7 @@ impl PlacedChild {
}
/// The child with what its parent decided its fragment shows of the parent's layout.
- pub(crate) fn with_fragment_facts(mut self, fragment_facts: run_records::FragmentFactsDecidedByParent) -> Self {
+ pub(crate) fn with_fragment_facts(mut self, fragment_facts: run_state::FragmentFactsDecidedByParent) -> Self {
self.facts_decided_by_parent.fragment_facts = fragment_facts;
self
}
@@ -449,7 +449,7 @@ pub(crate) fn place_child(
|inputs| inputs.containing_block,
);
let callbacks = &run.callbacks;
- let placement = run_records::BoxPlacement {
+ let placement = run_state::BoxPlacement {
content_offset_in_containing_block: offset,
containing_block,
};
@@ -475,7 +475,7 @@ pub(crate) fn place_child(
facts_decided_by_parent.placement.is_none(),
"a child is handed to placement before it is placed"
);
- let facts_decided_by_parent = run_records::FactsDecidedByParent {
+ let facts_decided_by_parent = run_state::FactsDecidedByParent {
placement: Some(placement),
..facts_decided_by_parent
};
@@ -619,7 +619,7 @@ fn resolve_containing_line_box_index(
fn committed_offset_delta_at_placement(
callbacks: &LayoutPass<'_>,
node: Node,
- used_insets: run_records::UsedInsets,
+ used_insets: run_state::UsedInsets,
offset_from_relatively_positioned_inline_ancestors: FfiCssPixelPoint,
) -> FfiCssPixelPoint {
let mut delta = FfiCssPixelPoint::default();
@@ -1061,7 +1061,7 @@ pub(crate) struct ChildLayoutResult {
pub in_flow_children_margin_box_block_extent: Option<CssPixels>,
pub depends_on_percentage_block_size: bool,
/// For an absolutely positioned box, the used insets its run gave it.
- pub out_of_flow_root_used_insets: Option<run_records::UsedInsets>,
+ pub out_of_flow_root_used_insets: Option<run_state::UsedInsets>,
/// For a box that establishes an orthogonal flow, its baselines along the horizontal axis of its parent's frame,
/// from the left edge of its content box.
pub orthogonal_flow_baselines: Option<DerivedBaselines>,
@@ -1092,12 +1092,12 @@ impl RunRootOutcome {
root_cells: used_values::RootInputCells,
result: &ChildLayoutResult,
content_block_size_adopted_after_run: Option<CssPixels>,
- ) -> run_records::LaidOutChildBox {
+ ) -> run_state::LaidOutChildBox {
let mut cells = self.input_cells_left_by_run.unwrap_or(root_cells);
if let Some(block_size) = content_block_size_adopted_after_run {
cells.content_block_size = clamp_to_max_dimension_value(block_size.max(CssPixels::default()));
}
- run_records::LaidOutChildBox {
+ run_state::LaidOutChildBox {
cells,
baselines: result.baselines,
orthogonal_flow_baselines: result.orthogonal_flow_baselines,
@@ -1113,14 +1113,14 @@ pub(crate) struct RunOutputs {
pub(crate) root_outcome: RunRootOutcome,
pub(crate) inputs_never_observed: fc_run_cache::RunInputsTheStoredRunNeverObserved,
/// Boxed, as most runs find out nothing for the host.
- pub(crate) host_findings: Option<Box<super::run_records::HostFindings>>,
+ pub(crate) host_findings: Option<Box<super::run_state::HostFindings>>,
}
pub(crate) enum ChildLayoutOutcome {
Skipped {
depends_on_percentage_block_size: bool,
/// For an absolutely positioned child, the used values of its inset properties.
- out_of_flow_root_used_insets: Option<run_records::UsedInsets>,
+ out_of_flow_root_used_insets: Option<run_state::UsedInsets>,
},
Created(ChildLayoutResult),
}
@@ -1142,7 +1142,7 @@ impl ChildLayoutOutcome {
/// percentages resolve against.
pub(crate) fn report_percentage_block_size_dependency_of(&self, run: &FormattingContextRun, child: Node) {
propagate_percentage_block_size_dependency_to_containing_block(
- run.records,
+ run.state,
&run.callbacks,
child,
self.child_depends_on_percentage_block_size(),
@@ -1312,7 +1312,7 @@ pub unsafe extern "C" fn document_host_set_layout_host_callbacks(
#[derive(Clone)]
pub(crate) struct FormattingContextRun<'pass> {
- pub(crate) records: &'pass RunRecords<'pass>,
+ pub(crate) state: &'pass RunState<'pass>,
pub(crate) box_: Node,
pub(crate) callbacks: LayoutPass<'pass>,
pub(crate) should_collect_devtools_layout_data: bool,
@@ -1325,7 +1325,7 @@ impl<'pass> FormattingContextRun<'pass> {
/// This run, laying out in `frame`.
pub(crate) fn in_frame_of(&self, frame: geometry::Frame) -> Self {
Self {
- records: self.records,
+ state: self.state,
box_: self.box_,
callbacks: self.callbacks.in_frame_of(frame.writing_mode()),
should_collect_devtools_layout_data: self.should_collect_devtools_layout_data,
@@ -1338,7 +1338,7 @@ impl<'pass> FormattingContextRun<'pass> {
#[inline]
pub(crate) fn sizing(&self) -> sizing_context::SizingContext<'pass, 'static> {
- sizing_context::SizingContext::new(self.records, self.callbacks)
+ sizing_context::SizingContext::new(self.state, self.callbacks)
}
/// Whether the block-axis percentage insets of the boxes whose containing block is the run's root, laid out in
@@ -1385,7 +1385,7 @@ impl<'pass> FormattingContextRun<'pass> {
root,
root_outcome,
inputs_never_observed,
- host_findings: self.records.take_host_findings(),
+ host_findings: self.state.take_host_findings(),
}
}
}
@@ -1653,7 +1653,7 @@ fn apply_root_sizing_directives(
sized_root: sizing_context::SizedCells<'_>,
input: &LayoutInput,
fc_type: FormattingContextType,
- root_used_insets: &Cell<run_records::UsedInsets>,
+ root_used_insets: &Cell<run_state::UsedInsets>,
) -> RootSizingOutcome {
let mut atomic_root_sizing_repeats_for_available_inline_sizes_at_or_above = None;
let body_input = match input.participation {
@@ -1695,7 +1695,7 @@ fn apply_root_sizing_directives(
abspos_engine::OutOfFlowBox::new(
sized_root,
root_used_insets,
- run.records.anchor_resolved_values_of(run.box_),
+ run.state.anchor_resolved_values_of(run.box_),
),
abspos_inputs,
);
@@ -1941,7 +1941,7 @@ fn size_skipped_independent_root(
child: Node,
cells: &Cell<used_values::RootInputCells>,
input: &LayoutInput,
-) -> Option<run_records::UsedInsets> {
+) -> Option<run_state::UsedInsets> {
match input.participation {
ParticipationInParentFormattingContext::Float { .. } => {
let parent = parent_block.expect("a float requires an enclosing block formatting context");
@@ -1961,7 +1961,7 @@ fn size_skipped_independent_root(
let anchor_resolved_values = (!abspos_inputs.resolved_anchor_sizes.is_empty()).then(|| {
style_values::AnchorResolvedValues::new(&abspos_inputs.resolved_anchor_sizes, run.callbacks.frame)
});
- let used_insets = Cell::new(run_records::UsedInsets::default());
+ let used_insets = Cell::new(run_state::UsedInsets::default());
let sized_child = abspos_engine::OutOfFlowBox::new(
sizing_context::SizedCells::new(child, cells, run.callbacks.frame),
&used_insets,
@@ -1992,7 +1992,7 @@ fn body_input_with_inner_available_space(root: &impl BoxMetricCells, input: &Lay
#[must_use]
pub(crate) struct ChildRunOutcome {
pub(crate) result: ChildLayoutResult,
- pub(crate) laid_out_box: run_records::LaidOutChildBox,
+ pub(crate) laid_out_box: run_state::LaidOutChildBox,
pub(crate) fragment_arrival: Option<fragment_tree::ChildFragmentArrival>,
}
@@ -2254,14 +2254,14 @@ fn execute_formatting_context_run(
}
_ => None,
};
- let (outputs, root_cells_left_by_run) = RunRecords::with_root(
+ let (outputs, root_cells_left_by_run) = RunState::with_root(
callbacks,
box_,
root_containing_block,
root_anchor_resolved_values,
- |records, callbacks| {
+ |state, callbacks| {
lay_out_run_root_and_contents(
- records,
+ state,
callbacks,
builds_fragments,
root_cells,
@@ -2318,7 +2318,7 @@ fn sizes_and_box_sides(cells: used_values::RootInputCells) -> used_values::RootI
#[expect(clippy::too_many_arguments)]
fn lay_out_run_root_and_contents<'pass>(
- records: &'pass RunRecords<'pass>,
+ state: &'pass RunState<'pass>,
callbacks: LayoutPass<'pass>,
builds_fragments: bool,
root_cells: used_values::RootInputCells,
@@ -2335,7 +2335,7 @@ fn lay_out_run_root_and_contents<'pass>(
) -> (RunOutputs, used_values::RootInputCells) {
let run_is_handed_table_inline_layout_outside_its_key = table_inline_layout.is_some();
let run = FormattingContextRun {
- records,
+ state,
box_,
callbacks,
should_collect_devtools_layout_data,
@@ -2370,7 +2370,7 @@ fn lay_out_run_root_and_contents<'pass>(
};
let root = Cell::new(root_cells);
let sized_root = sizing_context::SizedCells::new(box_, &root, parent_frame);
- let root_used_insets = Cell::new(run_records::UsedInsets::default());
+ let root_used_insets = Cell::new(run_state::UsedInsets::default());
let RootSizingOutcome {
body_input,
atomic_root_sizing_repeats_for_available_inline_sizes_at_or_above,
@@ -2560,7 +2560,7 @@ fn lay_out_run_root_and_contents<'pass>(
abspos_engine::OutOfFlowBox::new(
sized_root,
&root_used_insets,
- run.records.anchor_resolved_values_of(run.box_),
+ run.state.anchor_resolved_values_of(run.box_),
),
abspos_inputs,
Some(abspos_engine::InsideLayoutBlockSizes {
@@ -2847,12 +2847,12 @@ fn finalize_atomic_root_block_size(
}
pub(crate) fn propagate_percentage_block_size_dependency_to_containing_block(
- records: &RunRecords,
+ state: &RunState,
callbacks: &LayoutPass<'_>,
child: Node,
child_depends_on_percentage_block_size: bool,
) {
- let run_root_reports_its_dependency_through_its_run_result = child == records.root();
+ let run_root_reports_its_dependency_through_its_run_result = child == state.root();
if run_root_reports_its_dependency_through_its_run_result {
return;
}
@@ -2872,14 +2872,14 @@ pub(crate) fn propagate_percentage_block_size_dependency_to_containing_block(
// the run root where the containing block lies above it.
let mut box_resolving_the_dependency = callbacks.in_flow_containing_block(child);
while !box_resolving_the_dependency.is_invalid()
- && !records.resolves_percentage_block_size_dependency_of(box_resolving_the_dependency)
+ && !state.resolves_percentage_block_size_dependency_of(box_resolving_the_dependency)
{
box_resolving_the_dependency = callbacks.parent(box_resolving_the_dependency);
}
if box_resolving_the_dependency.is_invalid() {
- box_resolving_the_dependency = records.root();
+ box_resolving_the_dependency = state.root();
}
- records.note_descendant_depends_on_percentage_block_size(box_resolving_the_dependency);
+ state.note_descendant_depends_on_percentage_block_size(box_resolving_the_dependency);
}
/// The layout of a child: its outcome, the fragments its placement takes, and the child's box as its layout left it,
@@ -2887,7 +2887,7 @@ pub(crate) fn propagate_percentage_block_size_dependency_to_containing_block(
pub(crate) struct ChildLayout {
pub(crate) outcome: ChildLayoutOutcome,
pub(crate) fragment_arrival: Option<fragment_tree::ChildFragmentArrival>,
- pub(crate) laid_out_box: run_records::LaidOutChildBox,
+ pub(crate) laid_out_box: run_state::LaidOutChildBox,
}
impl ChildLayout {
@@ -2895,7 +2895,7 @@ impl ChildLayout {
Self {
outcome,
fragment_arrival: None,
- laid_out_box: run_records::LaidOutChildBox::sized_here(cells, DerivedBaselines::default()),
+ laid_out_box: run_state::LaidOutChildBox::sized_here(cells, DerivedBaselines::default()),
}
}
}
@@ -2964,7 +2964,7 @@ pub(crate) fn layout_inside_child_with_input_cells(
reuses_subtree: false,
});
let laid_out_box =
- run_records::LaidOutChildBox::sized_here(cells_of_this_layout.get(), DerivedBaselines::default());
+ run_state::LaidOutChildBox::sized_here(cells_of_this_layout.get(), DerivedBaselines::default());
return ChildLayout {
outcome: skipped(None),
fragment_arrival,
@@ -3277,7 +3277,7 @@ fn own_block_size_observation_of_item_run(
&& parent_owns_root_input_cells(&run.callbacks, run.box_, input)
&& !result.depends_on_percentage_block_size
&& !run
- .records
+ .state
.percentage_block_size_dependency_of(run.box_)
.has_descendant_that_depends_on_percentage_block_size
&& !block_formatting_context::root_lays_out_content_against_its_own_block_size(&run.sizing(), run.box_)
@@ -3471,7 +3471,7 @@ pub(crate) struct LayoutStageFacts {
/// reach the rest of the host.
struct LayoutStageInput<'a> {
arena: &'a LayoutNodeArena,
- scratch: &'a super::run_records::LayoutScratch,
+ scratch: &'a super::run_state::LayoutScratch,
root: NodeSlotId,
stage: LayoutStageFacts,
}
@@ -3479,7 +3479,7 @@ struct LayoutStageInput<'a> {
/// The fragments a layout stage computed, which its commit consumes, and what the stage found out for the host.
struct LayoutStageOutput {
fragments: fragment_tree::CompletedPassFragments,
- host_findings: super::run_records::HostFindings,
+ host_findings: super::run_state::HostFindings,
}
/// One layout stage: computes the fragments of the whole document from its viewport, or of one
@@ -3516,7 +3516,7 @@ impl LayoutStageJob {
LayoutStageKind::Boundary { containing_block } => compute_subtree_layout_fragments(input, containing_block),
};
let mut notifications = commit::commit_replacing(root, state.arena_mut(), &output.fragments);
- let super::run_records::HostFindings {
+ let super::run_state::HostFindings {
nodes_with_unresolved_container_lengths,
messages,
document_svg_root_natural_size,
@@ -3580,11 +3580,11 @@ fn compute_root_layout(input: LayoutStageInput<'_>, should_collect_devtools_layo
percentage_basis_block_size: Some(viewport_block_size),
..ContainingBlockConstraints::default()
};
- RunRecords::with_root(callbacks, root, Node::INVALID, None, |entry_records, callbacks| {
+ RunState::with_root(callbacks, root, Node::INVALID, None, |entry_run_state, callbacks| {
let _trace = arena.layout_trace.pass(None);
let entry_fragments = std::rc::Rc::new(fragment_tree::RunFragmentBuilder::new_entry_accumulator(root));
let entry_run = FormattingContextRun {
- records: entry_records,
+ state: entry_run_state,
box_: root,
callbacks,
should_collect_devtools_layout_data,
@@ -3645,7 +3645,7 @@ fn compute_root_layout(input: LayoutStageInput<'_>, should_collect_devtools_layo
root_outcome.fragment_arrival,
);
finish_entry_pass(
- entry_records,
+ entry_run_state,
&entry_fragments,
&callbacks,
should_collect_devtools_layout_data,
@@ -3657,7 +3657,7 @@ fn compute_root_layout(input: LayoutStageInput<'_>, should_collect_devtools_layo
/// last stage, before any run of this one reads a cache.
fn drop_intrinsic_size_cache_entries_of_released_slots(
arena: &LayoutNodeArena,
- scratch: &super::run_records::LayoutScratch,
+ scratch: &super::run_state::LayoutScratch,
) {
let drops = arena.take_intrinsic_size_cache_drops();
if !drops.is_empty() {
@@ -3666,13 +3666,13 @@ fn drop_intrinsic_size_cache_entries_of_released_slots(
}
fn finish_entry_pass(
- entry_records: &RunRecords<'_>,
+ entry_run_state: &RunState<'_>,
entry_fragments: &std::rc::Rc<fragment_tree::RunFragmentBuilder>,
callbacks: &LayoutPass<'_>,
should_collect_devtools_layout_data: bool,
) -> LayoutStageOutput {
abspos_engine::drain_abspos_with_placed_containing_blocks(
- entry_records,
+ entry_run_state,
*callbacks,
should_collect_devtools_layout_data,
entry_fragments,
@@ -3683,7 +3683,7 @@ fn finish_entry_pass(
"an entry pass always produces the entry root's fragment"
);
let mut host_findings = callbacks.scratch().take_host_findings_outside_runs();
- if let Some(found_by_entry_run) = entry_records.take_host_findings() {
+ if let Some(found_by_entry_run) = entry_run_state.take_host_findings() {
host_findings.receive(*found_by_entry_run);
}
LayoutStageOutput {
@@ -3724,17 +3724,17 @@ fn compute_subtree_layout_fragments(input: LayoutStageInput<'_>, containing_bloc
} else {
(root, containing_block)
};
- RunRecords::with_root(
+ RunState::with_root(
callbacks,
entry_root,
entry_root_containing_block,
None,
- |entry_records, callbacks| {
+ |entry_run_state, callbacks| {
let _trace = arena.layout_trace.pass(Some(root));
let entry_fragments =
std::rc::Rc::new(fragment_tree::RunFragmentBuilder::new_entry_accumulator(entry_root));
let entry_run = FormattingContextRun {
- records: entry_records,
+ state: entry_run_state,
box_: entry_root,
callbacks,
should_collect_devtools_layout_data: false,
@@ -3747,7 +3747,7 @@ fn compute_subtree_layout_fragments(input: LayoutStageInput<'_>, containing_bloc
} else {
layout_subtree_with_frozen_root_geometry(&entry_run);
}
- finish_entry_pass(entry_records, &entry_fragments, &callbacks, false)
+ finish_entry_pass(entry_run_state, &entry_fragments, &callbacks, false)
},
)
}
@@ -3837,7 +3837,7 @@ mod baseline_tests {
use crate::css::table_group_builder::group_index;
use crate::layout::layout_node_arena::LayoutNodeArena;
use crate::layout::node_data::{NodeConstructionFacts, NodeKind, StylePayloadsRef};
- use crate::layout::run_records::LayoutScratch;
+ use crate::layout::run_state::LayoutScratch;
unsafe extern "C" fn unused_container_bases(
_: *mut c_void,
@@ -3905,7 +3905,7 @@ mod baseline_tests {
document_in_quirks_mode: false,
},
);
- RunRecords::with_root(callbacks, parent, Node::INVALID, None, |_, callbacks| {
+ RunState::with_root(callbacks, parent, Node::INVALID, None, |_, callbacks| {
let child_cells = used_values::RootInputCells::default();
assert!(child_gives_container_baselines(&callbacks, parent, child));
let mut baselines = DerivedBaselines::default();
diff --git a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
index 3e61a98a361..eb297f7d76c 100644
--- a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
@@ -418,12 +418,12 @@ pub(crate) struct CellsInFrame {
/// containing block of absolutely positioned boxes, as the run placed it. Both are keyed by slot.
#[derive(Default)]
pub(crate) struct PlacedBoxes {
- placements: HashMap<u32, run_records::BoxPlacement>,
+ placements: HashMap<u32, run_state::BoxPlacement>,
cells_of_abspos_containing_blocks: HashMap<u32, CellsInFrame>,
}
impl PlacedBoxes {
- pub(crate) fn placement_of(&self, node: crate::layout::node_data::NodeSlotId) -> Option<run_records::BoxPlacement> {
+ pub(crate) fn placement_of(&self, node: crate::layout::node_data::NodeSlotId) -> Option<run_state::BoxPlacement> {
self.placements.get(&node.slot_index()).copied()
}
@@ -534,7 +534,7 @@ pub(crate) fn committed_fragment_showing_box(
callbacks: &LayoutPass<'_>,
node: crate::layout::node_data::NodeSlotId,
geometry: impl FnOnce() -> FragmentGeometry,
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
fragment: std::sync::Arc<Fragment>,
) -> std::sync::Arc<Fragment> {
if fragment_facts.is_invisible_for_line_clamp == fragment.is_invisible_for_line_clamp {
@@ -555,7 +555,7 @@ fn snapshot_fragment(
node: crate::layout::node_data::NodeSlotId,
children: Vec<FragmentLink>,
geometry: FragmentGeometry,
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
payloads: Option<Box<FragmentPayloads>>,
) -> std::sync::Arc<Fragment> {
static NEXT_IDENTITY: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);
@@ -652,7 +652,7 @@ pub(crate) struct PlacementData {
impl PlacementData {
fn of_box(
- facts: &run_records::FactsDecidedByParent,
+ facts: &run_state::FactsDecidedByParent,
abspos_layout_inputs: Option<abspos_inputs::AbsposLayoutInputs>,
containing_line_box_index: Option<usize>,
committed_offset: FfiCssPixelPoint,
@@ -1008,7 +1008,7 @@ impl RunFragmentBuilder {
pub(crate) fn note_placed_box(
&self,
node: crate::layout::node_data::NodeSlotId,
- placement: run_records::BoxPlacement,
+ placement: run_state::BoxPlacement,
cells_for_contained_abspos: Option<CellsInFrame>,
) {
let placed_boxes = &mut self.inner.borrow_mut().placed_boxes;
@@ -1038,7 +1038,7 @@ impl RunFragmentBuilder {
}
/// Where the run placed `node`, if it placed the box.
- pub(crate) fn placement_of(&self, node: crate::layout::node_data::NodeSlotId) -> Option<run_records::BoxPlacement> {
+ pub(crate) fn placement_of(&self, node: crate::layout::node_data::NodeSlotId) -> Option<run_state::BoxPlacement> {
self.inner.borrow().placed_boxes.placement_of(node)
}
@@ -1496,7 +1496,7 @@ impl RunFragmentBuilder {
node: crate::layout::node_data::NodeSlotId,
containing_block: Option<crate::layout::node_data::NodeSlotId>,
geometry: FragmentGeometry,
- facts: run_records::FactsDecidedByParent,
+ facts: run_state::FactsDecidedByParent,
abspos_layout_inputs: Option<abspos_inputs::AbsposLayoutInputs>,
containing_line_box_index: Option<usize>,
committed_offset: FfiCssPixelPoint,
@@ -1606,7 +1606,7 @@ impl RunFragmentBuilder {
fragment: std::sync::Arc<Fragment>,
reuses_subtree: bool,
containing_block: Option<crate::layout::node_data::NodeSlotId>,
- facts: run_records::FactsDecidedByParent,
+ facts: run_state::FactsDecidedByParent,
abspos_layout_inputs: Option<abspos_inputs::AbsposLayoutInputs>,
containing_line_box_index: Option<usize>,
committed_offset: FfiCssPixelPoint,
diff --git a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
index 337024ceb97..7608902ed59 100644
--- a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
@@ -1413,7 +1413,7 @@ impl<'pass> GridFormattingContext<'pass> {
#[inline]
fn sizing(&self) -> sizing_context::SizingContext<'pass, '_> {
- sizing_context::SizingContext::new(self.run.records, self.run.callbacks).with_child_run_shapes(self)
+ sizing_context::SizingContext::new(self.run.state, self.run.callbacks).with_child_run_shapes(self)
}
fn parent_grid(&self) -> Option<&ParentGridData<'pass>> {
@@ -3169,14 +3169,14 @@ impl<'pass> GridFormattingContext<'pass> {
..live
};
let containing_block = self.run.callbacks.in_flow_containing_block(subgrid.box_);
- RunRecords::with_root(
+ RunState::with_root(
self.run.callbacks,
subgrid.box_,
containing_block,
None,
- |records, callbacks| {
+ |state, callbacks| {
let scratch_run = FormattingContextRun {
- records,
+ state,
box_: subgrid.box_,
callbacks,
should_collect_devtools_layout_data: false,
diff --git a/Libraries/LibWeb/Rust/src/layout/host_tables.rs b/Libraries/LibWeb/Rust/src/layout/host_tables.rs
index 83a3282af16..13d0cdbf8fb 100644
--- a/Libraries/LibWeb/Rust/src/layout/host_tables.rs
+++ b/Libraries/LibWeb/Rust/src/layout/host_tables.rs
@@ -146,7 +146,7 @@ impl HostTables {
/// The arena of a document's render state, and the layout stage's scratch beside it.
pub(crate) struct ArenaHandle {
arena: LayoutNodeArena,
- layout_scratch: super::run_records::LayoutScratch,
+ layout_scratch: super::run_state::LayoutScratch,
}
impl ArenaHandle {
@@ -170,7 +170,7 @@ impl ArenaHandle {
}
/// The layout stage's own scratch.
- pub(crate) fn layout_scratch(&self) -> &super::run_records::LayoutScratch {
+ pub(crate) fn layout_scratch(&self) -> &super::run_state::LayoutScratch {
&self.layout_scratch
}
diff --git a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
index 4f5fcc58cd6..960e353b71f 100644
--- a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
@@ -905,7 +905,7 @@ pub(crate) fn accumulated_relative_insets_from_inline_ancestor_chain(
callbacks: &LayoutPass<'_>,
first_ancestor: Node,
stop_at: Node,
- used_insets_of: impl Fn(Node) -> run_records::UsedInsets,
+ used_insets_of: impl Fn(Node) -> run_state::UsedInsets,
) -> InlineAncestorChainRelativeOffset {
let mut result = InlineAncestorChainRelativeOffset::default();
let mut ancestor = first_ancestor;
@@ -1001,7 +1001,7 @@ pub(crate) struct InlineFormattingContext<'context> {
/// Each inline box this context entered, as it resolved the box on entering it.
entered_inline_boxes: RefCell<HashMap<Node, EnteredInlineBox>>,
/// The used insets of each float this context laid out among its lines, as the float's layout resolved them.
- used_insets_of_floats: RefCell<HashMap<Node, run_records::UsedInsets>>,
+ used_insets_of_floats: RefCell<HashMap<Node, run_state::UsedInsets>>,
}
/// What an inline formatting context resolved of an inline box on entering it.
@@ -2059,9 +2059,9 @@ impl<'context> InlineFormattingContext<'context> {
self.containing_block_position_in_bfc_root,
CssPixels::default(),
Some(&mut line_builder),
- run_records::FragmentFactsDecidedByParent {
+ run_state::FragmentFactsDecidedByParent {
is_invisible_for_line_clamp: state_at_clamp_point.is_some(),
- ..run_records::FragmentFactsDecidedByParent::default()
+ ..run_state::FragmentFactsDecidedByParent::default()
},
);
self.used_insets_of_floats
diff --git a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
index 5edbdf0062f..52ed1e64454 100644
--- a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
+++ b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
@@ -55,13 +55,13 @@ impl ContentSizingScope {
}
fn enter<R>(&self, callbacks: LayoutPass<'_>, size_content: impl FnOnce(&FormattingContextRun<'_>) -> R) -> R {
- RunRecords::with_content_inline_sizes_root(
+ RunState::with_content_inline_sizes_root(
callbacks,
self.node,
callbacks.in_flow_containing_block(self.node),
- |records, callbacks| {
+ |state, callbacks| {
size_content(&FormattingContextRun {
- records,
+ state,
box_: self.node,
callbacks,
should_collect_devtools_layout_data: false,
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_pass.rs b/Libraries/LibWeb/Rust/src/layout/layout_pass.rs
index 88b7ec33363..ae0ea8b37c8 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_pass.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_pass.rs
@@ -58,13 +58,13 @@ impl ContainerLengthBasesQuery {
/// mutable arena borrow, so its text and style views cannot survive commit.
///
/// A layout run reads only the subtree it lays out. Whatever it needs from above arrives through
-/// its layout input, its root's used values and its records, or was derived onto the subtree
+/// its layout input, its root's used values and its run state, or was derived onto the subtree
/// before the pass, like ancestor facts. That is what lets partial relayout, the formatting context
/// run cache and the intrinsic size caches reuse a subtree's layout without looking outside it.
#[derive(Clone, Copy)]
pub(crate) struct LayoutPass<'arena> {
arena: &'arena LayoutNodeArena,
- scratch: &'arena super::run_records::LayoutScratch,
+ scratch: &'arena super::run_state::LayoutScratch,
pub(crate) container_length_bases: ContainerLengthBasesQuery,
pub(crate) initial_containing_block_inline_size: CssPixels,
pub(crate) initial_containing_block_block_size: CssPixels,
@@ -79,7 +79,7 @@ pub(crate) struct LayoutPass<'arena> {
impl<'arena> LayoutPass<'arena> {
pub(crate) fn new(
arena: &'arena LayoutNodeArena,
- scratch: &'arena super::run_records::LayoutScratch,
+ scratch: &'arena super::run_state::LayoutScratch,
stage: super::formatting_context::LayoutStageFacts,
) -> Self {
Self {
@@ -96,7 +96,7 @@ impl<'arena> LayoutPass<'arena> {
/// A pass whose only question to the document has no answer, over `arena` and `scratch`.
#[cfg(test)]
- pub(crate) fn for_test(arena: &'arena LayoutNodeArena, scratch: &'arena super::run_records::LayoutScratch) -> Self {
+ pub(crate) fn for_test(arena: &'arena LayoutNodeArena, scratch: &'arena super::run_state::LayoutScratch) -> Self {
Self::new(
arena,
scratch,
@@ -131,8 +131,8 @@ impl<'arena> LayoutPass<'arena> {
self.arena
}
- /// The layout stage's own scratch, which the pass's runs keep their records in.
- pub(crate) fn scratch(&self) -> &'arena super::run_records::LayoutScratch {
+ /// The layout stage's own scratch, which the runs of the pass share.
+ pub(crate) fn scratch(&self) -> &'arena super::run_state::LayoutScratch {
self.scratch
}
diff --git a/Libraries/LibWeb/Rust/src/layout/mod.rs b/Libraries/LibWeb/Rust/src/layout/mod.rs
index 3cb42dc0183..e7e6cfc15fe 100644
--- a/Libraries/LibWeb/Rust/src/layout/mod.rs
+++ b/Libraries/LibWeb/Rust/src/layout/mod.rs
@@ -45,8 +45,8 @@ mod partial_relayout;
pub(crate) mod rendered_text;
mod replaced_with_children_formatting_context;
pub(crate) mod row_reads;
-pub(crate) mod run_records;
pub(crate) mod run_repeatability;
+pub(crate) mod run_state;
pub(crate) mod script_entries;
pub(crate) mod shell_reads;
pub(crate) mod sizing_context;
@@ -100,7 +100,7 @@ pub(crate) use layout_pass::LayoutPass;
pub(crate) use node_facts::NodeFacts;
pub(crate) use partial_relayout::HeldNode as PartialRelayoutHeldNode;
pub(crate) use rendered_text::{PublishedTextSlot, RenderedText, RenderedTextBoundary, TextFragments};
-pub(crate) use run_records::RunRecords;
+pub(crate) use run_state::RunState;
use std::cell::Cell;
use std::cell::OnceCell;
use std::cell::Ref;
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 4ec9e5f10b7..505e1dcfbc4 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
@@ -62,7 +62,7 @@ pub(super) fn layout_replaced_with_children(
);
let wrapper_result = wrapper_outcome.result;
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- run.records,
+ run.state,
&run.callbacks,
wrapper,
wrapper_result.depends_on_percentage_block_size,
diff --git a/Libraries/LibWeb/Rust/src/layout/run_repeatability.rs b/Libraries/LibWeb/Rust/src/layout/run_repeatability.rs
index 0de28915d1b..59b2eef247b 100644
--- a/Libraries/LibWeb/Rust/src/layout/run_repeatability.rs
+++ b/Libraries/LibWeb/Rust/src/layout/run_repeatability.rs
@@ -274,8 +274,8 @@ fn same_elements_in_any_order<T: PartialEq>(left: &[T], right: &[T]) -> bool {
})
}
-fn host_findings_match(left: Option<&run_records::HostFindings>, right: Option<&run_records::HostFindings>) -> bool {
- let none = run_records::HostFindings::default();
+fn host_findings_match(left: Option<&run_state::HostFindings>, right: Option<&run_state::HostFindings>) -> bool {
+ let none = run_state::HostFindings::default();
let left = left.unwrap_or(&none);
let right = right.unwrap_or(&none);
same_elements_in_any_order(
diff --git a/Libraries/LibWeb/Rust/src/layout/run_records.rs b/Libraries/LibWeb/Rust/src/layout/run_state.rs
similarity index 97%
rename from Libraries/LibWeb/Rust/src/layout/run_records.rs
rename to Libraries/LibWeb/Rust/src/layout/run_state.rs
index e639aaa8881..f132b37f0e7 100644
--- a/Libraries/LibWeb/Rust/src/layout/run_records.rs
+++ b/Libraries/LibWeb/Rust/src/layout/run_state.rs
@@ -8,7 +8,7 @@ use super::*;
/// What the layout stage keeps for itself besides what each of its runs keeps: what the runs of a layout pass share and
/// what the runs in progress found out for the host. It is the stage's scratch rather than arena columns: nothing
-/// outside a running pass reads it, but for the memos it keeps for later passes, and it holds no record of a box.
+/// outside a running pass reads it, but for the memos it keeps for later passes.
pub(crate) struct LayoutScratch {
/// The intrinsic sizes passes measured, kept for the passes after them.
pub(crate) intrinsic_size_caches: super::layout_node_arena::IntrinsicSizeCaches,
@@ -102,7 +102,7 @@ impl HostFindings {
}
}
-// The scratch holds no record, so it can move to the thread a layout stage runs on.
+// The scratch can move to the thread a layout stage runs on.
const _: () = {
const fn assert_send<T: Send>() {}
assert_send::<LayoutScratch>();
@@ -239,7 +239,7 @@ impl LayoutScratch {
/// anchor-size() resolutions of its root. It keeps no metrics of any box: the formatting context or call that lays out
/// a box holds the box's cells, or hands the box to a run of its own. The scoped constructors lend this to the run, so
/// callers cannot extend its lifetime.
-pub(crate) struct RunRecords<'arena> {
+pub(crate) struct RunState<'arena> {
root: Node,
scratch: &'arena LayoutScratch,
/// How many runs are in progress with this one, of which only the innermost hands over what it found out.
@@ -332,8 +332,8 @@ type PercentageBlockSizeDependenciesInProgress =
RefCell<smallvec::SmallVec<[(Node, PercentageBlockSizeDependency); 8]>>;
/// Keeps tracking the percentage block size dependency of a box while its layout is in progress.
-pub(crate) struct PercentageBlockSizeDependencyTracking<'records> {
- dependencies_in_progress: &'records PercentageBlockSizeDependenciesInProgress,
+pub(crate) struct PercentageBlockSizeDependencyTracking<'state> {
+ dependencies_in_progress: &'state PercentageBlockSizeDependenciesInProgress,
node: Node,
}
@@ -357,7 +357,7 @@ enum ContentSizing {
RootContentInlineSizes,
}
-impl<'arena> RunRecords<'arena> {
+impl<'arena> RunState<'arena> {
/// Runs `run` with what a run rooted at `root` keeps, and the pass as that run sees it. The style reads of an
/// absolutely positioned root see `root_anchor_resolved_values`.
pub(crate) fn with_root<R>(
@@ -422,7 +422,7 @@ impl<'arena> RunRecords<'arena> {
"the layout stage drops released intrinsic size cache entries before its runs read a cache"
);
let scratch = callbacks.scratch();
- let records = Self {
+ let state = Self {
root,
scratch,
runs_in_progress_with_it: scratch.begin_run(),
@@ -433,7 +433,7 @@ impl<'arena> RunRecords<'arena> {
)]),
root_anchor_resolved_values,
};
- run(&records, callbacks.for_run(root, root_containing_block))
+ run(&state, callbacks.for_run(root, root_containing_block))
}
/// What this run found out for the host, which its outputs carry to the run that uses its result.
@@ -546,7 +546,7 @@ impl<'arena> RunRecords<'arena> {
}
}
-impl Drop for RunRecords<'_> {
+impl Drop for RunState<'_> {
fn drop(&mut self) {
self.scratch.end_run(self.runs_in_progress_with_it);
}
@@ -562,14 +562,14 @@ mod tests {
let scratch = LayoutScratch::default();
let root = arena.allocate_for_test().slot;
let child = arena.allocate_for_test().slot;
- RunRecords::with_root(
+ RunState::with_root(
LayoutPass::for_test(&arena, &scratch),
root,
NodeSlotId::INVALID,
None,
|parent, _| {
assert_eq!(parent.root(), root);
- RunRecords::with_root(
+ RunState::with_root(
LayoutPass::for_test(&arena, &scratch),
child,
root,
@@ -594,14 +594,14 @@ mod tests {
let scratch = LayoutScratch::default();
let root = arena.allocate_for_test().slot;
let child = arena.allocate_for_test().slot;
- RunRecords::with_root(
+ RunState::with_root(
LayoutPass::for_test(&arena, &scratch),
root,
NodeSlotId::INVALID,
None,
|parent, _| {
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
- RunRecords::with_root(LayoutPass::for_test(&arena, &scratch), child, root, None, |_, _| {
+ RunState::with_root(LayoutPass::for_test(&arena, &scratch), child, root, None, |_, _| {
panic!("abort the nested measurement")
});
}));
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
index e6ca4dd5fce..6f8a49346d1 100644
--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
@@ -200,7 +200,7 @@ impl<'cells> SizedCells<'cells> {
}
pub(crate) struct SizingContext<'pass, 'container> {
- records: &'pass RunRecords<'pass>,
+ state: &'pass RunState<'pass>,
callbacks: LayoutPass<'pass>,
style_cache: Cell<Option<(Node, &'pass FfiStylePayloads)>>,
child_run_shapes: Option<&'container dyn formatting_context::ChildRunShapes>,
@@ -254,9 +254,9 @@ pub(crate) fn stretch_fit_block_margins(
impl<'pass, 'container> SizingContext<'pass, 'container> {
#[inline]
- pub(crate) fn new(records: &'pass RunRecords<'pass>, callbacks: LayoutPass<'pass>) -> Self {
+ pub(crate) fn new(state: &'pass RunState<'pass>, callbacks: LayoutPass<'pass>) -> Self {
Self {
- records,
+ state,
callbacks,
style_cache: Cell::new(None),
child_run_shapes: None,
@@ -296,7 +296,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
if !style.is_absolutely_positioned() {
return style;
}
- style.with_anchor_resolved_values(self.records.anchor_resolved_values_of(node))
+ style.with_anchor_resolved_values(self.state.anchor_resolved_values_of(node))
}
fn first_child(&self, node: Node) -> Node {
@@ -1159,7 +1159,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
&& facts.is_anonymous()
&& !facts.is_table_cell()
&& !facts.has_auto_content_box_size()
- && (!self.records.measures_content_inline_sizes_of(node) || self.is_anonymous_block_box_in_block_flow(node))
+ && (!self.state.measures_content_inline_sizes_of(node) || self.is_anonymous_block_box_in_block_flow(node))
}
fn is_anonymous_block_box_in_block_flow(&self, node: Node) -> bool {
@@ -1359,13 +1359,13 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
}
pub(crate) fn resolve_percentage_block_size_dependency(&self, node: Node) -> bool {
- let found = self.records.percentage_block_size_dependency_of(node);
+ let found = self.state.percentage_block_size_dependency_of(node);
let depends_on_percentage_block_size = found.depends_on_percentage_block_size
|| self.own_style_depends_on_percentage_block_size(node)
|| (found.has_descendant_that_depends_on_percentage_block_size
&& self.passes_percentage_block_size_through_to_children(node));
if depends_on_percentage_block_size {
- self.records.note_box_depends_on_percentage_block_size(node);
+ self.state.note_box_depends_on_percentage_block_size(node);
}
depends_on_percentage_block_size
}
@@ -1429,9 +1429,9 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
if !depends_on_percentage_block_size {
return;
}
- self.records.note_box_depends_on_percentage_block_size(node);
+ self.state.note_box_depends_on_percentage_block_size(node);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- self.records,
+ self.state,
&self.callbacks,
node,
true,
@@ -2407,12 +2407,12 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
let indefinite_inline_basis = CssPixels::default();
root.resolve_box_model(&self.style(node), indefinite_inline_basis);
let (contributions, percentage_block_size_dependency_its_layout_would_report) =
- RunRecords::with_content_sizing_root(
+ RunState::with_content_sizing_root(
self.callbacks,
node,
self.callbacks.in_flow_containing_block(node),
- |records, callbacks| {
- let sizing = SizingContext::new(records, callbacks);
+ |state, callbacks| {
+ let sizing = SizingContext::new(state, callbacks);
let inline_size_under = |inline_size| {
sizing.atomic_root_content_inline_size(
SizedBox::of_own_metrics(node, &root, callbacks.frame),
@@ -2436,7 +2436,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
border_end: root.border_right,
margin_end: root.margin_right,
},
- records
+ state
.percentage_block_size_dependency_of(node)
.depends_on_percentage_block_size
|| sizing.skipped_child_depends_on_percentage_block_size(node),
@@ -2444,7 +2444,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
},
);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- self.records,
+ self.state,
&self.callbacks,
node,
percentage_block_size_dependency_its_layout_would_report,
@@ -2760,7 +2760,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
}
fn charge_content_sizing_scope_with(&self, node: Node, dependencies: IntrinsicMeasurementDependencies) {
- if self.records.is_content_sizing() {
+ if self.state.is_content_sizing() {
self.charge_measurement_dependency_to_measured_box_and_containing_block(
node,
dependencies.percentage_block_size,
@@ -3300,7 +3300,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
) -> CssPixels {
let node = sized.node;
let own_frame = formatting_context::frame_established_by(&self.callbacks, node);
- let sizing = SizingContext::new(self.records, self.callbacks.in_frame_of(own_frame.writing_mode()));
+ let sizing = SizingContext::new(self.state, self.callbacks.in_frame_of(own_frame.writing_mode()));
let constraints_in_own_frame = ContainingBlockConstraints {
percentage_basis_inline_size: constraints.percentage_basis_block_size,
percentage_basis_block_size: constraints.percentage_basis_inline_size,
@@ -3579,13 +3579,13 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
table_cells.padding_left = table_style.padding_left().to_px(containing_block_inline_size);
table_cells.padding_right = table_style.padding_right().to_px(containing_block_inline_size);
- RunRecords::with_content_sizing_root(
+ RunState::with_content_sizing_root(
self.callbacks,
table_box,
self.callbacks.in_flow_containing_block(table_box),
- |records, callbacks| {
+ |state, callbacks| {
let table_run = FormattingContextRun {
- records,
+ state,
box_: table_box,
callbacks,
should_collect_devtools_layout_data: false,
@@ -3701,7 +3701,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
},
);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- self.records,
+ self.state,
&self.callbacks,
table_box,
table_depends_on_percentage_block_size,
@@ -4293,7 +4293,7 @@ mod replaced_ratio_tests {
use crate::layout::formatting_context::LayoutStageFacts;
use crate::layout::layout_node_arena::LayoutNodeArena;
use crate::layout::node_data::{NodeConstructionFacts, NodeKind, StylePayloadsRef};
- use crate::layout::run_records::LayoutScratch;
+ use crate::layout::run_state::LayoutScratch;
unsafe extern "C" fn unused_container_bases(
_: *mut c_void,
@@ -4375,8 +4375,8 @@ mod replaced_ratio_tests {
document_in_quirks_mode: false,
},
);
- let result = RunRecords::with_root(callbacks, node, Node::INVALID, None, |records, callbacks| {
- let context = SizingContext::new(records, callbacks);
+ let result = RunState::with_root(callbacks, node, Node::INVALID, None, |state, callbacks| {
+ let context = SizingContext::new(state, callbacks);
let mut metrics = used_values::RootInputCells::default();
let available = AvailableSpace {
inline_size: AvailableSize::Definite(CssPixels::from_integer(800)),
diff --git a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
index 6422934c5ff..404fa692a20 100644
--- a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
@@ -963,7 +963,7 @@ pub(super) struct TableFormattingContext<'pass> {
/// The baselines of the contents of each cell whose layout handed the box back to this table, which keeps them.
content_baselines_of_handed_back_cells: Vec<Option<DerivedBaselines>>,
/// What each cell's fragment shows of the table's layout.
- cell_fragment_facts: Vec<run_records::FragmentFactsDecidedByParent>,
+ cell_fragment_facts: Vec<run_state::FragmentFactsDecidedByParent>,
/// The input cells of each cell's box as this table sizes it, from the box's starting cells through the borders
/// and padding of the table's border model and the sizes of its columns and rows to what the cell's run hands back.
cell_box_cells: Vec<used_values::RootInputCells>,
@@ -1155,7 +1155,7 @@ impl<'pass> TableFormattingContext<'pass> {
#[inline]
fn sizing(&self) -> sizing_context::SizingContext<'pass, 'static> {
- sizing_context::SizingContext::new(self.run.records, self.run.callbacks)
+ sizing_context::SizingContext::new(self.run.state, self.run.callbacks)
}
fn parent(&self, node: Node) -> Node {
@@ -1268,7 +1268,7 @@ impl<'pass> TableFormattingContext<'pass> {
&self,
node: Node,
participant_box: &TableParticipantBox,
- fragment_facts: run_records::FragmentFactsDecidedByParent,
+ fragment_facts: run_state::FragmentFactsDecidedByParent,
x: CssPixels,
y: CssPixels,
) {
@@ -1516,7 +1516,7 @@ impl<'pass> TableFormattingContext<'pass> {
let note_percentage_block_size_dependency_of = |participant| {
if sizing.own_style_depends_on_percentage_block_size(participant) {
self.run
- .records
+ .state
.note_descendant_depends_on_percentage_block_size(self.run.box_);
}
};
@@ -1557,10 +1557,10 @@ impl<'pass> TableFormattingContext<'pass> {
self.cell_fragment_facts = self
.cells
.iter()
- .map(|cell| run_records::FragmentFactsDecidedByParent {
+ .map(|cell| run_state::FragmentFactsDecidedByParent {
table_column_index: cell.column_index as u32,
table_column_span: cell.column_span as u32,
- ..run_records::FragmentFactsDecidedByParent::default()
+ ..run_state::FragmentFactsDecidedByParent::default()
})
.collect();
self.cell_box_cells = cell_box_cells;
@@ -3196,7 +3196,7 @@ impl<'pass> TableFormattingContext<'pass> {
self.place_participant(
row.box_,
row_box,
- run_records::FragmentFactsDecidedByParent::default(),
+ run_state::FragmentFactsDecidedByParent::default(),
inline_offset,
row_block_offset,
);
@@ -3235,7 +3235,7 @@ impl<'pass> TableFormattingContext<'pass> {
self.place_participant(
group,
group_box,
- run_records::FragmentFactsDecidedByParent::default(),
+ run_state::FragmentFactsDecidedByParent::default(),
inline_offset,
block_start,
);
@@ -3273,7 +3273,7 @@ impl<'pass> TableFormattingContext<'pass> {
let cell_box = &mut self.cell_box_cells[cell_index];
cell_box.padding_top += intrinsic_block_padding.0;
cell_box.padding_bottom += intrinsic_block_padding.1;
- let laid_out = run_records::LaidOutChildBox {
+ let laid_out = run_state::LaidOutChildBox {
cells: *cell_box,
baselines: measurement.baselines,
orthogonal_flow_baselines: None,
@@ -3282,7 +3282,7 @@ impl<'pass> TableFormattingContext<'pass> {
self.placed_cells[cell_index] = Some(formatting_context::PlacedChild::of_laid_out_box(&laid_out));
self.content_baselines_of_handed_back_cells[cell_index] = Some(laid_out.baselines);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
- run.records,
+ run.state,
&run.callbacks,
cell.box_,
measurement.depends_on_percentage_block_size,
@@ -3501,10 +3501,10 @@ impl<'pass> TableFormattingContext<'pass> {
} else {
CssPixels::default()
};
- let fragment_facts = run_records::FragmentFactsDecidedByParent {
+ let fragment_facts = run_state::FragmentFactsDecidedByParent {
table_column_index: start as u32,
table_column_span: (end - start) as u32,
- ..run_records::FragmentFactsDecidedByParent::default()
+ ..run_state::FragmentFactsDecidedByParent::default()
};
let column_box = self.row_group_or_column_box(node);
let used = &column_box.cells;
diff --git a/Libraries/LibWeb/Rust/src/layout/used_values.rs b/Libraries/LibWeb/Rust/src/layout/used_values.rs
index 3bccb9b87c0..b4e2e09e4a0 100644
--- a/Libraries/LibWeb/Rust/src/layout/used_values.rs
+++ b/Libraries/LibWeb/Rust/src/layout/used_values.rs
@@ -664,7 +664,7 @@ pub(crate) fn cells_before_sizing(
/// of the link, which a run adopts as they are.
pub(crate) struct CommittedBox {
pub(crate) cells: RootInputCells,
- pub(crate) facts_decided_by_parent: super::run_records::FactsDecidedByParent,
+ pub(crate) facts_decided_by_parent: super::run_state::FactsDecidedByParent,
}
pub(crate) fn committed_box_from_fragment_link(callbacks: &LayoutPass<'_>, node: Node) -> Option<CommittedBox> {
@@ -673,23 +673,23 @@ pub(crate) fn committed_box_from_fragment_link(callbacks: &LayoutPass<'_>, node:
Some(CommittedBox {
cells: RootInputCells::of_committed_fragment(fragment),
- facts_decided_by_parent: super::run_records::FactsDecidedByParent {
- placement: Some(super::run_records::BoxPlacement {
+ facts_decided_by_parent: super::run_state::FactsDecidedByParent {
+ placement: Some(super::run_state::BoxPlacement {
content_offset_in_containing_block: link.committed_offset,
containing_block: link.containing_block,
}),
- used_insets: super::run_records::UsedInsets {
+ used_insets: super::run_state::UsedInsets {
left: link.inset_left,
right: link.inset_right,
top: link.inset_top,
bottom: link.inset_bottom,
},
default_scroll_shift: None,
- fragment_facts: super::run_records::FragmentFactsDecidedByParent {
+ fragment_facts: super::run_state::FragmentFactsDecidedByParent {
table_column_index: fragment.table_column_index,
table_column_span: fragment.table_column_span,
hidden_by_collapsed_columns: fragment.hidden_by_collapsed_columns,
- ..super::run_records::FragmentFactsDecidedByParent::default()
+ ..super::run_state::FragmentFactsDecidedByParent::default()
},
},
})