Bug 90546 - Scrollbar width is not applied when element hidden
Summary: Scrollbar width is not applied when element hidden
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: gur.trio
URL:
Keywords:
: 66306 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-04 05:35 PDT by Allan Jardine
Modified: 2013-10-15 04:30 PDT (History)
11 users (show)

See Also:


Attachments
Patch (9.95 KB, patch)
2013-09-05 00:18 PDT, gur.trio
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Jardine 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.
Comment 1 gur.trio 2013-09-05 00:18:53 PDT
Created attachment 210584 [details]
Patch
Comment 2 gur.trio 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.
Comment 3 gur.trio 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?
Comment 4 Darin Adler 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?
Comment 5 Simon Fraser (smfr) 2013-09-06 17:17:56 PDT
Comment on attachment 210584 [details]
Patch

Seems reasonable.
Comment 6 gur.trio 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?
Comment 7 WebKit Commit Bot 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>
Comment 8 WebKit Commit Bot 2013-09-08 23:53:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 gur.trio 2013-10-15 04:30:47 PDT
*** Bug 66306 has been marked as a duplicate of this bug. ***