Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
29 changed files
with
212 additions
and
143 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2023 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#import <WebCore/ColorCocoa.h> | ||
#import <wtf/Forward.h> | ||
|
||
namespace WebCoreTestSupport { | ||
|
||
String serializationForCSS(WebCore::CocoaColor *) WTF_EXPORT_PRIVATE; | ||
|
||
} // namespace WebCoreTestSupport |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2023 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#import "config.h" | ||
#import "CocoaColorSerialization.h" | ||
|
||
#import <WebCore/ColorSerialization.h> | ||
#import <wtf/text/WTFString.h> | ||
|
||
namespace WebCoreTestSupport { | ||
|
||
String serializationForCSS(WebCore::CocoaColor *color) | ||
{ | ||
return WebCore::serializationForCSS(WebCore::colorFromCocoaColor(color)); | ||
} | ||
|
||
} // namespace WebCoreTestSupport |
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
Oops, something went wrong.