Title: [250306] trunk
Revision
250306
Author
wenson_hs...@apple.com
Date
2019-09-24 10:25:05 -0700 (Tue, 24 Sep 2019)

Log Message

FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState triggers a debug assertion
https://bugs.webkit.org/show_bug.cgi?id=202145
<rdar://problem/51273128>

Reviewed by Tim Horton.

Source/WebKit:

Fixes an assertion in -tableView:cellForRowAtIndexPath: to only require the cell to have a non-zero
width in the case where the table view itself has a non-empty width. When run under TestWebKitAPI,
this assertion currently fires because the view controller used to show the popover isn't actually
presented, so the view controller's view (i.e. the UITableView) ends up being empty. This causes all
of its table view cells to subsequently become empty upon reuse.

* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):

Tools:

Fixes this API test to work on iPad as well as iPhone. Importantly, we show a popover when focusing
select elements on iPad, which means that there is no -inputView present on WKContentView, and upon
dismissing the form accessory view, the select element is still focused.

* TestWebKitAPI/Tests/ios/FocusPreservationTests.mm:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (250305 => 250306)


--- trunk/Source/WebKit/ChangeLog	2019-09-24 17:15:47 UTC (rev 250305)
+++ trunk/Source/WebKit/ChangeLog	2019-09-24 17:25:05 UTC (rev 250306)
@@ -1,3 +1,20 @@
+2019-09-24  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState triggers a debug assertion
+        https://bugs.webkit.org/show_bug.cgi?id=202145
+        <rdar://problem/51273128>
+
+        Reviewed by Tim Horton.
+
+        Fixes an assertion in -tableView:cellForRowAtIndexPath: to only require the cell to have a non-zero
+        width in the case where the table view itself has a non-empty width. When run under TestWebKitAPI,
+        this assertion currently fires because the view controller used to show the popover isn't actually
+        presented, so the view controller's view (i.e. the UITableView) ends up being empty. This causes all
+        of its table view cells to subsequently become empty upon reuse.
+
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
+
 2019-09-24  Alex Christensen  <achristen...@webkit.org>
 
         Require a WebsiteDataStore when creating or resuming downloads

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm (250305 => 250306)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm	2019-09-24 17:15:47 UTC (rev 250305)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm	2019-09-24 17:25:05 UTC (rev 250306)
@@ -270,7 +270,7 @@
     }
     
     CGRect textRect = [cell textRectForContentRect:[cell contentRectForBounds:[cell bounds]]];
-    ASSERT(textRect.size.width > 0.0);
+    ASSERT_IMPLIES(CGRectGetWidth(tableView.bounds) > 0, textRect.size.width > 0);
     
     // Assume all cells have the same available text width.
     UIFont *font = cell.textLabel.font;

Modified: trunk/Tools/ChangeLog (250305 => 250306)


--- trunk/Tools/ChangeLog	2019-09-24 17:15:47 UTC (rev 250305)
+++ trunk/Tools/ChangeLog	2019-09-24 17:25:05 UTC (rev 250306)
@@ -1,3 +1,17 @@
+2019-09-24  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState triggers a debug assertion
+        https://bugs.webkit.org/show_bug.cgi?id=202145
+        <rdar://problem/51273128>
+
+        Reviewed by Tim Horton.
+
+        Fixes this API test to work on iPad as well as iPhone. Importantly, we show a popover when focusing
+        select elements on iPad, which means that there is no -inputView present on WKContentView, and upon
+        dismissing the form accessory view, the select element is still focused.
+
+        * TestWebKitAPI/Tests/ios/FocusPreservationTests.mm:
+
 2019-09-25  Cathie Chen  <cathiec...@igalia.com>
 
         Add Cathie Chen as WebKit committer

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm (250305 => 250306)


--- trunk/Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm	2019-09-24 17:15:47 UTC (rev 250305)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm	2019-09-24 17:25:05 UTC (rev 250306)
@@ -94,12 +94,17 @@
     [webView evaluateJavaScript:@"document.querySelector('select').focus()" completionHandler:nil];
     Util::run(&selectFocused);
 
-    EXPECT_NOT_NULL(webView.textInputContentView.inputView);
+    BOOL isPhone = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone;
+    if (isPhone)
+        EXPECT_NOT_NULL(webView.textInputContentView.inputView);
+
     [webView selectFormAccessoryPickerRow:1];
     [webView dismissFormAccessoryView];
-    EXPECT_FALSE([webView stringByEvaluatingJavaScript:@"document.activeElement == document.querySelector('select')"].boolValue);
     EXPECT_EQ(1, [webView stringByEvaluatingJavaScript:@"document.querySelector('select').selectedIndex"].intValue);
 
+    if (isPhone)
+        EXPECT_FALSE([webView stringByEvaluatingJavaScript:@"document.activeElement == document.querySelector('select')"].boolValue);
+
     [webView.textInputContentView _restoreFocusWithToken:focusToken];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to