Bug 211726

Summary: block element with float: right as a direct descendant of body should make document.body.scrollHeight the height of the block
Product: WebKit Reporter: Jarek Pendowski <jarek>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, bfulgham, karlcow, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Minimal example of the bug
none
wpt testcase
none
rendering in safari, firefox, chrome
none
wpt testcase with float-right in css none

Jarek Pendowski
Reported 2020-05-11 08:02:49 PDT
Created attachment 399018 [details] Minimal example of the bug Noticed when working with a mailing HTML that still uses a lot of nested tables that when a table element has an `align` attribute set to anything reasonable (left, right, center) the `scrollHeight` and `clientHeight` of the `body` containing that table is 0. Distilled the mailing to the smallest example that's still not working.
Attachments
Minimal example of the bug (411 bytes, text/html)
2020-05-11 08:02 PDT, Jarek Pendowski
no flags
wpt testcase (893 bytes, text/html)
2026-01-28 21:46 PST, Karl Dubost
no flags
rendering in safari, firefox, chrome (241.01 KB, image/png)
2026-01-28 21:46 PST, Karl Dubost
no flags
wpt testcase with float-right in css (899 bytes, text/html)
2026-01-28 22:01 PST, Karl Dubost
no flags
Radar WebKit Bug Importer
Comment 1 2020-05-12 14:10:51 PDT
Jarek Pendowski
Comment 2 2020-05-13 04:44:55 PDT
Oh - I'm sure you check this kind of stuff yourself but it works fine in Firefox and Chrome. Especially the last one could be some hint into what's different between WebKit and Chromium?
Ahmad Saleem
Comment 3 2022-10-08 17:36:18 PDT
I am able to reproduce this bug in Safari Technology Preview 155 where it shows "BROKEN NOW" dialog box while all other browsers (Chrome Canary 108 and Firefox Nightly 107) does not show these dialog boxes. Thanks!
Karl Dubost
Comment 4 2026-01-28 21:46:12 PST
Created attachment 478188 [details] wpt testcase FAIL Safari scroll height reports 0 PASS Chrome, Firefox reports 24~25
Karl Dubost
Comment 5 2026-01-28 21:46:39 PST
Created attachment 478189 [details] rendering in safari, firefox, chrome
Karl Dubost
Comment 6 2026-01-28 21:51:26 PST
https://searchfox.org/wubkat/rev/1f7d7d5a8c2357656d17d4d6474b9cc3b38423b1/Source/WebCore/html/HTMLTableElement.cpp#344-352 ```cpp case AttributeNames::alignAttr: if (!value.isEmpty()) { if (equalLettersIgnoringASCIICase(value, "center"_s)) { addPropertyToPresentationalHintStyle(style, CSSPropertyMarginInlineStart, CSSValueAuto); addPropertyToPresentationalHintStyle(style, CSSPropertyMarginInlineEnd, CSSValueAuto); } else addPropertyToPresentationalHintStyle(style, CSSPropertyFloat, value); } break; ``` Somehow align=left and align=right are interpreted as float, which indeed usually collapse the height of the container block.
Karl Dubost
Comment 7 2026-01-28 21:56:10 PST
The Table element has obsolete attributes. https://html.spec.whatwg.org/multipage/obsolete.html#HTMLTableElement-partial align is part of them.
Karl Dubost
Comment 8 2026-01-28 21:58:36 PST
In HTML 4.01 the align attribute was already deprecated. https://www.w3.org/TR/html401/struct/tables.html#h-11.2.1 It would be interesting to compare what effect has a float:right in the same circumstances.
Karl Dubost
Comment 9 2026-01-28 22:01:26 PST
Created attachment 478190 [details] wpt testcase with float-right in css So with a style float: right The same issue happens.
Karl Dubost
Comment 10 2026-01-28 22:12:58 PST
ok this is not related to table completely. <body> <div style="float: right; width: 100px; height: 100px"> </div> </body> document.body.scrollHeight FAIL safari 0 PASS chrome 100 PASS firefox 100 Let's rephrase this bug.
Note You need to log in before you can comment on or make changes to this bug.