Skip to content

Truly independent web browser

LibWeb: Pack the optional sizes among a run's sizing directives

Aliaksandr Kalenik0f7557578ae5
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index 8fcc068de94..3c241fe85e2 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -2940,25 +2940,28 @@ impl<'pass> BlockFormattingContext<'pass> {
available_space,
containing_block_constraints: input.containing_block_constraints,
sizing: RootSizingDirectives {
- forced_content_block_size: definite_content_block_size_of_fieldset_to_fill.map(
- |fieldset_content_block_size| {
+ forced_content_block_size: geometry::PackedOptionalCssPixels::from(
+ definite_content_block_size_of_fieldset_to_fill.map(|fieldset_content_block_size| {
let metrics = self.metrics_of(sized_child);
(fieldset_content_block_size
- content_block_offset
- metrics.border_box_bottom(false)
- metrics.margin_bottom())
.max(CssPixels::default())
- },
+ }),
),
forced_min_border_box_block_size: if is_table_formatting_context {
input.sizing.forced_min_border_box_block_size
} else {
- None
+ geometry::PackedOptionalCssPixels::from(None)
},
- block_parent_resolved_content_inline_size: probe.content_inline_size,
- table_box_content_block_offset_in_wrapper: is_table_formatting_context
- .then_some(content_block_offset),
- float_avoidance_inline_size,
+ 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),
+ ),
+ float_avoidance_inline_size: geometry::PackedOptionalCssPixels::from(float_avoidance_inline_size),
outer_float_intrusion_before_list_item_children: inline_space_used_before_children_formatted,
..RootSizingDirectives::default()
},
@@ -4109,8 +4112,8 @@ impl<'pass> BlockFormattingContext<'pass> {
},
containing_block_constraints: input.containing_block_constraints,
sizing: RootSizingDirectives {
- forced_content_inline_size: Some(geometry.inline_size),
- forced_content_block_size: definite_block_size,
+ forced_content_inline_size: geometry::PackedOptionalCssPixels::from(Some(geometry.inline_size)),
+ forced_content_block_size: geometry::PackedOptionalCssPixels::from(definite_block_size),
..RootSizingDirectives::default()
},
participation: ParticipationInParentFormattingContext::Root,
@@ -4772,7 +4775,11 @@ impl<'pass> BlockFormattingContext<'pass> {
..input
},
);
- self.max_lines.set(measurement_result.automatic_line_clamp_max_lines);
+ self.max_lines.set(
+ measurement_result
+ .automatic_line_clamp_max_lines
+ .map(|lines| lines as usize),
+ );
if self.max_lines.get() == Some(0) {
self.line_clamp_point_found.set(true);
}
diff --git a/Libraries/LibWeb/Rust/src/layout/commit.rs b/Libraries/LibWeb/Rust/src/layout/commit.rs
index 3718e07cf42..9cb17ea7a87 100644
--- a/Libraries/LibWeb/Rust/src/layout/commit.rs
+++ b/Libraries/LibWeb/Rust/src/layout/commit.rs
@@ -369,10 +369,11 @@ impl<'tree> Commit<'_, 'tree> {
let link_with_merged_line_index;
let link = if first.containing_block_line_index_offset != 0 && first.link.containing_line_box_index.is_some() {
link_with_merged_line_index = FragmentLink {
- containing_line_box_index: first
- .link
- .containing_line_box_index
- .map(|index| index + first.containing_block_line_index_offset),
+ containing_line_box_index: first.link.containing_line_box_index.map(|index| {
+ index
+ + u32::try_from(first.containing_block_line_index_offset)
+ .expect("a line box index fits in 32 bits")
+ }),
..first.link.clone()
};
&link_with_merged_line_index
diff --git a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
index 4db68dd6001..63d8c823e2a 100644
--- a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
@@ -1378,7 +1378,8 @@ mod tests {
let mut adopting_input = item_input;
adopting_input.sizing.adopt_automatic_content_block_size = true;
- adopting_input.sizing.content_block_size_after_inside_layout = Some(px(40));
+ adopting_input.sizing.content_block_size_after_inside_layout =
+ geometry::PackedOptionalCssPixels::from(Some(px(40)));
let probe = key_of(adopting_input);
assert!(!stored.matches(&probe, RunInputsTheStoredRunNeverObserved::default()));
@@ -1467,7 +1468,10 @@ mod tests {
let mutators: [fn(&mut FcRunCacheKey); 4] = [
|probe| probe.input.containing_block_constraints.percentage_basis_block_size = Some(px(10)),
|probe| probe.input.available_space.block_size = AvailableSize::definite(px(10)),
- |probe| probe.input.sizing.forced_min_border_box_block_size = Some(px(10)),
+ |probe| {
+ probe.input.sizing.forced_min_border_box_block_size =
+ geometry::PackedOptionalCssPixels::from(Some(px(10)))
+ },
|probe| {
probe.input.participation = ParticipationInParentFormattingContext::Float {
containing_block_position_in_bfc_root: FfiCssPixelPoint::default(),
diff --git a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
index 039f42f0514..103351e121c 100644
--- a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs
@@ -3238,8 +3238,9 @@ impl<'pass> FlexFormattingContext<'pass> {
// size is already the stretched size, so measure the captions against the wrapper's own content.
let captions_block_size = sizes.wrapper_content_block_size - sizes.table_box_border_box_block_size;
let stretched_table_box_block_size = self.flex_items[index].cross_size.unwrap() - captions_block_size;
- input.sizing.forced_min_border_box_block_size =
- Some(stretched_table_box_block_size.max(sizes.table_box_border_box_block_size));
+ input.sizing.forced_min_border_box_block_size = geometry::PackedOptionalCssPixels::from(Some(
+ stretched_table_box_block_size.max(sizes.table_box_border_box_block_size),
+ ));
}
if self.flex_items[index].cross_size_was_resolved_from_aspect_ratio
@@ -3248,7 +3249,8 @@ impl<'pass> FlexFormattingContext<'pass> {
.cross_size_transferred_through_aspect_ratio
.is_some()
{
- input.sizing.content_block_size_after_inside_layout = self.flex_items[index].cross_size;
+ input.sizing.content_block_size_after_inside_layout =
+ geometry::PackedOptionalCssPixels::from(self.flex_items[index].cross_size);
}
input
}
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index ea477bae195..39f6b4ee1bd 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -544,11 +544,11 @@ fn resolve_containing_line_box_index(
callbacks: &LayoutPass<'_>,
node: Node,
coordinate: Option<used_values::LineBoxFragmentCoordinate>,
-) -> Option<usize> {
+) -> Option<u32> {
let coordinate = coordinate?;
NodeFacts::new(callbacks, node)
.is_non_fragmented_box()
- .then_some(coordinate.line_box_index)
+ .then(|| u32::try_from(coordinate.line_box_index).expect("a line box index fits in 32 bits"))
}
fn committed_offset_delta_at_placement(
@@ -984,7 +984,7 @@ pub struct BorderData {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(crate) struct ChildLayoutResult {
pub automatic_content_block_size: CssPixels,
- pub automatic_line_clamp_max_lines: Option<usize>,
+ pub automatic_line_clamp_max_lines: Option<u32>,
pub baselines: DerivedBaselines,
/// For a table wrapper, the inline size its table box gives it.
pub table_wrapper_content_inline_size: Option<CssPixels>,
@@ -1675,10 +1675,10 @@ fn apply_root_sizing_directives(
let directives = input.sizing;
if directives.forced_content_inline_size.is_some() || directives.forced_content_block_size.is_some() {
let used = sized_root.cells;
- if let Some(inline_size) = directives.forced_content_inline_size {
+ if let Some(inline_size) = directives.forced_content_inline_size.get() {
used.set_content_inline_size(inline_size);
}
- if let Some(block_size) = directives.forced_content_block_size {
+ if let Some(block_size) = directives.forced_content_block_size.get() {
used.set_content_block_size(block_size);
used.update_cells(|cells| cells.has_definite_block_size = true);
}
@@ -1706,7 +1706,7 @@ fn dimension_block_level_root(
let flex_self_resolution_space = size_block_level_root_ahead_of_its_contents(run, sized_root, input);
let mut body_input = body_input_with_inner_available_space(sized_root.cells, input);
body_input.sizing.flex_self_block_size_resolution_space = flex_self_resolution_space;
- if let Some(block_size) = input.sizing.forced_content_block_size {
+ if let Some(block_size) = input.sizing.forced_content_block_size.get() {
let used = sized_root.cells;
used.set_content_block_size(block_size);
used.update_cells(|cells| cells.has_definite_block_size = true);
@@ -1752,7 +1752,7 @@ 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 {
+ 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 =
@@ -2306,7 +2306,9 @@ fn lay_out_run_root_and_contents<'pass>(
laid_out_content_block_size = Some(context.laid_out_content_block_size());
let mut result = ChildLayoutResult {
automatic_content_block_size: context.automatic_content_block_size(),
- automatic_line_clamp_max_lines: context.automatic_line_clamp_max_lines(),
+ automatic_line_clamp_max_lines: context
+ .automatic_line_clamp_max_lines()
+ .map(|lines| u32::try_from(lines).unwrap_or(u32::MAX)),
baselines: context.derived_baselines_of_root_box(),
table_wrapper_content_inline_size: context.table_wrapper_content_inline_size(),
table_box_in_wrapper_border_box_block_size: context.table_box_in_wrapper_border_box_block_size(),
@@ -3340,7 +3342,7 @@ pub(super) fn content_block_size_adopted_after_run(
if input.participation != ParticipationInParentFormattingContext::Item {
return None;
}
- input.sizing.content_block_size_after_inside_layout.or(input
+ input.sizing.content_block_size_after_inside_layout.get().or(input
.sizing
.adopt_automatic_content_block_size
.then_some(automatic_content_block_size))
diff --git a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
index 6db1811e3b9..698768c8c1e 100644
--- a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
@@ -61,7 +61,7 @@ pub(crate) struct FragmentLink {
pub(crate) table_column_span: u32,
pub(crate) hidden_by_collapsed_columns: bool,
pub(crate) is_invisible_for_line_clamp: bool,
- pub(crate) containing_line_box_index: Option<usize>,
+ pub(crate) containing_line_box_index: Option<u32>,
/// Shared, as few links place an absolutely positioned box, the inputs are larger than the rest of the link, and
/// layout run cache entries keep copies of links.
pub(crate) abspos_layout_inputs: Option<std::sync::Arc<abspos_inputs::AbsposLayoutInputs>>,
@@ -731,7 +731,7 @@ pub(crate) struct PlacementData {
pub(crate) table_column_span: u32,
pub(crate) hidden_by_collapsed_columns: bool,
pub(crate) is_invisible_for_line_clamp: bool,
- pub(crate) containing_line_box_index: Option<usize>,
+ pub(crate) containing_line_box_index: Option<u32>,
pub(crate) abspos_layout_inputs: Option<std::sync::Arc<abspos_inputs::AbsposLayoutInputs>>,
pub(crate) default_scroll_shift: Option<abspos_inputs::DefaultScrollShift>,
pub(crate) containing_block: crate::layout::node_data::NodeSlotId,
@@ -743,7 +743,7 @@ impl PlacementData {
facts: &run_state::FactsDecidedByParent,
cells: &used_values::RootInputCells,
abspos_layout_inputs: Option<std::sync::Arc<abspos_inputs::AbsposLayoutInputs>>,
- containing_line_box_index: Option<usize>,
+ containing_line_box_index: Option<u32>,
committed_offset: FfiCssPixelPoint,
frame: geometry::Frame,
) -> Self {
@@ -1384,7 +1384,7 @@ impl RunFragmentBuilder {
if link.containing_block == self.root_node
&& let Some(line_index) = link.containing_line_box_index.as_mut()
{
- *line_index += root_line_index_offset;
+ *line_index += u32::try_from(root_line_index_offset).expect("a line box index fits in 32 bits");
}
inner.top_scope_links.push(link);
}
@@ -1571,7 +1571,7 @@ impl RunFragmentBuilder {
geometry: FragmentGeometry,
facts: run_state::FactsDecidedByParent,
abspos_layout_inputs: Option<std::sync::Arc<abspos_inputs::AbsposLayoutInputs>>,
- containing_line_box_index: Option<usize>,
+ containing_line_box_index: Option<u32>,
committed_offset: FfiCssPixelPoint,
own_anchor_candidate_border_box_rect: Option<CssPixelRect>,
) -> PlacedFragment {
diff --git a/Libraries/LibWeb/Rust/src/layout/geometry.rs b/Libraries/LibWeb/Rust/src/layout/geometry.rs
index 30ab591bfdf..d6f02ddf81b 100644
--- a/Libraries/LibWeb/Rust/src/layout/geometry.rs
+++ b/Libraries/LibWeb/Rust/src/layout/geometry.rs
@@ -318,31 +318,65 @@ impl ContainingBlockConstraints {
}
}
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub(crate) struct PackedOptionalCssPixels(i32);
+
+impl PackedOptionalCssPixels {
+ const NONE_RAW_VALUE: i32 = i32::MIN;
+
+ pub(crate) fn get(self) -> Option<CssPixels> {
+ (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
+ }
+}
+
+impl Default for PackedOptionalCssPixels {
+ fn default() -> Self {
+ Self(Self::NONE_RAW_VALUE)
+ }
+}
+
+impl From<Option<CssPixels>> for PackedOptionalCssPixels {
+ fn from(value: Option<CssPixels>) -> Self {
+ match value {
+ Some(pixels) => Self(pixels.raw_value().max(Self::NONE_RAW_VALUE + 1)),
+ None => Self::default(),
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(crate) struct RootSizingDirectives {
- pub(crate) forced_content_inline_size: Option<CssPixels>,
- pub(crate) forced_content_block_size: Option<CssPixels>,
- pub(crate) forced_min_border_box_block_size: Option<CssPixels>,
+ pub(crate) forced_content_inline_size: PackedOptionalCssPixels,
+ 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: Option<CssPixels>,
+ pub(crate) block_parent_resolved_content_inline_size: PackedOptionalCssPixels,
// Input-only: the table formatting context supplies the cell's intrinsic block padding
// (the vertical-alignment stretch) before laying out the cell's contents.
pub(crate) table_cell_intrinsic_block_padding: Option<(CssPixels, CssPixels)>,
// 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.
- pub(crate) table_box_content_block_offset_in_wrapper: Option<CssPixels>,
+ pub(crate) table_box_content_block_offset_in_wrapper: PackedOptionalCssPixels,
pub(crate) adopt_automatic_content_block_size: bool,
pub(crate) finds_automatic_line_clamp_lines: bool,
// Input-only: a flex item lays out its content against the block size transferred through its aspect ratio, then
// takes this block size, which the automatic minimum size grew to fit the content.
- pub(crate) content_block_size_after_inside_layout: Option<CssPixels>,
+ pub(crate) content_block_size_after_inside_layout: PackedOptionalCssPixels,
pub(crate) flex_self_block_size_resolution_space: Option<AvailableSpace>,
- pub(crate) float_avoidance_inline_size: Option<CssPixels>,
+ pub(crate) float_avoidance_inline_size: PackedOptionalCssPixels,
pub(crate) outer_float_intrusion_before_list_item_children: inline_formatting_context::SpaceUsedByFloats,
pub(crate) treat_block_axis_percentage_insets_as_auto_beyond_root: bool,
- pub(crate) maximum_inline_size_resolved_by_caller: Option<CssPixels>,
+ pub(crate) maximum_inline_size_resolved_by_caller: PackedOptionalCssPixels,
pub(crate) root_is_measured_for_its_content_block_size: bool,
// Input-only: MathML layout lays out an embellished operator with the size its core operator should stretch to
// cover.
@@ -389,6 +423,8 @@ pub(crate) struct LayoutInput {
pub(crate) participation: ParticipationInParentFormattingContext,
}
+const _: () = assert!(size_of::<LayoutInput>() <= 144);
+
impl LayoutInput {
pub(crate) fn new(
available_space: AvailableSpace,
@@ -408,8 +444,8 @@ impl LayoutInput {
forced_content_inline_size: CssPixels,
forced_content_block_size: CssPixels,
) -> Self {
- self.sizing.forced_content_inline_size = Some(forced_content_inline_size);
- self.sizing.forced_content_block_size = Some(forced_content_block_size);
+ self.sizing.forced_content_inline_size = PackedOptionalCssPixels::from(Some(forced_content_inline_size));
+ self.sizing.forced_content_block_size = PackedOptionalCssPixels::from(Some(forced_content_block_size));
self
}
}
diff --git a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
index b3bd6180b33..e6d49cf40d9 100644
--- a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
@@ -1512,7 +1512,7 @@ impl<'pass> GridFormattingContext<'pass> {
}
self.available_space = Some(input.available_space);
self.layout_input = Some(input.clone());
- self.maximum_inline_size_resolved_by_caller = input.sizing.maximum_inline_size_resolved_by_caller;
+ self.maximum_inline_size_resolved_by_caller = input.sizing.maximum_inline_size_resolved_by_caller.get();
self.item_runs_offered_to_row_measurements = None;
self.column_lines.clear();
self.row_lines.clear();
@@ -4867,7 +4867,8 @@ impl<'pass> GridFormattingContext<'pass> {
if let Some(transferred) = item.block_size_transferred_through_aspect_ratio {
// NB: The content is laid out against the block size transferred through the aspect ratio, and the item
// grows to its used block size afterwards.
- sizing.content_block_size_after_inside_layout = Some(cells.content_block_size);
+ sizing.content_block_size_after_inside_layout =
+ geometry::PackedOptionalCssPixels::from(Some(cells.content_block_size));
cells.set_content_block_size(transferred);
}
self.update_cells_of(item, |item_cells| *item_cells = cells);
@@ -4883,8 +4884,9 @@ impl<'pass> GridFormattingContext<'pass> {
);
let captions_block_size = sizes.wrapper_content_block_size - sizes.table_box_border_box_block_size;
let stretched_table_box_block_size = cells.content_block_size - captions_block_size;
- sizing.forced_min_border_box_block_size =
- Some(stretched_table_box_block_size.max(sizes.table_box_border_box_block_size));
+ sizing.forced_min_border_box_block_size = geometry::PackedOptionalCssPixels::from(Some(
+ stretched_table_box_block_size.max(sizes.table_box_border_box_block_size),
+ ));
}
let mut input = self.item_layout_input(item, &cells, row_area);
input.sizing = sizing;
diff --git a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
index 89ff693d7ea..0b7cd71acb8 100644
--- a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
+++ b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs
@@ -532,7 +532,7 @@ fn content_sizes_of_container_under_each_inline_size_constraint(
ParticipationInParentFormattingContext::Root,
);
input.sizing.maximum_inline_size_resolved_by_caller =
- content_size_named_by_maximum.map(|content_size| {
+ geometry::PackedOptionalCssPixels::from(content_size_named_by_maximum.map(|content_size| {
sizing.apply_transferred_limits_to_intrinsic_inline_size(
sizing_context::SizedBox::of_own_metrics(node, &scope.root_cells(), run.callbacks.frame),
clamp_to_max_dimension_value(content_size),
@@ -541,7 +541,7 @@ fn content_sizes_of_container_under_each_inline_size_constraint(
),
constraints,
)
- });
+ }));
let size = content_inline_size(run, scope.root_cells(), input);
let dependencies = IntrinsicMeasurementDependencies {
percentage_block_size: sizing.resolve_percentage_block_size_dependency(node),
diff --git a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
index 5710ed5fbe1..22fc0c75926 100644
--- a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
@@ -3731,10 +3731,11 @@ impl<'pass> TableFormattingContext<'pass> {
inline_layout: Option<TableInlineLayout>,
) {
self.available_space = input.available_space;
- self.min_border_box_block_size_from_flex_item = input.sizing.forced_min_border_box_block_size;
+ self.min_border_box_block_size_from_flex_item = input.sizing.forced_min_border_box_block_size.get();
self.table_box_content_block_offset_in_wrapper = input
.sizing
.table_box_content_block_offset_in_wrapper
+ .get()
.unwrap_or_default();
if inline_layout.is_none_or(|layout| !self.reuse_inline_layout(input.clone(), layout)) {
self.run_until_inline_size_calculation(input, false);
diff --git a/Libraries/LibWeb/Rust/src/painting/paintable_geometry.rs b/Libraries/LibWeb/Rust/src/painting/paintable_geometry.rs
index b84c00fb68c..93db3ee197a 100644
--- a/Libraries/LibWeb/Rust/src/painting/paintable_geometry.rs
+++ b/Libraries/LibWeb/Rust/src/painting/paintable_geometry.rs
@@ -276,7 +276,10 @@ pub(crate) fn committed_svg_text_character_cells(
}
pub(crate) fn committed_containing_line_box_index(arena: &impl GeometryRead, slot: NodeSlotId) -> Option<usize> {
- arena.with_committed_fragment_link(slot, |link| link.and_then(|link| link.containing_line_box_index))
+ arena.with_committed_fragment_link(slot, |link| {
+ link.and_then(|link| link.containing_line_box_index)
+ .map(|index| index as usize)
+ })
}
pub(crate) fn committed_svg_viewport_transform(