RESOLVED FIXED 285754
Element with `overflow: scroll` does not correctly account for the right margin of its child to determine the scrollable area
https://bugs.webkit.org/show_bug.cgi?id=285754
Summary Element with `overflow: scroll` does not correctly account for the right marg...
Antoine Quint
Reported 2025-01-10 09:50:17 PST
Created attachment 473859 [details] Test Look at the attached test case which is this simple HTML and CSS: ``` <!DOCTYPE html> <style> #scroller { overflow: scroll; width: 200px; height: 200px; background-color: gray; } #target { margin: 200px; width: 100px; height: 100px; background-color: green; } </style> <div id="scroller"> <div id="target"></div> </div> ``` In Chrome, `scroller.scrollWidth` returns `500` while in Safari Technology Preview 210 it returns `300`, as if `margin-right` for the `#target` was `0` and not `200px`.
Attachments
Test (351 bytes, text/html)
2025-01-10 09:50 PST, Antoine Quint
no flags
Patch (6.18 KB, patch)
2025-02-09 06:56 PST, zalan
no flags
Patch (6.18 KB, patch)
2025-02-10 07:00 PST, zalan
no flags
Patch (6.22 KB, patch)
2025-02-10 07:48 PST, zalan
no flags
Patch (14.78 KB, patch)
2025-02-10 14:59 PST, zalan
no flags
[fast-cq]Patch (16.51 KB, patch)
2025-02-10 17:23 PST, zalan
no flags
Antoine Quint
Comment 1 2025-01-10 09:51:07 PST
This affects the WPT test `scroll-animations/css/view-timeline-inset-animation.html` which fails to scroll deep enough in the scroller to reach the expected animation values.
Simon Fraser (smfr)
Comment 2 2025-01-10 10:13:12 PST
This is about overflow computation.
Radar WebKit Bug Importer
Comment 3 2025-01-10 10:13:34 PST
zalan
Comment 4 2025-02-09 06:56:24 PST
zalan
Comment 5 2025-02-10 07:00:58 PST
zalan
Comment 6 2025-02-10 07:48:54 PST
zalan
Comment 7 2025-02-10 14:59:06 PST
zalan
Comment 8 2025-02-10 17:23:31 PST
Created attachment 474195 [details] [fast-cq]Patch
EWS
Comment 9 2025-02-11 05:19:21 PST
Committed 290207@main (dd84bf8fcfcc): <https://commits.webkit.org/290207@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 474195 [details].
Fujii Hironori
Comment 10 2025-02-11 21:55:25 PST
imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-nested.html is unexpectedly passing after 290207@main. History: https://results.webkit.org/?suite=layout-tests&test=imported%2Fw3c%2Fweb-platform-tests%2Fcss%2Fcss-anchor-position%2Fanchor-scroll-nested.html I'm going to unmark it.
Fujii Hironori
Comment 11 2025-02-11 21:58:04 PST
zalan
Comment 12 2025-02-12 05:15:20 PST
(In reply to Fujii Hironori from comment #10) > imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-nested. > html is unexpectedly passing after 290207@main. > History: > https://results.webkit.org/?suite=layout-tests&test=imported%2Fw3c%2Fweb- > platform-tests%2Fcss%2Fcss-anchor-position%2Fanchor-scroll-nested.html > I'm going to unmark it. Thank you.
EWS
Comment 13 2025-02-12 11:34:35 PST
Test gardening commit 290284@main (0385ef866f07): <https://commits.webkit.org/290284@main> Reviewed commits have been landed. Closing PR #40469 and removing active labels.
Kiet Ho
Comment 14 2025-02-13 11:39:39 PST
This test has been flaky for a very long time I believe, so it'd be better to mark it as flaky instead of passing.
Kiet Ho
Comment 15 2025-02-13 11:45:00 PST
(please disregard my comment, I got the test wrong)
Note You need to log in before you can comment on or make changes to this bug.