Truly independent web browser
LibWeb: Retain normal-flow bounds for scrollable overflow padding
Andreas Kling5a7107a4e149
diff --git a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rsindex 0322e34dc31..f49f608e36e 100644--- a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs+++ b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs@@ -322,7 +322,8 @@ fn measure_scrollable_overflow_impl(.map(|rect| CssPixelRect::from(rect).translated_by(positions.of_fragment(0)));for line_rect in line_rects.chain(elided_content_rects).chain(lines_after_clamp_point) {scrollable_overflow_rect.unite(line_rect);- in_flow_and_floated_content_bounds.unite(line_rect);+ in_flow_and_floated_content_bounds.unite_horizontally(line_rect);+ in_flow_and_floated_content_bounds.unite_vertically(line_rect);}for fragment in side_data.fragments() {// NB: The box holding the line boxes is the containing block of each of their fragments, and their@@ -387,6 +388,9 @@ fn measure_scrollable_overflow_impl(// 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 container_inline_axis_is_horizontal = layout_arena+ .node_style_if_live(box_node)+ .is_none_or(|style| style.writing_mode() == writing_mode::HORIZONTAL_TB);let direct_children = layout_arena.children(box_node);let other_contained_boxes = non_child_boxes_by_containing_block.get(&box_node)@@ -459,6 +463,61 @@ fn measure_scrollable_overflow_impl(}let untransformed_child_border_box = paintable_geometry::absolute_border_box_rect(layout_arena, child_node);+ // NB: Collect normal-flow bounds before filtering visible overflow, which relative positioning can move+ // wholly before the scroll origin.+ let child_is_in_flow = !(child_is_floating || child_is_absolutely_positioned);+ if child_is_in_flow || child_is_floating {+ let mut normal_flow_border_box = untransformed_child_border_box;+ if child_position == positioning::RELATIVE {+ let inset = paintable_geometry::committed_inset(layout_arena, child_node);+ normal_flow_border_box = normal_flow_border_box.translated(-inset.left, -inset.top);+ }+ // INTEROP: The edges of in-flow and floated content, after which the container's end padding comes,+ // are those of the margin boxes of block-level boxes, flex items and grid items, as in Blink:+ // with their computed margins, auto counting as zero, and where they are laid out before+ // relative positioning. Toward the end of the scrollable overflow a negative margin counts,+ // but no further than the size of the box; toward its start, it does not.+ let child_is_block_level = child_is_flex_or_grid_item || !child_display.is_inline_outside();+ let content_box = match child_style {+ Some(style) if child_is_block_level || child_row.is_atomic_inline() => {+ let border_box = normal_flow_border_box;+ let margin = &style.surround().margin;+ let basis = if container_inline_axis_is_horizontal {+ paintable_absolute_content_box.width+ } else {+ paintable_absolute_content_box.height+ };+ let zero = CssPixels::from_raw(0);+ // NB: An atomic inline's inline margins contribute even when its line box has zero area.+ // Its block-axis margins are already accounted for by the line box.+ let (left, right) = if child_is_block_level || container_inline_axis_is_horizontal {+ (margin.left.to_px(basis), margin.right.to_px(basis))+ } else {+ (zero, zero)+ };+ let (top, bottom) = if child_is_block_level || !container_inline_axis_is_horizontal {+ (margin.top.to_px(basis), margin.bottom.to_px(basis))+ } else {+ (zero, zero)+ };+ let (left, right) = if overflow_directions.horizontal_axis_is_positive {+ (left.max(zero), right.max(-border_box.width))+ } else {+ (left.max(-border_box.width), right.max(zero))+ };+ let (top, bottom) = if overflow_directions.vertical_axis_is_positive {+ (top.max(zero), bottom.max(-border_box.height))+ } else {+ (top.max(-border_box.height), bottom.max(zero))+ };+ border_box.inflated(top, right, bottom, left)+ }+ _ => normal_flow_border_box,+ };+ // NB: Empty boxes still contribute their extents to the padding alignment bounds.+ in_flow_and_floated_content_bounds.unite_horizontally(content_box);+ in_flow_and_floated_content_bounds.unite_vertically(content_box);+ }let mut child_border_box = apply_css_transform_to_scrollable_overflow_rect(layout_arena,child_node,@@ -486,43 +545,6 @@ fn measure_scrollable_overflow_impl(// Border boxes with zero area do not affect the scrollable overflow area.if !child_border_box.is_empty() {scrollable_overflow_rect.unite(child_border_box);-- let child_is_in_flow = !(child_is_floating || child_is_absolutely_positioned);- if child_is_in_flow || child_is_floating {- // INTEROP: The edges of in-flow and floated content, after which the container's end padding comes,- // are those of the margin boxes of block-level boxes, flex items and grid items, as in Blink:- // with their computed margins, auto counting as zero, and where they are laid out before- // relative positioning. Toward the end of the scrollable overflow a negative margin counts,- // but no further than the size of the box; toward its start, it does not.- let child_is_block_level = child_is_flex_or_grid_item || !child_display.is_inline_outside();- let content_box = match child_style {- Some(style) if child_is_block_level => {- let mut border_box = untransformed_child_border_box;- if child_position == positioning::RELATIVE {- let inset = paintable_geometry::committed_inset(layout_arena, child_node);- border_box = border_box.translated(-inset.left, -inset.top);- }- let margin = &style.surround().margin;- let basis = paintable_absolute_content_box.width;- let zero = CssPixels::from_raw(0);- let (left, right) = (margin.left.to_px(basis), margin.right.to_px(basis));- let (top, bottom) = (margin.top.to_px(basis), margin.bottom.to_px(basis));- let (left, right) = if overflow_directions.horizontal_axis_is_positive {- (left.max(zero), right.max(-border_box.width))- } else {- (left.max(-border_box.width), right.max(zero))- };- let (top, bottom) = if overflow_directions.vertical_axis_is_positive {- (top.max(zero), bottom.max(-border_box.height))- } else {- (top.max(-border_box.height), bottom.max(zero))- };- border_box.inflated(top, right, bottom, left)- }- _ => untransformed_child_border_box,- };- in_flow_and_floated_content_bounds.unite(content_box);- }}// - The scrollable overflow areas of all of the above boxes (including zero-area boxes and accounting for@@ -982,3 +1004,98 @@ impl LayoutNodeArena {}}}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::css::computed_values::{+ BoxValues, ComputedLengthPercentageOrAuto, ComputedStyleValueHandle, GroupPayloadRef, InheritedBoxValues,+ SurroundValues, clone_group_payload, release_group_payload,+ };+ use crate::css::table_group_builder::group_index;+ use crate::layout::fragment_tree::FragmentLink;+ use crate::layout::node_data::{FfiStylePayloads, StylePayloadsRef};++ #[unsafe(no_mangle)]+ extern "C" fn ladybird_gfx_font_is_invisible(_font: *const std::ffi::c_void) -> bool {+ unreachable!("the overflow fixtures have no text fragments");+ }++ #[test]+ fn overflow_percentage_margins_use_the_containing_blocks_inline_size() {+ for (mode, expected_bottom) in [+ (writing_mode::HORIZONTAL_TB, 260),+ (writing_mode::VERTICAL_LR, 310),+ (writing_mode::VERTICAL_RL, 310),+ ] {+ let mut arena = LayoutNodeArena::new();+ let mut container_style = FfiStylePayloads {+ groups: std::array::from_fn(|index| GroupPayloadRef::default_payload(index).as_ptr()),+ };+ let mut child_style = container_style;+ // SAFETY: These are private clones of the corresponding default payloads.+ let (box_payload, inherited, surround) = unsafe {+ (+ clone_group_payload(group_index::BOX, container_style.groups[group_index::BOX]),+ clone_group_payload(+ group_index::INHERITED_BOX,+ container_style.groups[group_index::INHERITED_BOX],+ ),+ clone_group_payload(group_index::SURROUND, child_style.groups[group_index::SURROUND]),+ )+ };+ // SAFETY: Each private clone has its group's payload layout and no readers yet.+ unsafe {+ (*box_payload.cast::<BoxValues>()).display = FfiDisplay::block();+ (*box_payload.cast::<BoxValues>()).overflow_x = overflow::AUTO;+ (*box_payload.cast::<BoxValues>()).overflow_y = overflow::AUTO;+ (*inherited.cast::<InheritedBoxValues>()).writing_mode = mode;+ (*surround.cast::<SurroundValues>()).margin.bottom = ComputedLengthPercentageOrAuto {+ is_auto: false,+ value: ComputedStyleValueHandle::percentage(50.0),+ };+ }+ container_style.groups[group_index::BOX] = box_payload;+ container_style.groups[group_index::INHERITED_BOX] = inherited;+ child_style.groups[group_index::BOX] = box_payload;+ child_style.groups[group_index::INHERITED_BOX] = inherited;+ child_style.groups[group_index::SURROUND] = surround;+ let container = arena.allocate_for_test().slot;+ let child = arena.allocate_for_test().slot;+ for (node, style) in [(container, &container_style), (child, &child_style)] {+ arena.write_shape(node).set_kind(NodeKind::BlockContainer);+ arena.set_node_style(node, 0, StylePayloadsRef::new(style));+ arena.populate_paintable_row(node);+ }+ arena.insert_child(container, child, NodeSlotId::INVALID);+ let mut container_link = FragmentLink::for_test(container);+ let fragment = std::sync::Arc::get_mut(&mut container_link.fragment).unwrap();+ fragment.content_inline_size = CssPixels::from_integer(100);+ fragment.content_block_size = CssPixels::from_integer(200);+ fragment.padding_bottom = CssPixels::from_integer(10);+ arena.set_committed_fragment_link(container, container_link, None);+ let mut child_link = FragmentLink::for_test(child);+ let fragment = std::sync::Arc::get_mut(&mut child_link.fragment).unwrap();+ fragment.content_inline_size = CssPixels::from_integer(20);+ fragment.content_block_size = CssPixels::from_integer(20);+ child_link.committed_offset.y = CssPixels::from_integer(180).into();+ child_link.containing_block = container;+ arena.set_committed_fragment_link(child, child_link, None);+ let rows = arena.paintable_rows();+ let mut assignments = Vec::new();+ let actual = measure_scrollable_overflow_impl(&rows, &HashMap::default(), container, &mut assignments);+ assert_eq!(+ actual.bottom(),+ CssPixels::from_integer(expected_bottom),+ "writing mode {mode}"+ );+ drop(rows);+ arena+ .free_subtree(container)+ .destroy_shells_and_invoke_callbacks(&crate::stage::MainThread::for_test());+ release_group_payload(group_index::BOX, box_payload);+ release_group_payload(group_index::INHERITED_BOX, inherited);+ release_group_payload(group_index::SURROUND, surround);+ }+ }+}diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.txtnew file mode 100644index 00000000000..ea83eb4e320--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.txt@@ -0,0 +1,13 @@+Harness status: OK++Found 8 tests++8 Pass+Pass Check scrollHeight with overflow: auto+Pass Check scrollHeight with overflow: scroll+Pass Check scrollHeight with overflow: hidden+Pass Check scrollHeight with overflow: clip+Pass Check scrollHeight with overflow: visible+Pass Check scrollHeight with overflowX: visible, overflowY: clip+Pass Check scrollHeight with overflowX: visible, overflowY: hidden+Pass Check scrollHeight with overflowX: visible, overflowY: auto\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.txtnew file mode 100644index 00000000000..ea83eb4e320--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.txt@@ -0,0 +1,13 @@+Harness status: OK++Found 8 tests++8 Pass+Pass Check scrollHeight with overflow: auto+Pass Check scrollHeight with overflow: scroll+Pass Check scrollHeight with overflow: hidden+Pass Check scrollHeight with overflow: clip+Pass Check scrollHeight with overflow: visible+Pass Check scrollHeight with overflowX: visible, overflowY: clip+Pass Check scrollHeight with overflowX: visible, overflowY: hidden+Pass Check scrollHeight with overflowX: visible, overflowY: auto\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-padding.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-padding.txtindex ca2b3430baf..fa911e759d2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-padding.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-padding.txt@@ -2,35 +2,35 @@ Harness status: OKFound 30 tests-6 Pass-24 Fail-Fail scrollable-container 1-Fail scrollable-container 2+28 Pass+2 Fail+Pass scrollable-container 1+Pass scrollable-container 2Pass scrollable-container 3-Fail scrollable-container 4+Pass scrollable-container 4Fail scrollable-container 5-Fail scrollable-container 6-Fail scrollable-container 7+Pass scrollable-container 6+Pass scrollable-container 7Pass scrollable-container 8-Fail scrollable-container 9+Pass scrollable-container 9Fail scrollable-container 10-Fail scrollable-container 11-Fail scrollable-container 12+Pass scrollable-container 11+Pass scrollable-container 12Pass scrollable-container 13-Fail scrollable-container 14-Fail scrollable-container 15-Fail scrollable-container 16-Fail scrollable-container 17+Pass scrollable-container 14+Pass scrollable-container 15+Pass scrollable-container 16+Pass scrollable-container 17Pass scrollable-container 18-Fail scrollable-container 19-Fail scrollable-container 20-Fail scrollable-container 21-Fail scrollable-container 22+Pass scrollable-container 19+Pass scrollable-container 20+Pass scrollable-container 21+Pass scrollable-container 22Pass scrollable-container 23-Fail scrollable-container 24-Fail scrollable-container 25-Fail scrollable-container 26-Fail scrollable-container 27+Pass scrollable-container 24+Pass scrollable-container 25+Pass scrollable-container 26+Pass scrollable-container 27Pass scrollable-container 28-Fail scrollable-container 29-Fail scrollable-container 30\ No newline at end of file+Pass scrollable-container 29+Pass scrollable-container 30\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.txtnew file mode 100644index 00000000000..38e96f6261b--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.txt@@ -0,0 +1,13 @@+Harness status: OK++Found 8 tests++8 Pass+Pass Check scrollWidth with overflow: auto+Pass Check scrollWidth with overflow: scroll+Pass Check scrollWidth with overflow: hidden+Pass Check scrollWidth with overflow: clip+Pass Check scrollWidth with overflow: visible+Pass Check scrollWidth with overflowX: visible, overflowY: clip+Pass Check scrollWidth with overflowX: visible, overflowY: hidden+Pass Check scrollWidth with overflowX: visible, overflowY: auto\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.txtnew file mode 100644index 00000000000..09f6b8c08df--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 6 tests++6 Pass+Pass .scroll 1+Pass .scroll 2+Pass .scroll 3+Pass .scroll 4+Pass .scroll 5+Pass .scroll 6\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.html b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.htmlnew file mode 100644index 00000000000..ea273748aa7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end-rtl.html@@ -0,0 +1,72 @@+<!DOCTYPE html>+<title>CSS Overflow: Scrollable overflow from flex item with margin-inline-end and "direction: rtl"</title>+<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable" />+<meta name="assert" content="Flex item contribute its margin-end to parent scroller's scrollable overflow.">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<style>+ #container {+ width: 100px;+ height: 100px;+ display: flex;+ overflow: scroll;+ outline: 1px solid red;+ writing-mode: vertical-lr;+ direction: rtl;+ }++ .item {+ outline: 2px solid green;+ width: 50px;+ height: 50px;+ margin-inline-end: 950px;+ }+</style>++<div id=container>+ <div class=item></div>+</div>+<script>+ test(() => {+ container.style.overflow = "auto";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: auto");++ test(() => {+ container.style.overflow = "scroll";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: scroll");++ test(() => {+ container.style.overflow = "hidden";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: hidden");++ test(() => {+ container.style.overflow = "clip";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflow: clip");++ test(() => {+ container.style.overflow = "visible";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflow: visible");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "clip";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflowX: visible, overflowY: clip");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "hidden";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflowX: visible, overflowY: hidden");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "auto";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflowX: visible, overflowY: auto");+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.html b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.htmlnew file mode 100644index 00000000000..dff0eb0957f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-height-with-flex-item-margin-inline-end.html@@ -0,0 +1,71 @@+<!DOCTYPE html>+<title>CSS Overflow: Scrollable overflow from flex item with margin-inline-end</title>+<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable" />+<meta name="assert" content="Flex item contribute its margin-end to parent scroller's scrollable overflow.">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<style>+ #container {+ width: 100px;+ height: 100px;+ display: flex;+ overflow: scroll;+ outline: 1px solid red;+ writing-mode: vertical-lr;+ }++ .item {+ outline: 2px solid green;+ width: 50px;+ height: 50px;+ margin-inline-end: 950px;+ }+</style>++<div id=container>+ <div class=item></div>+</div>+<script>+ test(() => {+ container.style.overflow = "auto";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: auto");++ test(() => {+ container.style.overflow = "scroll";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: scroll");++ test(() => {+ container.style.overflow = "hidden";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflow: hidden");++ test(() => {+ container.style.overflow = "clip";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflow: clip");++ test(() => {+ container.style.overflow = "visible";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflow: visible");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "clip";+ assert_equals(container.scrollHeight, 100);+ }, "Check scrollHeight with overflowX: visible, overflowY: clip");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "hidden";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflowX: visible, overflowY: hidden");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "auto";+ assert_equals(container.scrollHeight, 950);+ }, "Check scrollHeight with overflowX: visible, overflowY: auto");+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.html b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.htmlnew file mode 100644index 00000000000..0fa04d01351--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-with-flex-item-margin-inline-end.html@@ -0,0 +1,70 @@+<!DOCTYPE html>+<title>CSS Overflow: Scrollable overflow from flex item with margin-inline-end</title>+<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable" />+<meta name="assert" content="Flex item contribute its margin-end to parent scroller's scrollable overflow.">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<style>+ #container {+ width: 100px;+ height: 100px;+ display: flex;+ overflow: scroll;+ outline: 1px solid red;+ }++ .item {+ outline: 2px solid green;+ width: 50px;+ height: 50px;+ margin-inline-end: 950px;+ }+</style>++<div id=container>+ <div class=item></div>+</div>+<script>+ test(() => {+ container.style.overflow = "auto";+ assert_equals(container.scrollWidth, 950);+ }, "Check scrollWidth with overflow: auto");++ test(() => {+ container.style.overflow = "scroll";+ assert_equals(container.scrollWidth, 950);+ }, "Check scrollWidth with overflow: scroll");++ test(() => {+ container.style.overflow = "hidden";+ assert_equals(container.scrollWidth, 950);+ }, "Check scrollWidth with overflow: hidden");++ test(() => {+ container.style.overflow = "clip";+ assert_equals(container.scrollWidth, 100);+ }, "Check scrollWidth with overflow: clip");++ test(() => {+ container.style.overflow = "visible";+ assert_equals(container.scrollWidth, 100);+ }, "Check scrollWidth with overflow: visible");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "clip";+ assert_equals(container.scrollWidth, 100);+ }, "Check scrollWidth with overflowX: visible, overflowY: clip");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "hidden";+ assert_equals(container.scrollWidth, 950);+ }, "Check scrollWidth with overflowX: visible, overflowY: hidden");++ test(() => {+ container.style.overflowX = "visible";+ container.style.overflowY = "auto";+ assert_equals(container.scrollWidth, 950);+ }, "Check scrollWidth with overflowX: visible, overflowY: auto");+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.html b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.htmlnew file mode 100644index 00000000000..162a8a20ebb--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-overflow/scrollable-overflow-zero-one-axis.html@@ -0,0 +1,59 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Overflow: Scroll Length Calculated Correctly When One Axis Has Zero Length</title>+<link rel="author" title="David Shin" href="mailto:[email protected]">+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">+<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable">+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1800907">+<style>+.scroll {+ overflow: scroll;+}++.zero-h {+ width: 100px;+ height: 0px;+}++.zero-w {+ width: 0;+ height: 100px;+}++.flex-row {+ display: flex;+}++.flex-col {+ display: flex;+ flex-direction: column;+}++.grid {+ display: grid;+}+</style>+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../resources/check-layout-th.js"></script>+<body onload="checkLayout('.scroll')">+<div class="scroll zero-h" data-expected-scroll-height="100">+ <div class="zero-w"></div>+</div>+<div class="scroll zero-w" data-expected-scroll-width="100">+ <div class="zero-h"></div>+</div>++<div class="scroll zero-h flex-row" data-expected-scroll-height="100">+ <div class="zero-w"></div>+</div>+<div class="scroll zero-w flex-col" data-expected-scroll-width="100">+ <div class="zero-h"></div>+</div>++<div class="scroll zero-h grid" data-expected-scroll-height="100">+ <div class="zero-w"></div>+</div>+<div class="scroll zero-w grid" data-expected-scroll-width="100">+ <div class="zero-h"></div>+</div>