Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 51677708a84b70ea867ffe8810705f094414620e
      
https://github.com/WebKit/WebKit/commit/51677708a84b70ea867ffe8810705f094414620e
  Author: Wenson Hsieh <[email protected]>
  Date:   2023-04-14 (Fri, 14 Apr 2023)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h
    M Source/WebCore/platform/RuntimeApplicationChecks.h
    M Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
    M Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h

  Log Message:
  -----------
  REGRESSION (259904@main): Gmail App stutters / jitters when scrolling down in 
compose view
https://bugs.webkit.org/show_bug.cgi?id=255431
rdar://106644805

Reviewed by Ryosuke Niwa.

In the iOS Gmail app when Live Range Selection is enabled by default, the web 
view used for compose
gets into a state where it constantly modifies the selection without any visual 
change. This is
because the page installs a `selectionchange` event listener on the document 
element; when fired,
this event listener creates a new `span` element whose text is a single 
zero-width joiner character,
and then inserts this node into the selection range via 
`getSelection().getRangeAt(0).insertNode()`.

When live range selection is enabled, this causes each `selectionchange` event 
to mutate the
selection, queueing a subsequent `selectionchange` event in the process. Since 
the event is
scheduled, this doesn't end up being an infinite loop; however, it does lead to 
various issues, such
as the fact that attempts to scroll the selection off-screen cause the scroll 
position to stutter as
we scroll to reveal the selection range that is being set every frame.

Fix this by adding a linked-on-or-after check for live range selection. For 
now, we additionally
limit this to Gmail (currently the only known third-party app to encounter this 
bincompat issue),
in hopes that we'll be able to remove legacy (non-live-range) code sooner, once 
the Gmail app adapts
to live ranges.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h:
* Source/WebCore/platform/RuntimeApplicationChecks.h:
* Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isGmail):

Add a new method to check for the Gmail app, so that we can disable Live Range 
Selection for only
Gmail (until they adjust their injected script to be compatible with our new 
behavior).

* Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultLiveRangeSelectionEnabled):
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to