RESOLVED FIXED Bug 90546
Scrollbar width is not applied when element hidden
https://bugs.webkit.org/show_bug.cgi?id=90546
Summary Scrollbar width is not applied when element hidden
Allan Jardine
Reported 2012-07-04 05:35:16 PDT
I have a function which attempts to calculate the width of a scrollbar by putting two elements on to the page, one inside the other and forcing the inner element to a larger height than the outer which is overflow: auto; Then by subtracting the outer width from the inner we get the scrollbar width. This works in nearly all applications, apparent from when -webkit-scrollbar styles are applied to the scrolling element, and the element is visibility: hidden (note that if the element is visible, then it works as expected). Test case with element visible - works as expected: http://sprymedia.co.uk/media/misc/webkit/custom_scroll_visible.html Test case with element hidden - doesn't work: http://sprymedia.co.uk/media/misc/webkit/custom_scroll_hidden.html If -webkit-scrollbar styles are not applied, then it will work regardless of visibility. Tested in WebKit r121825 and shipping Safari 5.1.7 (7534.57.2). Filed in 'New Bugs' as I'm not sure if this is a Javascript or rendering engine issue.
Attachments
Patch (9.95 KB, patch)
2013-09-05 00:18 PDT, gur.trio
no flags
gur.trio
Comment 1 2013-09-05 00:18:53 PDT
gur.trio
Comment 2 2013-09-05 00:24:16 PDT
(In reply to comment #1) > Created an attachment (id=210584) [details] > Patch Incase of custom-scrollbars webkit considers the visibility property and incase its hidden doesnot apply the scollbars properties. Same is not for non-customscrollbars. In either case scrollbar properties are applied. Behaviour should be same for both since even if element visibility:hidden space is set for that element.
gur.trio
Comment 3 2013-09-05 19:54:19 PDT
(In reply to comment #1) > Created an attachment (id=210584) [details] > Patch Hi Darin. Can you please review this patch?
Darin Adler
Comment 4 2013-09-06 12:30:39 PDT
I don’t think I have the expertise to review this. Maybe Beth Dakin, Simon Fraser, or Hyatt?
Simon Fraser (smfr)
Comment 5 2013-09-06 17:17:56 PDT
Comment on attachment 210584 [details] Patch Seems reasonable.
gur.trio
Comment 6 2013-09-08 23:16:10 PDT
(In reply to comment #5) > (From update of attachment 210584 [details]) > Seems reasonable. Thanks for the review Simon. Anything else needs to be done?
WebKit Commit Bot
Comment 7 2013-09-08 23:53:03 PDT
Comment on attachment 210584 [details] Patch Clearing flags on attachment: 210584 Committed r155323: <http://trac.webkit.org/changeset/155323>
WebKit Commit Bot
Comment 8 2013-09-08 23:53:06 PDT
All reviewed patches have been landed. Closing bug.
gur.trio
Comment 9 2013-10-15 04:30:47 PDT
*** Bug 66306 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.