Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
REGRESSION (iOS 16): System controls overlap website controls (affect…
…s SquareSpace, medium.com, and others) https://bugs.webkit.org/show_bug.cgi?id=241837 rdar://95658478 Reviewed by Aditya Keerthi. On iOS 16, the callout bar (which is now built on top of `UIEditMenuInteraction`) no longer respects evasion rects, passed in through the `UIWKInteractionViewProtocol` delegate method `-requestRectsToEvadeForSelectionCommandsWithCompletionHandler:`. This was previously used to avoid overlapping interactable controls on the page when presenting the callout bar, which the layout test `editing/selection/ios/avoid-showing-callout-menu-over-controls.html` exercises. To fix this, we're adding a replacement SPI in UIKit, allowing WebKit to vend a preferred `UIEditMenuArrowDirection` which will be consulted when presenting the edit menu interaction in order to show the callout bar. For more details, see: rdar://95652872. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView requestPreferredArrowDirectionForEditMenuWithCompletionHandler:]): In the case where there are clickable controls above the selection, use `UIEditMenuArrowDirectionUp` to make the callout bar present _below_ the selection instead of above; otherwise, simply go with the default behavior, which puts the callout bar above the selection. (-[WKContentView requestRectsToEvadeForSelectionCommandsWithCompletionHandler:]): Pull out common logic for requesting a list of rects to evade into a separate internal helper method, and use this common helper method to implement both the legacy delegate method (which no longer works on iOS 16), as well as the new delegate method in iOS 16. For now, I opted to still implement both methods, such that this test will pass on both iOS 15 and iOS 16 (but only with the changes in rdar://95652872). (-[WKContentView _requestEvasionRectsAboveSelectionIfNeeded:]): * Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm: Also, adopt the new SPI in an API test that simulates callout bar appearance on iOS 16. (TestWebKitAPI::simulateCalloutBarAppearance): * Tools/TestWebKitAPI/cocoa/TestWKWebView.h: * Tools/TestWebKitAPI/ios/UIKitSPI.h: * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::internalClassNamed): (WTR::UIScriptControllerIOS::menuRect const): (WTR::UIScriptControllerIOS::contextMenuRect const): Additionally tweak a couple of script controller hooks, to work with the new `UIEditMenuInteraction` -based callout bars on iOS 16. Canonical link: https://commits.webkit.org/251756@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
51 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters