Title: [249585] trunk
- Revision
- 249585
- Author
- [email protected]
- Date
- 2019-09-06 12:03:34 -0700 (Fri, 06 Sep 2019)
Log Message
REGRESSION(iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen
https://bugs.webkit.org/show_bug.cgi?id=192564
Patch by Darryl Pogue <[email protected]> on 2019-09-06
Reviewed by Tim Horton.
Source/WebKit:
The new keyboard height was being read into a variable after the scrollview had already been
adjusted. This worked when the keyboard was opening, because the scrollview is adjusted with
the correct value a second time when the keyboard animation has finished. However, when the
keyboard is closed, the adjustment was being made before the correct height was stored,
leading to the scrollview being positioned as if the keyboard were still open.
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
LayoutTests:
Added tests to verify scrolling properly adapts to the keyboard insets on iOS.
* fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets-expected.txt: Added.
* fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (249584 => 249585)
--- trunk/LayoutTests/ChangeLog 2019-09-06 18:46:14 UTC (rev 249584)
+++ trunk/LayoutTests/ChangeLog 2019-09-06 19:03:34 UTC (rev 249585)
@@ -1,3 +1,15 @@
+2019-09-06 Darryl Pogue <[email protected]>
+
+ REGRESSION(iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen
+ https://bugs.webkit.org/show_bug.cgi?id=192564
+
+ Reviewed by Tim Horton.
+
+ Added tests to verify scrolling properly adapts to the keyboard insets on iOS.
+
+ * fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets-expected.txt: Added.
+ * fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets.html: Added.
+
2019-09-06 Said Abou-Hallawa <[email protected]>
Unreviewed, fix typo in r249216
Added: trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets-expected.txt (0 => 249585)
--- trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets-expected.txt 2019-09-06 19:03:34 UTC (rev 249585)
@@ -0,0 +1,6 @@
+This tests focusing an element right above the keyboard. WebKit should scroll the document to reveal the element and then scroll back when the keyboard is dismissed.
+To manually test, focus the text field below on iPad to bring up the docked software keyboard.
+The document should scroll. Dimiss the keyboard and the document should scroll back to its original position.
+PASS - the document did scroll on focus
+PASS - the document did scroll on blur
+
Added: trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets.html (0 => 249585)
--- trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/scrollview-adjusts-to-keyboard-insets.html 2019-09-06 19:03:34 UTC (rev 249585)
@@ -0,0 +1,74 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true internal:AsyncOverflowScrollingEnabled=true internal:AsyncFrameScrollingEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover">
+<script src=""
+<style>
+html, body { width: 100vw; height: 100vh; margin: 0px; padding: 0px; }
+#content { width: 100vw; height: 100vh; box-sizing: border-box; padding: 20px; background: #ccc; }
+#target { position: absolute; bottom: 1em; }
+</style>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function listenForEventOnce(target, name, timeout) {
+ return new Promise((resolve, reject) => {
+ const timer = timeout ? setTimeout(reject, timeout) : null;
+ target.addEventListener(name, () => {
+ if (timer)
+ clearTimeout(timer);
+ resolve();
+ }, {once: true});
+ });
+}
+
+async function runTest() {
+ const target = document.getElementById('target');
+ var output = '';
+
+ const firstScrollEvent = listenForEventOnce(target, 'focus').then(() => listenForEventOnce(visualViewport, 'scroll', window.testRunner ? 3000 : 500));
+
+ if (window.testRunner) {
+ await UIHelper.setHardwareKeyboardAttached(false);
+ await UIHelper.activateElementAndWaitForInputSession(target);
+ }
+
+ try {
+ await firstScrollEvent;
+ } catch (error) { }
+
+ output += document.documentElement.scrollTop >= 50 ? 'PASS - the document did scroll on focus' : 'FAIL - the document did not scroll on focus';
+ output += '<br>';
+
+ const secondScrollEvent = listenForEventOnce(visualViewport, 'scroll', window.testRunner ? 3000 : 500);
+
+ if (window.testRunner) {
+ document.activeElement.blur();
+ await UIHelper.waitForKeyboardToHide();
+ }
+
+ try {
+ await secondScrollEvent;
+ } catch (error) { }
+
+ output += document.documentElement.scrollTop == 0 ? 'PASS - the document did scroll on blur' : 'FAIL - the document did not scroll on blur';
+
+ document.getElementById('result').innerHTML = output;
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+</script>
+<body _onload_="runTest()">
+<div id="content">
+This tests focusing an element right above the keyboard. WebKit should scroll the document to reveal the element and then scroll back when the keyboard is dismissed.<br>
+To manually test, focus the text field below on iPad to bring up the docked software keyboard.<br>
+The document should scroll. Dimiss the keyboard and the document should scroll back to its original position.<br>
+<div id="result"></div>
+<input id="target">
+</div>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (249584 => 249585)
--- trunk/Source/WebKit/ChangeLog 2019-09-06 18:46:14 UTC (rev 249584)
+++ trunk/Source/WebKit/ChangeLog 2019-09-06 19:03:34 UTC (rev 249585)
@@ -1,3 +1,19 @@
+2019-09-06 Darryl Pogue <[email protected]>
+
+ REGRESSION(iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen
+ https://bugs.webkit.org/show_bug.cgi?id=192564
+
+ Reviewed by Tim Horton.
+
+ The new keyboard height was being read into a variable after the scrollview had already been
+ adjusted. This worked when the keyboard was opening, because the scrollview is adjusted with
+ the correct value a second time when the keyboard animation has finished. However, when the
+ keyboard is closed, the adjustment was being made before the correct height was stored,
+ leading to the scrollview being positioned as if the keyboard were still open.
+
+ * UIProcess/ios/WKScrollView.mm:
+ (-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
+
2019-09-06 Tim Horton <[email protected]>
Marking up a note on iOS results in a PDF with no contents
Modified: trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm (249584 => 249585)
--- trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm 2019-09-06 18:46:14 UTC (rev 249584)
+++ trunk/Source/WebKit/UIProcess/ios/WKScrollView.mm 2019-09-06 19:03:34 UTC (rev 249585)
@@ -339,9 +339,9 @@
- (void)_adjustForAutomaticKeyboardInfo:(NSDictionary *)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment
{
+ _keyboardBottomInsetAdjustment = [[UIPeripheralHost sharedInstance] getVerticalOverlapForView:self usingKeyboardInfo:info];
+
[super _adjustForAutomaticKeyboardInfo:info animated:animated lastAdjustment:lastAdjustment];
-
- _keyboardBottomInsetAdjustment = [[UIPeripheralHost sharedInstance] getVerticalOverlapForView:self usingKeyboardInfo:info];
}
- (UIEdgeInsets)_systemContentInset
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes