Title: [234614] trunk/Tools
- Revision
- 234614
- Author
- wenson_hs...@apple.com
- Date
- 2018-08-06 12:31:06 -0700 (Mon, 06 Aug 2018)
Log Message
[iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
https://bugs.webkit.org/show_bug.cgi?id=188322
<rdar://problem/42455270>
Reviewed by Tim Horton.
Fixes an API test added in r234600, which had incorrect test expectations — namely, the width of the caret rect
was not in content view coordinates, unlike the x, y, and height.
* TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
(rounded):
(-[TestWKWebView waitForCaretViewFrameToBecome:]):
(-[TestWKWebView waitForSelectionViewRectsToBecome:]):
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (234613 => 234614)
--- trunk/Tools/ChangeLog 2018-08-06 18:46:59 UTC (rev 234613)
+++ trunk/Tools/ChangeLog 2018-08-06 19:31:06 UTC (rev 234614)
@@ -1,3 +1,20 @@
+2018-08-06 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
+ https://bugs.webkit.org/show_bug.cgi?id=188322
+ <rdar://problem/42455270>
+
+ Reviewed by Tim Horton.
+
+ Fixes an API test added in r234600, which had incorrect test expectations — namely, the width of the caret rect
+ was not in content view coordinates, unlike the x, y, and height.
+
+ * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
+ (rounded):
+ (-[TestWKWebView waitForCaretViewFrameToBecome:]):
+ (-[TestWKWebView waitForSelectionViewRectsToBecome:]):
+ (TestWebKitAPI::TEST):
+
2018-08-06 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r234569.
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (234613 => 234614)
--- trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm 2018-08-06 18:46:59 UTC (rev 234613)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm 2018-08-06 19:31:06 UTC (rev 234614)
@@ -36,6 +36,11 @@
@implementation TestWKWebView (KeyboardInputTests)
+static CGRect rounded(CGRect rect)
+{
+ return CGRectMake(roundl(rect.origin.x), roundl(rect.origin.y), roundl(rect.size.width), roundl(rect.size.height));
+}
+
- (void)waitForCaretViewFrameToBecome:(CGRect)frame
{
BOOL hasEmittedWarning = NO;
@@ -42,7 +47,7 @@
NSTimeInterval secondsToWaitUntilWarning = 2;
NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
while ([[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]) {
- CGRect currentFrame = self.caretViewRectInContentCoordinates;
+ CGRect currentFrame = rounded(self.caretViewRectInContentCoordinates);
if (CGRectEqualToRect(currentFrame, frame))
break;
@@ -64,7 +69,7 @@
BOOL selectionRectsMatch = YES;
if (currentRects.count == selectionRects.count) {
for (NSUInteger index = 0; index < selectionRects.count; ++index)
- selectionRectsMatch |= [selectionRects[index] isEqualToValue:currentRects[index]];
+ selectionRectsMatch |= CGRectEqualToRect(selectionRects[index].CGRectValue, rounded(currentRects[index].CGRectValue));
} else
selectionRectsMatch = NO;
@@ -124,7 +129,7 @@
TEST(KeyboardInputTests, CaretSelectionRectAfterRestoringFirstResponder)
{
- auto expectedCaretRect = CGRectMake(16, 13, 3, 15);
+ auto expectedCaretRect = CGRectMake(16, 13, 2, 15);
auto webView = webViewWithAutofocusedInput();
EXPECT_WK_STREQ("INPUT", [webView stringByEvaluatingJavaScript:@"document.activeElement.tagName"]);
[webView waitForCaretViewFrameToBecome:expectedCaretRect];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes