Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6c2b5860a380be2f0050fbff29c14dffd30dd365
      
https://github.com/WebKit/WebKit/commit/6c2b5860a380be2f0050fbff29c14dffd30dd365
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-06-15 (Mon, 15 Jun 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-nearest-oversized-element-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-nearest-oversized-element.html
    M Source/WebCore/platform/ScrollableArea.cpp

  Log Message:
  -----------
  scrollIntoView "nearest" aligns to the far edge for an oversized target 
before the scrollport
https://bugs.webkit.org/show_bug.cgi?id=253070
rdar://106356373

Reviewed by Simon Fraser.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Merge: 
https://chromium.googlesource.com/chromium/blink/+/ae8d18613905f501a3ce9ba83193fe77e920afbf

ScrollableArea::getRectToExposeForScrollIntoView() handled only one of the
two cases in which the closest edge is the right/bottom edge. It aligned to
the right/bottom only when the exposeRect was past the right/bottom of the
scrollport and smaller than it. When the exposeRect is larger than the
scrollport and lies before it (to the left of / above the viewport), the
closest edge is still the right/bottom edge, but the alignment fell through
to the default left/top branch. As a result, scrollIntoView({block: "nearest",
inline: "nearest"}) on a target bigger than the scrollport scrolled to the
far edge instead of performing the minimal scroll to the nearest edge,
disagreeing with Chrome and Firefox.

Handle both cases: align to the right/bottom edge when the exposeRect is
either (1) past the scrollport and smaller than it, or (2) before the
scrollport and larger than it.

Test: 
imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-nearest-oversized-element.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-nearest-oversized-element-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-nearest-oversized-element.html:
 Added.
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::getRectToExposeForScrollIntoView const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to