<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[244141] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/244141">244141</a></dd>
<dt>Author</dt> <dd>megan_gardner@apple.com</dd>
<dt>Date</dt> <dd>2019-04-10 11:47:25 -0700 (Wed, 10 Apr 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsautoscrollwheninputisoffscreenexpectedtxt">trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsautoscrollwheninputisoffscreenhtml">trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsautoscrollwithsoftwarekeyboardexpectedtxt">trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsautoscrollwithsoftwarekeyboardhtml">trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasteventsautoscrollwheninputisoffscreenexpectedtxt">trunk/LayoutTests/platform/mac/fast/events/autoscroll-when-input-is-offscreen-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasteventsautoscrollwithsoftwarekeyboardexpectedtxt">trunk/LayoutTests/platform/mac/fast/events/autoscroll-with-software-keyboard-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwinfasteventsautoscrollwheninputisoffscreenexpectedtxt">trunk/LayoutTests/platform/win/fast/events/autoscroll-when-input-is-offscreen-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwinfasteventsautoscrollwithsoftwarekeyboardexpectedtxt">trunk/LayoutTests/platform/win/fast/events/autoscroll-with-software-keyboard-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/LayoutTests/ChangeLog 2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-04-10  Megan Gardner  <megan_gardner@apple.com>
+
+        Fix text autoscrolling when typing in modern webkit
+        https://bugs.webkit.org/show_bug.cgi?id=196718
+
+        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.
+
</ins><span class="cx"> 2019-04-10  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Delay initialization of quota users until the first quota request
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsautoscrollwheninputisoffscreenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen-expected.txt                            (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen-expected.txt       2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+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.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsautoscrollwheninputisoffscreenhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html                            (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html       2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/basic-gestures.js"></script>
+<script src="../../resources/ui-helper.js"></script>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    async function runTest()
+    {
+        if (!testRunner.runUIScript)
+            return;
+    
+        var output = '';
+        var firstTargetRect = document.getElementById('editable').getBoundingClientRect();
+
+        var pressPointX = firstTargetRect.x;
+        var pressPointY = firstTargetRect.y;
+
+    
+        await tapAtPoint(pressPointX,pressPointY);
+        
+        var programaticScroll = 500;
+        document.scrollingElement.scrollTop = programaticScroll;
+        await UIHelper.enterText("Test");
+
+        if (window.pageYOffset < programaticScroll)
+            output += 'PASS: page has scrolled back to the top to show the element that has text being entered into it.';
+        else
+            output += 'FAIL: page has failed to scroll when entering text into a form that is offscreen.';
+        output += '<br>';
+
+        document.getElementById('testArea').innerHTML = output;
+        testRunner.notifyDone();
+    }
+
+    window.addEventListener('load', runTest, false);
+</script>
+<style>
+    #testArea {
+        height: 2000px;
+        width: 300px;
+        background-color: silver;
+        font-family: monospace;
+        font-size: 18px;
+    }
+    #editable {
+        font-family: monospace;
+        font-size: 18px;
+    }
+</style>
+</head>
+<body>
+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.
+<div id="result"></div>
+<div id="testArea"><input id="editable" type="text"></input></div>
+</body>
+</html>
+
+
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsautoscrollwithsoftwarekeyboardexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard-expected.txt                             (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard-expected.txt        2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test presses return until the cursor would be behind the keyboard, forcing the content to be scrolled to stay in view with a software keyboard on screen.
+PASS: page has scrolled when caret is behind software keyboard.
+PASS: page has continuted to scroll when caret is beyond the edge of the screen.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsautoscrollwithsoftwarekeyboardhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard.html (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard.html                             (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-with-software-keyboard.html        2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/basic-gestures.js"></script>
+<script src="../../resources/ui-helper.js"></script>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    async function runTest()
+    {
+        if (!testRunner.runUIScript)
+            return;
+    
+        var output = '';
+        var firstTargetRect = document.getElementById('editable').getBoundingClientRect();
+    
+        var pressPointX = firstTargetRect.x;
+        var pressPointY = firstTargetRect.y;
+
+    
+        await tapAtPoint(pressPointX,pressPointY);
+        await UIHelper.enterText("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTest");
+
+        var firstPageOffset = window.pageYOffset;
+        if (window.pageYOffset > 0)
+            output += 'PASS: page has scrolled when caret is behind software keyboard.';
+        else
+            output += 'FAIL: page has failed to scroll when caret is behind software keyboard.';
+        output += '<br>';
+
+        await UIHelper.enterText("\n\n\n\n\n\n\n\n\n\n\n\n\n\nTest");
+        if (window.pageYOffset > 0 && window.pageYOffset > firstPageOffset)
+            output += 'PASS: page has continuted to scroll when caret is beyond the edge of the screen.';
+        else
+            output += 'FAIL: page has failed to scroll when caret is beyond the edge of the screen.';
+        output += '<br>';
+
+        document.getElementById('editable').innerHTML = output;
+        testRunner.notifyDone();
+    }
+
+    window.addEventListener('load', runTest, false);
+</script>
+<style>
+    #editable {
+        height: 1000px;
+        width: 300px;
+        background-color: silver;
+        font-family: monospace;
+        font-size: 18px;
+    }
+</style>
+</head>
+<body>
+This test presses return until the cursor would be behind the keyboard,
+forcing the content to be scrolled to stay in view with a software keyboard on screen.
+<div id="editable" contenteditable>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasteventsautoscrollwheninputisoffscreenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/events/autoscroll-when-input-is-offscreen-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/events/autoscroll-when-input-is-offscreen-expected.txt                               (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/events/autoscroll-when-input-is-offscreen-expected.txt  2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+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.
+FAIL: page has failed to scroll when entering text into a form that is offscreen.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasteventsautoscrollwithsoftwarekeyboardexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/events/autoscroll-with-software-keyboard-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/events/autoscroll-with-software-keyboard-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/events/autoscroll-with-software-keyboard-expected.txt   2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test presses return until the cursor would be behind the keyboard, forcing the content to be scrolled to stay in view with a software keyboard on screen.
+FAIL: page has failed to scroll when caret is behind software keyboard.
+FAIL: page has failed to scroll when caret is beyond the edge of the screen.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinfasteventsautoscrollwheninputisoffscreenexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/win/fast/events/autoscroll-when-input-is-offscreen-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/fast/events/autoscroll-when-input-is-offscreen-expected.txt                               (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/autoscroll-when-input-is-offscreen-expected.txt  2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+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.
+FAIL: page has failed to scroll when entering text into a form that is offscreen.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinfasteventsautoscrollwithsoftwarekeyboardexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/win/fast/events/autoscroll-with-software-keyboard-expected.txt (0 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/fast/events/autoscroll-with-software-keyboard-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/autoscroll-with-software-keyboard-expected.txt   2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test presses return until the cursor would be behind the keyboard, forcing the content to be scrolled to stay in view with a software keyboard on screen.
+FAIL: page has failed to scroll when caret is behind software keyboard.
+FAIL: page has failed to scroll when caret is beyond the edge of the screen.
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebCore/ChangeLog      2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2019-04-10  Megan Gardner  <megan_gardner@apple.com>
+
+        Fix text autoscrolling when typing in modern webkit
+        https://bugs.webkit.org/show_bug.cgi?id=196718
+        <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.
+
</ins><span class="cx"> 2019-04-10  Ross Kirsling  <ross.kirsling@sony.com>
</span><span class="cx"> 
</span><span class="cx">         WebCore should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp  2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebCore/editing/Editor.cpp     2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -1280,11 +1280,7 @@
</span><span class="cx">             // Reveal the current selection
</span><span class="cx">             if (Frame* editedFrame = document->frame())
</span><span class="cx">                 if (Page* page = editedFrame->page()) {
</span><del>-#if PLATFORM(IOS_FAMILY)
-                    SelectionRevealMode revealMode = SelectionRevealMode::RevealUpToMainFrame;
-#else
</del><span class="cx">                     SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
</span><del>-#endif
</del><span class="cx">                     page->focusController().focusedOrMainFrame().selection().revealSelection(revealMode, ScrollAlignment::alignCenterIfNeeded);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -3055,12 +3051,7 @@
</span><span class="cx">     if (m_ignoreSelectionChanges)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-    SelectionRevealMode revealMode = SelectionRevealMode::RevealUpToMainFrame;
-#else
</del><span class="cx">     SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
</span><del>-#endif
-
</del><span class="cx">     m_frame.selection().revealSelection(revealMode, alignment, revealExtentOption);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp  2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebCore/page/FrameView.cpp     2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -1993,9 +1993,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect FrameView::unobscuredContentRectExpandedByContentInsets() const
</del><ins>+IntRect FrameView::visualViewportRectExpandedByContentInsets() const
</ins><span class="cx"> {
</span><del>-    FloatRect unobscuredContentRect = this->unobscuredContentRect();
</del><ins>+    FloatRect unobscuredContentRect = this->visualViewportRect();
</ins><span class="cx">     if (auto* page = frame().page())
</span><span class="cx">         unobscuredContentRect.expand(page->contentInsets());
</span><span class="cx">     return IntRect(unobscuredContentRect);
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h    2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebCore/page/FrameView.h       2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -329,7 +329,7 @@
</span><span class="cx">     WEBCORE_EXPORT static LayoutRect rectForViewportConstrainedObjects(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    IntRect unobscuredContentRectExpandedByContentInsets() const;
</del><ins>+    IntRect visualViewportRectExpandedByContentInsets() const;
</ins><span class="cx">     
</span><span class="cx">     bool fixedElementsLayoutRelativeToFrame() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp   2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp      2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -2568,7 +2568,7 @@
</span><span class="cx"> #if !PLATFORM(IOS_FAMILY)
</span><span class="cx">             LayoutRect viewRect = frameView.visibleContentRect();
</span><span class="cx"> #else
</span><del>-            LayoutRect viewRect = frameView.unobscuredContentRectExpandedByContentInsets();
</del><ins>+            LayoutRect viewRect = frameView.visualViewportRectExpandedByContentInsets();
</ins><span class="cx"> #endif
</span><span class="cx">             // Move the target rect into "scrollView contents" coordinates.
</span><span class="cx">             LayoutRect targetRect = absoluteRect;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebKit/ChangeLog       2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2019-04-10  Megan Gardner  <megan_gardner@apple.com>
+
+        Fix text autoscrolling when typing in modern webkit
+        https://bugs.webkit.org/show_bug.cgi?id=196718
+        <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]):
+
</ins><span class="cx"> 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOSMac] Opt into modern compatibility mode by default
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (244140 => 244141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2019-04-10 18:45:04 UTC (rev 244140)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2019-04-10 18:47:25 UTC (rev 244141)
</span><span class="lines">@@ -154,6 +154,16 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+// For staging with UIKit, will be removed ASAP.
+@interface WKUIWKTextInteractionAssistant : UIWKTextInteractionAssistant
+@end
+
+@implementation WKUIWKTextInteractionAssistant
+- (void)scrollSelectionToVisible
+{
+}
+@end
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="lines">@@ -2371,7 +2381,7 @@
</span><span class="cx"> - (void)setUpTextSelectionAssistant
</span><span class="cx"> {
</span><span class="cx">     if (!_textSelectionAssistant)
</span><del>-        _textSelectionAssistant = adoptNS([[UIWKTextInteractionAssistant alloc] initWithView:self]);
</del><ins>+        _textSelectionAssistant = adoptNS([[WKUIWKTextInteractionAssistant alloc] initWithView:self]);
</ins><span class="cx">     else {
</span><span class="cx">         // Reset the gesture recognizers in case editability has changed.
</span><span class="cx">         [_textSelectionAssistant setGestureRecognizers];
</span></span></pre>
</div>
</div>

</body>
</html>