Bug 196718

Summary: Fix text autoscrolling when typing in modern webkit
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Megan Gardner <megan_gardner>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, rniwa, simon.fraser, thorton, webkit-bot-watchers-bugzilla, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews103 for mac-highsierra
none
Archive of layout-test-results from ews107 for mac-highsierra-wk2
none
Archive of layout-test-results from ews206 for win-future
none
Archive of layout-test-results from ews116 for mac-highsierra
none
Patch
none
Patch none

Description Megan Gardner 2019-04-08 18:02:30 PDT
Fix text autoscrolling when typing in modern webkit
Comment 1 Megan Gardner 2019-04-08 18:09:03 PDT
Created attachment 367005 [details]
Patch
Comment 2 EWS Watchlist 2019-04-08 19:11:48 PDT
Comment on attachment 367005 [details]
Patch

Attachment 367005 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/11813172

New failing tests:
fast/events/autoscroll-when-input-is-offscreen.html
fast/events/autoscroll-with-software-keyboard.html
Comment 3 EWS Watchlist 2019-04-08 19:11:49 PDT
Created attachment 367012 [details]
Archive of layout-test-results from ews103 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 4 EWS Watchlist 2019-04-08 19:27:06 PDT
Comment on attachment 367005 [details]
Patch

Attachment 367005 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/11813284

New failing tests:
fast/events/autoscroll-when-input-is-offscreen.html
fast/events/autoscroll-with-software-keyboard.html
Comment 5 EWS Watchlist 2019-04-08 19:27:08 PDT
Created attachment 367015 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 6 EWS Watchlist 2019-04-08 21:02:10 PDT
Comment on attachment 367005 [details]
Patch

Attachment 367005 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/11814178

New failing tests:
fast/events/autoscroll-when-input-is-offscreen.html
fast/events/autoscroll-with-software-keyboard.html
Comment 7 EWS Watchlist 2019-04-08 21:02:22 PDT
Created attachment 367024 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 8 EWS Watchlist 2019-04-08 23:41:06 PDT
Comment on attachment 367005 [details]
Patch

Attachment 367005 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/11815105

New failing tests:
fast/events/autoscroll-when-input-is-offscreen.html
fast/events/autoscroll-with-software-keyboard.html
Comment 9 EWS Watchlist 2019-04-08 23:41:08 PDT
Created attachment 367029 [details]
Archive of layout-test-results from ews116 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 10 Megan Gardner 2019-04-09 13:54:27 PDT
Created attachment 367069 [details]
Patch
Comment 11 Tim Horton 2019-04-09 15:40:32 PDT
Comment on attachment 367069 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367069&action=review

> Source/WebCore/ChangeLog:5
> +

rdar://???

> Source/WebCore/ChangeLog:20
> +        We should be scrolling the mainframe in WebKit. We have been relying on UIKit,

"main frame" IMO

> Source/WebCore/ChangeLog:21
> +        but we cannot give them enough information to guarentee a correct scroll, so just

guarentee (sp)

> Source/WebCore/page/FrameView.cpp:1998
>  IntRect FrameView::unobscuredContentRectExpandedByContentInsets() const
>  {
> -    FloatRect unobscuredContentRect = this->unobscuredContentRect();
> +    FloatRect unobscuredContentRect = this->visualViewportRect();

The disparity between the name and reality of this function seems problematic

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:165
> +    return;

No need for this return.

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:167
> +@end

Newline before the @end, or not after the @implementation, but not unbalanced like this.

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:2386
> -        _textSelectionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
> +        _textSelectionAssistant = adoptNS([[WKUIWKTextInteractionAssistant alloc] initWithView:self]);

Sneaky. V. nice.
Comment 12 Megan Gardner 2019-04-09 16:22:40 PDT
Created attachment 367080 [details]
Patch
Comment 13 Tim Horton 2019-04-10 11:09:13 PDT
Comment on attachment 367080 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367080&action=review

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:158
> +@interface WKUIWKTextInteractionAssistant : UIWKTextInteractionAssistant

🤣
Comment 14 WebKit Commit Bot 2019-04-10 11:47:30 PDT
Comment on attachment 367080 [details]
Patch

Clearing flags on attachment: 367080

Committed r244141: <https://trac.webkit.org/changeset/244141>
Comment 15 WebKit Commit Bot 2019-04-10 11:47:32 PDT
All reviewed patches have been landed.  Closing bug.
Comment 16 Radar WebKit Bug Importer 2019-04-10 11:48:25 PDT
<rdar://problem/49784158>
Comment 17 Shawn Roberts 2019-04-11 15:54:14 PDT
One of the new tests added in https://trac.webkit.org/changeset/244141/webkit is a  flaky failure

fast/events/autoscroll-when-input-is-offscreen.html is failing approximately 1 in 4 tries. 

Reproduced with:

run-webkit-tests fast/events/autoscroll-when-input-is-offscreen.html --iterations 25 -f --ios-simulator

Dashboard:

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=fast%2Fevents%2Fautoscroll-when-input-is-offscreen.html

Diff:

--- /Volumes/Data/slave/ios-simulator-12-release-tests-wk2/build/layout-test-results/fast/events/autoscroll-when-input-is-offscreen-expected.txt
+++ /Volumes/Data/slave/ios-simulator-12-release-tests-wk2/build/layout-test-results/fast/events/autoscroll-when-input-is-offscreen-actual.txt
@@ -1,3 +1,3 @@
 This test focuses a form, them scrolls to the bottom of the page. Then text is entered in the form, and we check to make sure the page has scrolled so that the input is visible again.
-PASS: page has scrolled back to the top to show the element that has text being entered into it.
+FAIL: page has failed to scroll when entering text into a form that is offscreen.
Comment 18 Megan Gardner 2019-04-12 14:28:23 PDT
Fixed test in https://bugs.webkit.org/show_bug.cgi?id=196840