[webkit-changes] [WebKit/WebKit] 7688e6: Repeated calls to scrollIntoView({ block: 'center'...

Simon Fraser noreply at github.com
Thu Nov 2 21:19:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7688e6c7f81ab7985e5de04e5e7a153baf94c0d2
      https://github.com/WebKit/WebKit/commit/7688e6c7f81ab7985e5de04e5e7a153baf94c0d2
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-11-02 (Thu, 02 Nov 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/scrolling/scroll-into-view-block-center-expected.txt
    A LayoutTests/fast/scrolling/scroll-into-view-block-center.html
    M Source/WebCore/platform/ScrollableArea.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp

  Log Message:
  -----------
  Repeated calls to scrollIntoView({ block: 'center' }) can cause jiggling (affects Spotify lyrics)
https://bugs.webkit.org/show_bug.cgi?id=263995
rdar://117755250

Reviewed by Tim Horton.

Computation of the destination scroll position for `scrollIntoView({ block: 'center' })` involves a divide
by 2, which gives a fractional result for some scroller sizes. This causes the computed scroll position to
alternate between two values 1px apart when called repeatedly, since our scroll positions are integral.

Fix by ceiling the target y value in the `ScrollAlignment::Behavior::AlignCenter` case in
`ScrollableArea::getRectToExposeForScrollIntoView()`.

* LayoutTests/TestExpectations:
* LayoutTests/fast/scrolling/scroll-into-view-block-center-expected.txt: Added.
* LayoutTests/fast/scrolling/scroll-into-view-block-center.html: Added.
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::getRectToExposeForScrollIntoView const):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:

Canonical link: https://commits.webkit.org/270160@main




More information about the webkit-changes mailing list