Truly independent web browser
LibWeb: Skip inline pieces of reset rows when measuring ink overflow
Andreas Kling9deb1d72e22c
diff --git a/Libraries/LibWeb/Rust/src/painting/ink_overflow.rs b/Libraries/LibWeb/Rust/src/painting/ink_overflow.rsindex d9247c57192..89c70633ce7 100644--- a/Libraries/LibWeb/Rust/src/painting/ink_overflow.rs+++ b/Libraries/LibWeb/Rust/src/painting/ink_overflow.rs@@ -177,6 +177,11 @@ pub(crate) fn own_ink_overflow(let side = source.committed_side_data(root);let positions = paintable_geometry::LineRootPositions::new(source, root);let mut include_piece = |piece: &crate::painting::paintable_data::InlineBoxPieceRecord| {+ // NB: A box leaving the line root resets its row before the root lays out its lines again, and resetting+ // the row asks for the root's ink overflow, so the pieces can name a box that paints nothing now.+ if !source.paintable_row_is_populated(piece.node) {+ return;+ }let piece_owner = if fragment_ownership::is_self_painting_inline(source, piece.node) {piece.node} else {diff --git a/Tests/LibWeb/Crash/Painting/inline-box-removed-before-scroll-snap-restyle.html b/Tests/LibWeb/Crash/Painting/inline-box-removed-before-scroll-snap-restyle.htmlnew file mode 100644index 00000000000..caf111df4f8--- /dev/null+++ b/Tests/LibWeb/Crash/Painting/inline-box-removed-before-scroll-snap-restyle.html@@ -0,0 +1,16 @@+<!DOCTYPE html>+<!-- Removing the span clears its paintable row while its line root still lists its inline box pieces. Restyling the+ document element of a snapping viewport then asks what the viewport snaps before layout, which measures the ink+ overflow of the line root. -->+<style>+ html { scroll-snap-type: y mandatory; }+ html.restyled { color: green; }+ #root { width: 100px; }+</style>+<div id="root">text <span id="span">an inline box with text that wraps over several lines</span> more</div>+<script>+ document.body.offsetWidth;+ span.remove();+ document.documentElement.classList.add("restyled");+ document.body.offsetWidth;+</script>