From 09db6b86699b3c16b1f93c6707b3e9729421cba5 Mon Sep 17 00:00:00 2001 From: Shubham Gupta <32428749+shubhamg13@users.noreply.github.com> Date: Fri, 22 Aug 2025 15:59:02 +0800 Subject: [PATCH] layout: Remove workaround for `body` while building overflow frame for `StackingContextTree` construction. (#38825) While building the stacking context tree we were assuming that `` would have propagated its `overflow` value to the viewport, and thus its used `overflow` would be `visible`. However, the element that propagates `overflow` can be the root element instead. Since #38598 we are correctly taking this into account in `effective_overflow()`, so we no longer need to do anything special in the stacking context logic. Testing: `css/css-overflow/overflow-body-propagation-012.html` Fixes: #38799 Signed-off-by: Shubham Gupta --- .../layout/display_list/stacking_context.rs | 19 ------------ tests/wpt/meta/MANIFEST.json | 17 +++++++++++ .../overflow-body-propagation-012-ref.html | 14 +++++++++ .../overflow-body-propagation-012.html | 30 +++++++++++++++++++ 4 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 tests/wpt/tests/css/css-overflow/overflow-body-propagation-012-ref.html create mode 100644 tests/wpt/tests/css/css-overflow/overflow-body-propagation-012.html diff --git a/components/layout/display_list/stacking_context.rs b/components/layout/display_list/stacking_context.rs index d082c484c2b..0b2241e20c3 100644 --- a/components/layout/display_list/stacking_context.rs +++ b/components/layout/display_list/stacking_context.rs @@ -1449,25 +1449,6 @@ impl BoxFragment { }); } - // scrollable overflow path - // From https://drafts.csswg.org/css-overflow/#propdef-overflow: - // > UAs must apply the overflow-* values set on the root element to the viewport when the - // > root element’s display value is not none. However, when the root element is an [HTML] - // > html element (including XML syntax for HTML) whose overflow value is visible (in both - // > axes), and that element has as a child a body element whose display value is also not - // > none, user agents must instead apply the overflow-* values of the first such child - // > element to the viewport. The element from which the value is propagated must then have a - // > used overflow value of visible. - // - // TODO: This should only happen when the `display` value is actually propagated. - if self - .base - .flags - .contains(FragmentFlags::IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT) - { - return None; - } - let scroll_frame_rect = self .padding_rect() .translate(containing_block_rect.origin.to_vector()) diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 2ac5d3d05b2..fc97f7777cf 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -231653,6 +231653,19 @@ {} ] ], + "overflow-body-propagation-012.html": [ + "483b92e79b4f362e7cb6b5a8020103f48798b21a", + [ + null, + [ + [ + "/css/css-overflow/overflow-body-propagation-012-ref.html", + "==" + ] + ], + {} + ] + ], "overflow-canvas.html": [ "e9529cb0bc81202c5689a507435ea088028a97fc", [ @@ -446720,6 +446733,10 @@ "0d440ef20afa3d2456b702b2a1727a9f0717c4c1", [] ], + "overflow-body-propagation-012-ref.html": [ + "06b64c94334582ca9674f26648ef2be9c3c0e6c2", + [] + ], "overflow-canvas-ref.html": [ "3ad440e371906b2fa4bc2ec4ae5c430267cf11c1", [] diff --git a/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012-ref.html b/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012-ref.html new file mode 100644 index 00000000000..06b64c94334 --- /dev/null +++ b/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012-ref.html @@ -0,0 +1,14 @@ + + + +CSS Reference: BODY with overflow:hidden + + +
+ diff --git a/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012.html b/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012.html new file mode 100644 index 00000000000..483b92e79b4 --- /dev/null +++ b/tests/wpt/tests/css/css-overflow/overflow-body-propagation-012.html @@ -0,0 +1,30 @@ + + + +CSS Test: BODY with overflow:hidden + + + + + +
+