<body> with overflow:hidden shouldn't be keyboard scrollable on iOS
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 17:37:16 +0000 (17:37 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 17:37:16 +0000 (17:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197659
Source/WebKit:

<rdar://problem/50541453>

Reviewed by Antoine Quint.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):

Disable also keyboard scrolling when touch scrolling is disabled.

LayoutTests:

Reviewed by Antoine Quint.

* fast/scrolling/ios/body-overflow-hidden-keyboard-expected.html: Added.
* fast/scrolling/ios/body-overflow-hidden-keyboard.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard-expected.html [new file with mode: 0644]
LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard.html [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 80ea829..8652c07 100644 (file)
@@ -1,3 +1,13 @@
+2019-05-07  Antti Koivisto  <antti@apple.com>
+
+        <body> with overflow:hidden shouldn't be keyboard scrollable on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=197659
+
+        Reviewed by Antoine Quint.
+
+        * fast/scrolling/ios/body-overflow-hidden-keyboard-expected.html: Added.
+        * fast/scrolling/ios/body-overflow-hidden-keyboard.html: Added.
+
 2019-05-07  Ryan Haddad  <ryanhaddad@apple.com>
 
         media/W3C/video/events/event_progress.html is flaky.
diff --git a/LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard-expected.html b/LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard-expected.html
new file mode 100644 (file)
index 0000000..eacd113
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true internal:AsyncFrameScrollingEnabled=true ] -->
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+body { overflow: hidden }
+.scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
+</style>
+<body>
+<div class="scroll-content">
+This document shouldn't be scrollable.
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard.html b/LayoutTests/fast/scrolling/ios/body-overflow-hidden-keyboard.html
new file mode 100644 (file)
index 0000000..cd65296
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true internal:AsyncFrameScrollingEnabled=true ] -->
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script src="../../../resources/ui-helper.js"></script>
+<style>
+body { overflow: hidden }
+.scroll-content { width: 500px; height: 5000px; border: 2px solid green; }
+</style>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function waitPromise(delay)
+{
+    return new Promise(resolve => setTimeout(resolve, delay));
+}
+
+async function runTest() {
+    if (!window.testRunner)
+        return;
+
+    await UIHelper.typeCharacter("downArrow");
+    await waitPromise(50);
+
+    testRunner.notifyDone();
+}
+</script>
+<body onload="runTest()">
+<div class="scroll-content">
+This document shouldn't be scrollable.
+</div>
+</body>
+</html>
index 88ce45e..2dd38e2 100644 (file)
@@ -1,3 +1,16 @@
+2019-05-07  Antti Koivisto  <antti@apple.com>
+
+        <body> with overflow:hidden shouldn't be keyboard scrollable on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=197659
+        <rdar://problem/50541453>
+
+        Reviewed by Antoine Quint.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
+
+        Disable also keyboard scrolling when touch scrolling is disabled.
+
 2019-05-07  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [macOS] Avoid crashing the UI process when writing empty data to the pasteboard
index 77de7c8..f302baf 100644 (file)
@@ -4620,6 +4620,9 @@ static NSString *contentTypeFromFieldName(WebCore::AutofillFieldName fieldName)
     if (_focusedElementInformation.elementType == WebKit::InputType::Select)
         return NO;
 
+    if (!_webView.scrollView.scrollEnabled)
+        return NO;
+
     return YES;
 }