[webkit-changes] [WebKit/WebKit] 6723dc: 6 editing/caret/ios tests consistently fail on som...
Wenson Hsieh
noreply at github.com
Thu Apr 27 10:13:08 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6723dcfd85e9413043566d211736078ffb289878
https://github.com/WebKit/WebKit/commit/6723dcfd85e9413043566d211736078ffb289878
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-04-27 (Thu, 27 Apr 2023)
Changed paths:
M LayoutTests/editing/caret/ios/absolute-caret-position-after-scroll.html
M LayoutTests/editing/caret/ios/caret-in-overflow-area.html
M LayoutTests/editing/caret/ios/emoji.html
M LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll.html
M LayoutTests/editing/selection/character-granularity-rect.html
M LayoutTests/editing/selection/ios/absolute-selection-after-scroll.html
M LayoutTests/editing/selection/ios/fixed-selection-after-scroll.html
M LayoutTests/editing/selection/ios/selection-extends-into-overflow-area.html
M LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-overflow.html
M LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end.html
M LayoutTests/fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
M LayoutTests/fast/visual-viewport/ios/caret-after-focus-in-fixed.html
M LayoutTests/resources/ui-helper.js
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/testing/cocoa/CocoaColorSerialization.h
A Source/WebCore/testing/cocoa/CocoaColorSerialization.mm
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
M Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm
M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
M Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
M Tools/WebKitTestRunner/ios/TestControllerIOS.mm
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Log Message:
-----------
6 editing/caret/ios tests consistently fail on some recent simulator versions
https://bugs.webkit.org/show_bug.cgi?id=256018
rdar://108559805
Reviewed by Aditya Keerthi.
Use `UITextSelectionDisplayInteraction` to identify ranged selection views, caret views, and
selection handles when appropriate. See changes below for more details.
* LayoutTests/editing/caret/ios/absolute-caret-position-after-scroll.html:
* LayoutTests/editing/caret/ios/caret-in-overflow-area.html:
* LayoutTests/editing/caret/ios/emoji.html:
* LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll.html:
* LayoutTests/editing/selection/character-granularity-rect.html:
* LayoutTests/editing/selection/ios/absolute-selection-after-scroll.html:
* LayoutTests/editing/selection/ios/fixed-selection-after-scroll.html:
* LayoutTests/editing/selection/ios/selection-extends-into-overflow-area.html:
* LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-overflow.html:
* LayoutTests/fast/events/touch/ios/selection-handles-after-touch-end.html:
Refactor these existing tests, so that they use `selectionCaretViewRect` rather than
`textSelectionCaretRect` and `selectionRangeViewRects` instead of `textSelectionRangeRects`. There's
no reason to keep both versions of these testing hooks working, so I'm making these tests all use
the versions that check the platform `UIView` geometry directly, which better reflects what the
user sees.
* LayoutTests/fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html:
* LayoutTests/fast/visual-viewport/ios/caret-after-focus-in-fixed.html:
* LayoutTests/resources/ui-helper.js:
(window.UIHelper.getUICaretRect.return.new.Promise.): Deleted.
(window.UIHelper.getUICaretRect.return.new.Promise): Deleted.
(window.UIHelper.getUICaretRect): Deleted.
(window.UIHelper.getUISelectionRects.return.new.Promise.): Deleted.
(window.UIHelper.getUISelectionRects.return.new.Promise): Deleted.
(window.UIHelper.getUISelectionRects): Deleted.
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _uiTextCaretRect]):
The changes above also allow us to remove this SPI hook (though, I'm still leaving behind a method
stub for now, for binary compatibility).
* Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _uiTextSelectionRects]): Deleted.
(-[WKWebView _serializedSelectionCaretBackgroundColorForTesting]): Deleted.
Remove these testing hooks altogether, since they're defined only in the testing header. The former
is no longer necessary since we now only use `selectionRangeViewRects` in the test runner, and the
latter has been moved into `UIScriptController`, out of engine code.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _uiTextSelectionRects]): Deleted.
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
Apply a similar treatment to several API tests that run into the same issue.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/testing/cocoa/CocoaColorSerialization.h: Added.
* Source/WebCore/testing/cocoa/CocoaColorSerialization.mm: Added.
(WebCoreTestSupport::serializationForCSS):
Add a testing hook to convert platform Cocoa colors (`NSColor`, `UIColor`) to a serialized string
for CSS. We use this in `UIScriptControllerIOS` below.
(TEST):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView caretViewRectInContentCoordinates]):
(-[TestWKWebView selectionViewRectsInContentCoordinates]):
(-[TestWKWebView textSelectionDisplayInteraction]):
(-[TestWKWebView selectionRectsAfterPresentationUpdate]): Deleted.
* Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::windowSnapshotImage):
* Tools/WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::notifyDone):
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::selectionStartGrabberViewRect const):
(WTR::UIScriptControllerIOS::selectionEndGrabberViewRect const):
Search for `_UITextSelectionLollipopView` in the view hierarchy, for now. `-handleViews` seems to
return an empty array, so we can't adopt it quite yet.
(WTR::UIScriptControllerIOS::selectionCaretViewRect const):
(WTR::UIScriptControllerIOS::selectionRangeViewRects const):
In the case where `selectionView` is nil but `HAVE(UI_TEXT_SELECTION_DISPLAY_INTERACTION)` is set,
fall back to asking for `-cursorView` and `-highlightView`, respectively. Note that the `-hidden`
check is necessary, since the view bounds remain at their last set value even when the selection is
deactivated; instead, the caret, selection highlights and selection handles are simply hidden when
not active.
(WTR::UIScriptControllerIOS::selectionCaretBackgroundColor const):
(WTR::UIScriptControllerIOS::textSelectionDisplayInteraction const):
(WTR::UIScriptControllerIOS::textSelectionRangeRects const): Deleted.
(WTR::UIScriptControllerIOS::textSelectionCaretRect const): Deleted.
Canonical link: https://commits.webkit.org/263460@main
More information about the webkit-changes
mailing list