Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2259680a44dc4a4802dab481a995ffa4d43ca0ff
      
https://github.com/WebKit/WebKit/commit/2259680a44dc4a4802dab481a995ffa4d43ca0ff
  Author: Simon Fraser <[email protected]>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebCore/page/QuirksData.h
    M Source/WebCore/page/scrolling/ScrollAnchoringController.cpp

  Log Message:
  -----------
  [iOS] Quirk Scroll Anchoring off on reddit when the Sink It extension is 
installed
https://bugs.webkit.org/show_bug.cgi?id=316570
rdar://176377447

Reviewed by Abrar Rahman Protyasha.

The Sink It extension for reddit.com detects a change in scroll direction and 
toggles
the display of `<reddit-header-small>`, which triggers a shadow DOM rebuild. 
This
causes the subsequent `updateBeforeLayout` to see a tree of mostly 
never-laid-out
renders, so it never selects an anchor target, and instead anchors to the
`<shreddit-app>` which is an ancestor of where the mutation occurred, resulting 
in no
anchoring. However, alternate layouts do see a fully laid out tree and anchor, 
so the
anchoring is asymmetric, causing jumps in scroll position. A simple test case 
shows bad
behavior in all browsers, so this is not something inherently wrong with the 
scroll
anchoring logic.

We thus fix by quirking scroll anchoring off for reddit.com when the Sink It 
extension
is installed (by detecting the injected `sink-it-back-to-top` element).

The quick is checked in `ScrollAnchoringController::updateBeforeLayout()`, 
which invalidates
if anchoring is disabled. This will clear `m_anchorObject` and prevent 
adjustments.
`shouldMaintainScrollAnchor()` doesn't work as a place to call the quirk, 
because it's
only accurate for overflow scrollers.

* Source/WebCore/page/Quirks.cpp:
* Source/WebCore/page/Quirks.h:
* Source/WebCore/page/QuirksData.h:
* Source/WebCore/page/scrolling/ScrollAnchoringController.cpp:
(WebCore::ScrollAnchoringController::updateBeforeLayout):

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



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

Reply via email to