Bug 211219

Summary: Dynamically added custom scrollbar styles don't apply
Product: WebKit Reporter: mustafa.0x
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bfulgham, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Bug reproduction
none
safari-css-bug-simplified
none
Testcase none

Description mustafa.0x 2020-04-29 21:30:16 PDT
Created attachment 398033 [details]
Bug reproduction

See Attached file. Deleting line #23 will allow the ::-webkit-scrollbar styles to apply.

Note: this also occurs in Chrome.
Comment 1 Alexey Proskuryakov 2020-05-01 12:52:03 PDT
This is a somewhat large script. Could you please clarify what makes you think that this is a browser engine bug?
Comment 2 mustafa.0x 2020-05-01 14:20:07 PDT
Created attachment 398239 [details]
safari-css-bug-simplified

Regardless of the script size, it shouldn't affect the scrollbar.

In any case, I made the script much lot simpler — one line.

So, for some reason, accessing `window.visualViewport.height` is affecting the scrollbars. Remove it and the scrollbars will be as set by the CSS.

Also, I previously mentioned that Chrome has the same issue. It does not in fact. Open the file in Chrome and the scrollbars will be set as the CSS says.
Comment 3 Simon Fraser (smfr) 2020-05-01 15:00:49 PDT
Does this reproduce in a recent STP? We fixed bug for sheets with large numbers of rules.
Comment 4 mustafa.0x 2020-05-01 15:09:54 PDT
Reproduced in Release 105 (Safari 13.2, WebKit 15610.1.10)

Also, there aren't a large number of rules here. The whole file is 500 bytes.
Comment 5 Simon Fraser (smfr) 2020-05-01 20:03:31 PDT
My guess is that the call to window.visualViewport.height triggers a layout before we see the custom scrollbar styles, then fail to dynamically change to the custom scrollbars.
Comment 6 Simon Fraser (smfr) 2020-05-01 20:11:08 PDT
Created attachment 398274 [details]
Testcase

This testcase clarifies what's happening.
Comment 7 Radar WebKit Bug Importer 2022-07-01 11:16:23 PDT
<rdar://problem/96304168>
Comment 8 Vitaly Dyackhov 2023-05-26 03:01:33 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14386
Comment 9 EWS 2023-06-09 03:56:19 PDT
Committed 265015@main (1ac712cb8d9b): <https://commits.webkit.org/265015@main>

Reviewed commits have been landed. Closing PR #14386 and removing active labels.