Skip to content

Commit

Permalink
6 editing/caret/ios tests consistently fail on some recent simulator …
Browse files Browse the repository at this point in the history
…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
whsieh committed Apr 27, 2023
1 parent 4c8196f commit 6723dcf
Show file tree
Hide file tree
Showing 29 changed files with 212 additions and 143 deletions.
Expand Up @@ -38,15 +38,15 @@
}

UIHelper.activateAndWaitForInputSessionAt(innerWidth / 2, 30)
.then(() => UIHelper.getUICaretRect())
.then(() => UIHelper.getUICaretViewRect())
.then((rect) => {
initialCaretRect = rect;
shouldBe("initialCaretRect.left", "6");
shouldBe("initialCaretRect.top", "21");
shouldBe("initialCaretRect.width", "3");
shouldBe("initialCaretRect.height", "15");
document.scrollingElement.scrollTop += 5000;
return UIHelper.getUICaretRect();
return UIHelper.getUICaretViewRect();
})
.then((rect) => {
finalCaretRect = rect;
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/editing/caret/ios/caret-in-overflow-area.html
Expand Up @@ -34,7 +34,7 @@
await UIHelper.activateAndWaitForInputSessionAt(25, 25);

await UIHelper.tapAt(25, 400);
const caretRect = await UIHelper.getUICaretRect();
const caretRect = await UIHelper.getUICaretViewRect();

document.querySelector("#caret-rect").textContent = rectToString(caretRect);

Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/editing/caret/ios/emoji.html
Expand Up @@ -32,7 +32,7 @@
function pressArrow() {
uiController.typeCharacterUsingHardwareKeyboard("leftArrow", function() {
uiController.doAfterNextStablePresentationUpdate(function() {
var selectionRectLeft = uiController.textSelectionCaretRect.left;
var selectionRectLeft = uiController.selectionCaretViewRect.left;
var caretPositionsLength = caretPositions.length;
if (caretPositionsLength == 0 || caretPositions[caretPositionsLength - 1] != selectionRectLeft) {
caretPositions.push(selectionRectLeft);
Expand Down
Expand Up @@ -38,15 +38,15 @@
}

UIHelper.activateAndWaitForInputSessionAt(innerWidth / 2, 30)
.then(() => UIHelper.getUICaretRect())
.then(() => UIHelper.getUICaretViewRect())
.then((rect) => {
initialCaretRect = rect;
shouldBe("initialCaretRect.left", "6");
shouldBe("initialCaretRect.top", "21");
shouldBe("initialCaretRect.width", "3");
shouldBe("initialCaretRect.height", "15");
document.scrollingElement.scrollTop += 5000;
return UIHelper.getUICaretRect();
return UIHelper.getUICaretViewRect();
})
.then((rect) => {
finalCaretRect = rect;
Expand Down
8 changes: 4 additions & 4 deletions LayoutTests/editing/selection/character-granularity-rect.html
Expand Up @@ -22,7 +22,7 @@
return `
(function() {
uiController.longPressAtPoint(30, 20, function() {
uiController.uiScriptComplete(JSON.stringify(uiController.textSelectionRangeRects));
uiController.uiScriptComplete(JSON.stringify(uiController.selectionRangeViewRects));
});
})();`
}
Expand All @@ -35,12 +35,12 @@
var target = document.getElementById('target');
if (testRunner.runUIScript) {
testRunner.runUIScript(getUIScript(), function(result) {
var textSelectionRangeRects = JSON.parse(result);
var selectionRangeViewRects = JSON.parse(result);
var output;
if (textSelectionRangeRects.length !== 1)
if (selectionRangeViewRects.length !== 1)
output = 'FAIL: Unexpected number of selection range views: ' + result;
else {
var rect = textSelectionRangeRects[0];
var rect = selectionRangeViewRects[0];
if (rect.left != 8 || rect.top != 8 || rect.width != 112 || rect.height != 17 )
output = 'FAIL: Unexpected selection range view frame: ' + result;
else
Expand Down
Expand Up @@ -46,7 +46,7 @@
}

selectTextAt(50, 50)
.then(() => UIHelper.getUISelectionRects())
.then(() => UIHelper.getUISelectionViewRects())
.then((rects) => {
initialSelectionRects = rects;
shouldBe("initialSelectionRects.length", "1");
Expand All @@ -55,7 +55,7 @@
shouldBe("initialSelectionRects[0].width", "309");
shouldBe("initialSelectionRects[0].height", "112");
document.scrollingElement.scrollTop += 5000;
return UIHelper.getUISelectionRects();
return UIHelper.getUISelectionViewRects();
})
.then((rects) => {
finalSelectionRects = rects;
Expand Down
Expand Up @@ -46,7 +46,7 @@
}

selectTextAt(50, 50)
.then(() => UIHelper.getUISelectionRects())
.then(() => UIHelper.getUISelectionViewRects())
.then((rects) => {
initialSelectionRects = rects;
shouldBe("initialSelectionRects.length", "1");
Expand All @@ -55,7 +55,7 @@
shouldBe("initialSelectionRects[0].width", "309");
shouldBe("initialSelectionRects[0].height", "112");
document.scrollingElement.scrollTop += 5000;
return UIHelper.getUISelectionRects();
return UIHelper.getUISelectionViewRects();
})
.then((rects) => {
finalSelectionRects = rects;
Expand Down
Expand Up @@ -35,7 +35,7 @@
await UIHelper.callFunctionAndWaitForEvent(() => UIHelper.doubleTapElement(target), document, "selectionchange");
await UIHelper.ensurePresentationUpdate();
let rectsString = "";
for (let rect of await UIHelper.getUISelectionRects())
for (let rect of await UIHelper.getUISelectionViewRects())
rectsString += rectToString(rect) + ' ';

document.querySelector("#selection-rects").textContent = rectsString;
Expand Down
Expand Up @@ -48,7 +48,7 @@
var grabberMidpoint = UIHelper.midPointOfRect(await UIHelper.getSelectionEndGrabberViewRect());
await touchAndDragFromPointToPoint(grabberMidpoint.x, grabberMidpoint.y , grabberMidpoint.x, grabberMidpoint.y - (fontHeight * 2));

if ((await UIHelper.getUISelectionRects()).length > 2)
if ((await UIHelper.getUISelectionViewRects()).length > 2)
output += 'FAIL: Selected outside of visible area.';
else
output += 'PASS: Selection properly bounded';
Expand Down
Expand Up @@ -25,7 +25,7 @@
observedTouchEnd = false;

document.addEventListener("touchend", async () => {
selectionRects = await UIHelper.getUISelectionRects();
selectionRects = await UIHelper.getUISelectionViewRects();
shouldBe("selectionRects.length", "1");
shouldBe("Math.round(selectionRects[0].left)", "0");
shouldBe("Math.round(selectionRects[0].top)", "3");
Expand Down
Expand Up @@ -23,7 +23,7 @@
{
return new Promise((resolved) => {
async function handleFocus() {
let caretRect = await UIHelper.getUICaretRect();
let caretRect = await UIHelper.getUICaretViewRect();
await UIHelper.deactivateFormControl(element);
resolved(caretRect);
}
Expand Down
Expand Up @@ -44,7 +44,7 @@
{
return `(function() {
uiController.doAfterNextStablePresentationUpdate(function() {
uiController.uiScriptComplete(JSON.stringify(uiController.textSelectionCaretRect));
uiController.uiScriptComplete(JSON.stringify(uiController.selectionCaretViewRect));
});
uiController.keyboardAccessoryBarNext();
})();`;
Expand All @@ -53,7 +53,7 @@
function getCaretRectScript()
{
return `(function() {
return JSON.stringify(uiController.textSelectionCaretRect);
return JSON.stringify(uiController.selectionCaretViewRect);
})();`;
}

Expand Down
32 changes: 0 additions & 32 deletions LayoutTests/resources/ui-helper.js
Expand Up @@ -837,38 +837,6 @@ window.UIHelper = class UIHelper {
});
}

static getUICaretRect()
{
if (!this.isWebKit2() || !this.isIOSFamily())
return Promise.resolve();

return new Promise(resolve => {
testRunner.runUIScript(`(function() {
uiController.doAfterNextStablePresentationUpdate(function() {
uiController.uiScriptComplete(JSON.stringify(uiController.textSelectionCaretRect));
});
})()`, jsonString => {
resolve(JSON.parse(jsonString));
});
});
}

static getUISelectionRects()
{
if (!this.isWebKit2() || !this.isIOSFamily())
return Promise.resolve();

return new Promise(resolve => {
testRunner.runUIScript(`(function() {
uiController.doAfterNextStablePresentationUpdate(function() {
uiController.uiScriptComplete(JSON.stringify(uiController.textSelectionRangeRects));
});
})()`, jsonString => {
resolve(JSON.parse(jsonString));
});
});
}

static scrollbarState(scroller, isVertical)
{
var internalFunctions = scroller ? scroller.ownerDocument.defaultView.internals : internals;
Expand Down
8 changes: 8 additions & 0 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Expand Up @@ -5882,6 +5882,8 @@
F440E77B233D94D70063F9AB /* ClipboardItem.h in Headers */ = {isa = PBXBuildFile; fileRef = F440E770233D94D40063F9AB /* ClipboardItem.h */; };
F440E77D233D94D70063F9AB /* Clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F440E772233D94D50063F9AB /* Clipboard.h */; };
F442C35923E3ADD200499582 /* CompositionHighlight.h in Headers */ = {isa = PBXBuildFile; fileRef = F442C35723E3AC5100499582 /* CompositionHighlight.h */; settings = {ATTRIBUTES = (Private, ); }; };
F44423D529FAC55000124DB5 /* CocoaColorSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = F44423D229FAC3C800124DB5 /* CocoaColorSerialization.h */; settings = {ATTRIBUTES = (Private, ); }; };
F44423D929FACF3B00124DB5 /* CocoaColorSerialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44423D329FAC3C800124DB5 /* CocoaColorSerialization.mm */; };
F446EDDF265DAFE30031DA8F /* DataDetectionResultsStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = F446EDDD265DAE3F0031DA8F /* DataDetectionResultsStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
F446EDE1265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = F446EDE0265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
F446EDE8265DD8900031DA8F /* DataDetectorElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F446EDE7265DD8900031DA8F /* DataDetectorElementInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -19068,6 +19070,8 @@
F440E777233D94D70063F9AB /* ClipboardItem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ClipboardItem.idl; sourceTree = "<group>"; };
F442850B2140412500CCDA22 /* FontAttributeChanges.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FontAttributeChanges.cpp; sourceTree = "<group>"; };
F442C35723E3AC5100499582 /* CompositionHighlight.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CompositionHighlight.h; sourceTree = "<group>"; };
F44423D229FAC3C800124DB5 /* CocoaColorSerialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CocoaColorSerialization.h; sourceTree = "<group>"; };
F44423D329FAC3C800124DB5 /* CocoaColorSerialization.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CocoaColorSerialization.mm; sourceTree = "<group>"; };
F446EDDD265DAE3F0031DA8F /* DataDetectionResultsStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataDetectionResultsStorage.h; sourceTree = "<group>"; };
F446EDE0265DB1E50031DA8F /* ImageOverlayDataDetectionResultIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageOverlayDataDetectionResultIdentifier.h; sourceTree = "<group>"; };
F446EDE7265DD8900031DA8F /* DataDetectorElementInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataDetectorElementInfo.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -28592,6 +28596,8 @@
A1763F3B1E2051AB001D58DE /* cocoa */ = {
isa = PBXGroup;
children = (
F44423D229FAC3C800124DB5 /* CocoaColorSerialization.h */,
F44423D329FAC3C800124DB5 /* CocoaColorSerialization.mm */,
A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */,
A1763F3C1E205234001D58DE /* WebArchiveDumpSupport.mm */,
2D7DA0EF2435EB1700F048D1 /* WebViewVisualIdentificationOverlay.h */,
Expand Down Expand Up @@ -35719,6 +35725,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F44423D529FAC55000124DB5 /* CocoaColorSerialization.h in Headers */,
51714EAD1CF65951004723C4 /* GCObservation.h in Headers */,
417DA6DA13734E6E007C57FB /* Internals.h in Headers */,
A7BF7EE014C9175A0014489D /* InternalSettings.h in Headers */,
Expand Down Expand Up @@ -41350,6 +41357,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F44423D929FACF3B00124DB5 /* CocoaColorSerialization.mm in Sources */,
51714EAC1CF65951004723C4 /* GCObservation.cpp in Sources */,
417DA6D913734E6E007C57FB /* Internals.cpp in Sources */,
E179F0DA1B9774FE00ED0A27 /* Internals.mm in Sources */,
Expand Down
35 changes: 35 additions & 0 deletions Source/WebCore/testing/cocoa/CocoaColorSerialization.h
@@ -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
39 changes: 39 additions & 0 deletions Source/WebCore/testing/cocoa/CocoaColorSerialization.mm
@@ -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
6 changes: 2 additions & 4 deletions Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
Expand Up @@ -3475,10 +3475,8 @@ - (BOOL)_contentViewIsFirstResponder

- (CGRect)_uiTextCaretRect
{
// Force the selection view to update if needed.
[_contentView _updateChangedSelection];

return [[_contentView valueForKeyPath:@"interactionAssistant.selectionView.selection.caretRect"] CGRectValue];
// Only here to maintain binary compatibility.
return CGRectZero;
}

- (UIView *)_safeBrowsingWarning
Expand Down
Expand Up @@ -41,7 +41,6 @@
@property (nonatomic, readonly) NSString *textContentTypeForTesting;
@property (nonatomic, readonly) NSString *selectFormPopoverTitle;
@property (nonatomic, readonly) NSString *formInputLabel;
@property (nonatomic, readonly) NSArray<NSValue *> *_uiTextSelectionRects;
@property (nonatomic, readonly) CGRect _inputViewBoundsInWindow;
@property (nonatomic, readonly) NSString *_uiViewTreeAsText;
@property (nonatomic, readonly) NSNumber *_stableStateOverride;
Expand Down Expand Up @@ -87,8 +86,6 @@

- (void)_setDeviceHasAGXCompilerServiceForTesting;

- (NSString *)_serializedSelectionCaretBackgroundColorForTesting;

- (BOOL)_hasResizeAssertion;
- (void)_simulateSelectionStart;

Expand Down
17 changes: 0 additions & 17 deletions Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
Expand Up @@ -217,14 +217,6 @@ - (CGRect)_inputViewBoundsInWindow
return _inputViewBoundsInWindow;
}

- (NSArray<NSValue *> *)_uiTextSelectionRects
{
// Force the selection view to update if needed.
[_contentView _updateChangedSelection];

return [_contentView _uiTextSelectionRects];
}

static String allowListedClassToString(UIView *view)
{
static constexpr ComparableASCIILiteral allowedClassesArray[] = {
Expand Down Expand Up @@ -465,15 +457,6 @@ - (void)_setDeviceHasAGXCompilerServiceForTesting
_page->setDeviceHasAGXCompilerServiceForTesting();
}

- (NSString *)_serializedSelectionCaretBackgroundColorForTesting
{
UIColor *backgroundColor = [[_contentView textInteractionAssistant].selectionView valueForKeyPath:@"caretView.backgroundColor"];
if (!backgroundColor)
return nil;

return serializationForCSS(WebCore::colorFromCocoaColor(backgroundColor));
}

- (BOOL)_hasResizeAssertion
{
#if HAVE(UIKIT_RESIZABLE_WINDOWS)
Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Expand Up @@ -690,7 +690,6 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
#if ENABLE(DATA_DETECTION)
- (NSArray *)_dataDetectionResults;
#endif
- (NSArray<NSValue *> *)_uiTextSelectionRects;
- (void)accessibilityRetrieveSpeakSelectionContent;
- (void)_accessibilityRetrieveRectsEnclosingSelectionOffset:(NSInteger)offset withGranularity:(UITextGranularity)granularity;
- (void)_accessibilityRetrieveRectsAtSelectionOffset:(NSInteger)offset withText:(NSString *)text completionHandler:(void (^)(const Vector<WebCore::SelectionGeometry>& rects))completionHandler;
Expand Down

0 comments on commit 6723dcf

Please sign in to comment.