Skip to content

Truly independent web browser

LibWeb: Map fragmented inline edges to physical sides

Andreas Kling9d6ae7f4477d
diff --git a/Libraries/LibWeb/Rust/src/layout/inline_content.rs b/Libraries/LibWeb/Rust/src/layout/inline_content.rs
index 3bb5f228ffb..4dc4bc31f26 100644
--- a/Libraries/LibWeb/Rust/src/layout/inline_content.rs
+++ b/Libraries/LibWeb/Rust/src/layout/inline_content.rs
@@ -5,7 +5,7 @@
*/
use super::CssPixels;
-use super::geometry::AvailableSize;
+use super::geometry::{AvailableSize, Side};
use super::layout_node_arena::LayoutNodeArena;
use super::node_data::NodeSlotId;
use super::{formatting_context, inline_formatting_context, used_values};
@@ -473,6 +473,12 @@ impl InlineContent {
rect.y = mirror_in_line(piece.line_index, rect.y, rect.height);
piece.border_box_rect = to_physical(rect);
piece.relpos_delta = delta_to_physical(piece.relpos_delta);
+ // https://drafts.csswg.org/css-break-3/#break-decoration
+ // NB: Painting reads physical edge bits, just as it reads the physical piece rectangle.
+ piece.present_edges = [Side::Top, Side::Right, Side::Bottom, Side::Left]
+ .into_iter()
+ .filter(|side| piece.present_edges & (1 << *side as u8) != 0)
+ .fold(0, |edges, side| edges | (1 << frame.physical_side(side) as u8));
}
content
}
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-break/hit-test-inline-fragmentation-with-border-radius.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-break/hit-test-inline-fragmentation-with-border-radius.txt
index cfa3de414c2..741239a6b8a 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-break/hit-test-inline-fragmentation-with-border-radius.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-break/hit-test-inline-fragmentation-with-border-radius.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 36 tests
-28 Pass
-8 Fail
+36 Pass
Pass Horizontal line 1, hit test outside top-left rounded corner
Pass Horizontal line 1, hit test inside top-left rounded corner
Pass Horizontal line 1, hit test outside bottom-left rounded corner
@@ -18,25 +17,25 @@ Pass Horizontal line 2, hit test inside top-left right-angled corner
Pass Horizontal line 2, hit test inside bottom-left right-angled corner
Pass Vertical LR line 1, hit test outside top-left rounded corner
Pass Vertical LR line 1, hit test inside top-left rounded corner
-Fail Vertical LR line 1, hit test outside top-right rounded corner
+Pass Vertical LR line 1, hit test outside top-right rounded corner
Pass Vertical LR line 1, hit test inside top-right rounded corner
-Fail Vertical LR line 1, hit test inside bottom-left right-angled corner
+Pass Vertical LR line 1, hit test inside bottom-left right-angled corner
Pass Vertical LR line 1, hit test inside bottom-right right-angled corner
-Fail Vertical LR line 2, hit test outside bottom-left rounded corner
+Pass Vertical LR line 2, hit test outside bottom-left rounded corner
Pass Vertical LR line 2, hit test inside bottom-left rounded corner
Pass Vertical LR line 2, hit test outside bottom-right rounded corner
Pass Vertical LR line 2, hit test inside bottom-right rounded corner
Pass Vertical LR line 2, hit test inside top-left right-angled corner
-Fail Vertical LR line 2, hit test inside top-right right-angled corner
+Pass Vertical LR line 2, hit test inside top-right right-angled corner
Pass Vertical RL line 1, hit test outside top-left rounded corner
Pass Vertical RL line 1, hit test inside top-left rounded corner
-Fail Vertical RL line 1, hit test outside top-right rounded corner
+Pass Vertical RL line 1, hit test outside top-right rounded corner
Pass Vertical RL line 1, hit test inside top-right rounded corner
-Fail Vertical RL line 1, hit test inside bottom-left right-angled corner
+Pass Vertical RL line 1, hit test inside bottom-left right-angled corner
Pass Vertical RL line 1, hit test inside bottom-right right-angled corner
-Fail Vertical RL line 2, hit test outside bottom-left rounded corner
+Pass Vertical RL line 2, hit test outside bottom-left rounded corner
Pass Vertical RL line 2, hit test inside bottom-left rounded corner
Pass Vertical RL line 2, hit test outside bottom-right rounded corner
Pass Vertical RL line 2, hit test inside bottom-right rounded corner
Pass Vertical RL line 2, hit test inside top-left right-angled corner
-Fail Vertical RL line 2, hit test inside top-right right-angled corner
\ No newline at end of file
+Pass Vertical RL line 2, hit test inside top-right right-angled corner
\ No newline at end of file