Changeset 234614 in webkit


Ignore:
Timestamp:
Aug 6, 2018 12:31:06 PM (6 years ago)
Author:
Wenson Hsieh
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r234613 r234614  
     12018-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained
     4        https://bugs.webkit.org/show_bug.cgi?id=188322
     5        <rdar://problem/42455270>
     6
     7        Reviewed by Tim Horton.
     8
     9        Fixes an API test added in r234600, which had incorrect test expectations — namely, the width of the caret rect
     10        was not in content view coordinates, unlike the x, y, and height.
     11
     12        * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
     13        (rounded):
     14        (-[TestWKWebView waitForCaretViewFrameToBecome:]):
     15        (-[TestWKWebView waitForSelectionViewRectsToBecome:]):
     16        (TestWebKitAPI::TEST):
     17
    1182018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
    219
  • trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm

    r234600 r234614  
    3737@implementation TestWKWebView (KeyboardInputTests)
    3838
     39static CGRect rounded(CGRect rect)
     40{
     41    return CGRectMake(roundl(rect.origin.x), roundl(rect.origin.y), roundl(rect.size.width), roundl(rect.size.height));
     42}
     43
    3944- (void)waitForCaretViewFrameToBecome:(CGRect)frame
    4045{
     
    4348    NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
    4449    while ([[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]) {
    45         CGRect currentFrame = self.caretViewRectInContentCoordinates;
     50        CGRect currentFrame = rounded(self.caretViewRectInContentCoordinates);
    4651        if (CGRectEqualToRect(currentFrame, frame))
    4752            break;
     
    6570        if (currentRects.count == selectionRects.count) {
    6671            for (NSUInteger index = 0; index < selectionRects.count; ++index)
    67                 selectionRectsMatch |= [selectionRects[index] isEqualToValue:currentRects[index]];
     72                selectionRectsMatch |= CGRectEqualToRect(selectionRects[index].CGRectValue, rounded(currentRects[index].CGRectValue));
    6873        } else
    6974            selectionRectsMatch = NO;
     
    125130TEST(KeyboardInputTests, CaretSelectionRectAfterRestoringFirstResponder)
    126131{
    127     auto expectedCaretRect = CGRectMake(16, 13, 3, 15);
     132    auto expectedCaretRect = CGRectMake(16, 13, 2, 15);
    128133    auto webView = webViewWithAutofocusedInput();
    129134    EXPECT_WK_STREQ("INPUT", [webView stringByEvaluatingJavaScript:@"document.activeElement.tagName"]);
Note: See TracChangeset for help on using the changeset viewer.