Bug 224409

Summary: initial horizontal scrollbar positions for RTL elements is wrong
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: Layout and RenderingAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, darin, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 224224    
Attachments:
Description Flags
Patch none

Description Cameron McCormack (:heycam) 2021-04-10 18:38:51 PDT
Scrollable elements that place their vertical scrollbar on the left (e.g. when they're `direction: rtl` or when the OS language is RTL and the relevant setting to always follow OS scrollbar side is used) have an incorrect scroll origin, which leads to creating a horizontal scrollbar with an incorrect initial offset.  This is because RenderLayerScrollableArea::computeScrollDimensions runs prior to the scrollbars being created.
Comment 1 Cameron McCormack (:heycam) 2021-04-10 18:57:04 PDT
Created attachment 425693 [details]
Patch
Comment 2 Darin Adler 2021-04-11 08:53:47 PDT
Comment on attachment 425693 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=425693&action=review

> Source/WebCore/rendering/RenderLayerScrollableArea.cpp:1032
> +        m_hBar->offsetDidChange();

This is unconditionally called, even if the code above sets the origin to the same value it’s already set to. Should there be a check?
Comment 3 Cameron McCormack (:heycam) 2021-04-11 14:50:28 PDT
(In reply to Darin Adler from comment #2)
> This is unconditionally called, even if the code above sets the origin to
> the same value it’s already set to. Should there be a check?

offsetDidChange() will do an almost equivalent check, when it recomputes its m_position based on the scroll offset, and avoid actually updating the thumb position.  So I figured it's not necessary.
Comment 4 EWS 2021-04-11 15:53:57 PDT
Committed r275811 (236382@main): <https://commits.webkit.org/236382@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 425693 [details].
Comment 5 Radar WebKit Bug Importer 2021-04-11 15:54:25 PDT
<rdar://problem/76516885>