Bug 184694

Summary: document.body.scrollHeight is different after resizing the window down and up
Product: WebKit Reporter: Tobi Reif <tobi>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Major CC: bfulgham, cdumez, jond, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
the page
none
Test reduction
none
Test reduction none

Tobi Reif
Reported 2018-04-17 08:19:02 PDT
In a full-size window load https://tobireif.com/demos/ . Note that the page is short. Resize the window to be narrow, and back. Note that the same page at the same full width as before now is much longer than before. The issue does not occur in Chrome, Firefox, and Opera. The related code probably is "function setCanvasSize()" -> "document.body.scrollHeight". I hope you can ensure that it will work as in Chrome & Firefox & Opera where the reported height is the same after downsize-upsize.
Attachments
the page (281.45 KB, application/zip)
2018-04-17 08:41 PDT, Tobi Reif
no flags
Test reduction (207 bytes, text/html)
2018-05-04 16:28 PDT, alan
no flags
Test reduction (474 bytes, text/html)
2018-05-04 16:33 PDT, alan
no flags
Tobi Reif
Comment 1 2018-04-17 08:21:01 PDT
(Please set the correct Component, it might be Layout instead of DOM.)
Tobi Reif
Comment 2 2018-04-17 08:41:03 PDT
Created attachment 338118 [details] the page
Radar WebKit Bug Importer
Comment 3 2018-04-20 23:34:04 PDT
Tobi Reif
Comment 4 2018-05-03 01:33:54 PDT
I hope you can update this ticket as soon as <rdar://problem/39618561> got set to fixed, so that I can check the fix in the latest Safari (in addition to your tests).
alan
Comment 5 2018-05-04 16:28:04 PDT
Created attachment 339609 [details] Test reduction
alan
Comment 6 2018-05-04 16:29:52 PDT
Interestingly both FF and Chrome behave the same as Safari in quirks mode.
alan
Comment 7 2018-05-04 16:31:47 PDT
Test reduction -> 1. resize the page until all boxes wrap 2. resize it back until all boxes are on the same line -> check for scrolling.
alan
Comment 8 2018-05-04 16:33:20 PDT
Created attachment 339610 [details] Test reduction
Simon Fraser (smfr)
Comment 9 2018-05-07 14:11:42 PDT
So this bug is about the value of scrollHeight during the resize handler?
Tobi Reif
Comment 10 2018-05-08 00:45:22 PDT
> So this bug is about the value of scrollHeight during the resize handler? Yep - when you insert "console.log(document.body.scrollHeight);" into "function setCanvasSize()", then open the page in eg Chrome, you always get ~ the same value after you downsize upsize the window. In Safari you'll get very different much larger values after downsize upsize.
Simon Fraser (smfr)
Comment 11 2018-05-18 21:19:07 PDT
document.body.scrollHeight seems incompatible between Safari and Chrome/Firefox. In Safari, it's max(view height, contents height), but in other browsers it's just contents height. This is odd, since scrollHeight is max(box height, contents height) for an overflow scroll div.
Simon Fraser (smfr)
Comment 12 2018-05-18 21:27:27 PDT
scrollHeight on the body comes from the ScrollView contentsSize, and that is computed via RenderView::unscaledDocumentRect() which uses layoutOverflowRect(). If not overflowing, we use height and width of the RenderView (which is not the body!).
Tobi Reif
Comment 14 2018-05-19 05:47:32 PDT
Thanks for investigating!
Tobi Reif
Comment 15 2018-06-19 04:00:40 PDT
I hope this can get fixed
Tobi Reif
Comment 16 2018-11-09 01:06:14 PST
The issue still exists in Safari 12.0.1 (14606.2.104.1.1) and in Safari Technology Preview Release 69 (Safari 12.1, WebKit 14607.1.12) : After sizing the window to be narrow and back, the page is longer than before == longer than it should be.
Tobi Reif
Comment 17 2019-06-25 09:27:07 PDT
It would be great if this could get fixed :)
Tobi Reif
Comment 18 2019-09-25 01:27:44 PDT
It would be great if this could get fixed :)
Tobi Reif
Comment 19 2021-07-01 02:52:58 PDT
It would be great if this could get fixed.
Tobi Reif
Comment 20 2021-07-01 03:00:11 PDT
Actually, I can't reproduce this anymore (neither with the linked page nor with the supplied attachment). If you agree that the issue got resolved you can close this ticket.
Simon Fraser (smfr)
Comment 21 2021-07-01 11:10:07 PDT
Confirmed, can no longer reproduce.
Tobi Reif
Comment 22 2021-07-02 00:50:17 PDT
Thanks!
Note You need to log in before you can comment on or make changes to this bug.