Skip to content

Truly independent web browser

LibWeb: Test the overflow shortcut before line clamp exclusion

Andreas Kling086ba536e71b
diff --git a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs
index 0d447dd0205..d0500551c23 100644
--- a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs
+++ b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs
@@ -375,6 +375,7 @@ fn measure_scrollable_overflow_impl(
// its 3D rendering context. [CSS3-TRANSFORMS]
// OPTIMIZATION: The layout tree already indexes direct children. Retain only boxes whose
// containing block differs from their parent in the supplemental index.
+ let box_has_line_clamp_point = style_queries::has_line_clamp_point(layout_arena, box_node);
let direct_children = layout_arena.children(box_node);
let other_contained_boxes = non_child_boxes_by_containing_block
.get(&box_node)
@@ -409,9 +410,6 @@ fn measure_scrollable_overflow_impl(
let child_flags = child_row.flags();
let child_is_flex_or_grid_item = child_flags & (NodeFlag::IsFlexItem as u32 | NodeFlag::IsGridItem as u32) != 0;
let child_is_floating = !child_is_flex_or_grid_item && child_style.is_some_and(|style| style.is_floating());
- if style_queries::is_excluded_from_scrollable_overflow_by_line_clamp(layout_arena, child_node) {
- continue;
- }
let child_display = child_style.map_or_else(FfiDisplay::block, |style| style.display());
{
@@ -422,10 +420,8 @@ fn measure_scrollable_overflow_impl(
&& child_display.is_inline_outside()
&& !child_is_floating
&& !child_has_css_transform
- && !style_queries::has_line_clamp_point(layout_arena, box_node)
- && layout_arena
- .committed_side_data(child_node)
- .overflow_valid_across_recommits
+ && !box_has_line_clamp_point
+ && child_data.overflow_valid_across_recommits
{
let border = crate::painting::paintable_geometry::committed_border(layout_arena, child_node);
let zero = CssPixels::from_raw(0);
@@ -447,6 +443,9 @@ fn measure_scrollable_overflow_impl(
}
}
}
+ if style_queries::is_excluded_from_scrollable_overflow_by_line_clamp(layout_arena, child_node) {
+ continue;
+ }
let untransformed_child_border_box = paintable_geometry::absolute_border_box_rect(layout_arena, child_node);
let mut child_border_box = apply_css_transform_to_scrollable_overflow_rect(