Fix text autoscrolling when typing in modern webkit
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 18:47:25 +0000 (18:47 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 18:47:25 +0000 (18:47 +0000)
commit0597746cf2e2fc4c443b0f41183ad01d002f9cf8
tree207b0351258406818b3c9ab5891b70edea35fd52
parent842ab8b374e28992f956d0660714a6a00fddaa64
Fix text autoscrolling when typing in modern webkit
https://bugs.webkit.org/show_bug.cgi?id=196718
Source/WebCore:

<rdar://problem/49225507>

Reviewed by Tim Horton.

Tests: fast/events/autoscroll-when-input-is-offscreen.html
       fast/events/autoscroll-with-software-keyboard.html

We have been relying on UIKit to scroll editable text, but
since we cannot give them enough information for them to always
do the right thing, we should just do all the work in WebKit.
This has the added benifit of fixing some tricky autoscrolling
bugs that have cropped up recently.

* editing/Editor.cpp:
(WebCore::Editor::insertTextWithoutSendingTextEvent):
(WebCore::Editor::revealSelectionAfterEditingOperation):
We should be scrolling the main frame in WebKit. We have been relying on UIKit,
but we cannot give them enough information to guarantee a correct scroll, so just
do all the work in WebKit.
* page/FrameView.cpp:
(WebCore::FrameView::unobscuredContentRectExpandedByContentInsets const):
Update to use the rect that is actually visible, accounting for the software keyboard.

Source/WebKit:

<rdar://problem/49225507>

Reviewed by Tim Horton.

For staging only. We need to turn off UIKit's scrolling behavior to land
the changes we are making. To keep from the build ever breaking,
I am temporarily circumventing the changes in UIKit. This will be removed
once the next UIKit submission happens.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
(-[WKContentView setUpTextSelectionAssistant]):

LayoutTests:

Reviewed by Tim Horton.

* fast/events/autoscroll-when-input-is-offscreen-expected.txt: Added.
* fast/events/autoscroll-when-input-is-offscreen.html: Added.
* fast/events/autoscroll-with-software-keyboard-expected.txt: Added.
* fast/events/autoscroll-with-software-keyboard.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/autoscroll-when-input-is-offscreen-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html [new file with mode: 0644]
LayoutTests/fast/events/autoscroll-with-software-keyboard-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/autoscroll-with-software-keyboard.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/events/autoscroll-when-input-is-offscreen-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/events/autoscroll-with-software-keyboard-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/fast/events/autoscroll-when-input-is-offscreen-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/fast/events/autoscroll-with-software-keyboard-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm