Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 952deaf8f19d5f78cafe8218cdb965bf88a912f8
      
https://github.com/WebKit/WebKit/commit/952deaf8f19d5f78cafe8218cdb965bf88a912f8
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-09-27 (Fri, 27 Sep 2024)

  Changed paths:
    A 
LayoutTests/editing/selection/ios/selection-clip-rect-in-overflow-scroller-expected.txt
    A 
LayoutTests/editing/selection/ios/selection-clip-rect-in-overflow-scroller.html
    M LayoutTests/editing/selection/ios/selection-handle-clamping-in-iframe.html
    M Source/WebCore/dom/Position.h
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm

  Log Message:
  -----------
  [iOS] Selection UI should be clipped in overflow scrolling containers
https://bugs.webkit.org/show_bug.cgi?id=280440
rdar://9906345

Reviewed by Aditya Keerthi.

Currently, we plumb `selectionClipRect` to the UI process only in the case 
where the selection is
inside of an editable root or form control. This means we fail to clip UIKit's 
native selection UI
in cases where the selection is non-editable, but inside of a subscrollable 
region. To fix this, we
compute and send the `selectionClipRect` over to the UI process through 
`EditorState`'s visual data
struct in the case where the selection is both:

1. User-visible (i.e. not a collapsed selection caret in non-editable content)
2. Inside of a scrollable area.

See below for more details.

* 
LayoutTests/editing/selection/ios/selection-clip-rect-in-overflow-scroller-expected.txt:
 Added.
* 
LayoutTests/editing/selection/ios/selection-clip-rect-in-overflow-scroller.html:
 Added.

Add a layout test to verify that the selection highlight disappears when 
scrolling the selection
range outside of an overflow sroller's clip rect.

* LayoutTests/editing/selection/ios/selection-handle-clamping-in-iframe.html:

Adjust an existing test to work around an existing issue where the selection 
briefly collapses to
the first visible character in the subframe when moving selection handles 
upwards. Using the event
stream builder to synthesize the pan gesture sends higher resolution events 
that better simulates
real user interaction.

* Source/WebCore/dom/Position.h:
* Source/WebCore/rendering/RenderObject.h:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPlatformEditorStateCommon const):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::enclosingScroller):

Walk up the render tree in search of an enclosing renderer that 
`canBeScrolledAndHasScrollableArea`,
starting from the selection's common ancestor node.

(WebKit::WebPage::computeSelectionClipRect const):
* Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(isZoomingOrScrolling):
(-[TestRunnerWKWebView isZoomingOrScrolling]):

Adjust this test harness method to also return `YES` in the case where any 
child scroller underneath
the web view is being scrolled.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to