Title: [256072] trunk
- Revision
- 256072
- Author
- wenson_hs...@apple.com
- Date
- 2020-02-07 15:25:45 -0800 (Fri, 07 Feb 2020)
Log Message
[iOS] Double tapping shouldn't scroll the page when the body has `overflow: hidden`
https://bugs.webkit.org/show_bug.cgi?id=207390
<rdar://problem/56960774>
Reviewed by Tim Horton and Simon Fraser.
Source/WebKit:
Bail out of several codepaths that zoom and scroll WKScrollView as a result of smart magnification gestures
(e.g. one-finger double taps), in the case where scrolling has been disabled on WKScrollView. This may occur
if the page has `overflow: hidden` on the body or root, but may also happen due to a WebKit client disabling
scrolling via native API, such as `webView.scrollView.scrollingEnabled = NO;`.
Test: fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _zoomToPoint:atScale:animated:]):
(-[WKWebView _scrollToRect:origin:minimumScrollDistance:]):
Drive-by fix: change some `false`s to `NO`s, and `true`s to `YES`s.
(-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
LayoutTests:
Add a new layout test to verify that double tapping an element doesn't cause the page to scroll if `overflow:
hidden` is applied to the body.
* fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled-expected.txt: Added.
* fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (256071 => 256072)
--- trunk/LayoutTests/ChangeLog 2020-02-07 23:19:52 UTC (rev 256071)
+++ trunk/LayoutTests/ChangeLog 2020-02-07 23:25:45 UTC (rev 256072)
@@ -1,3 +1,17 @@
+2020-02-07 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS] Double tapping shouldn't scroll the page when the body has `overflow: hidden`
+ https://bugs.webkit.org/show_bug.cgi?id=207390
+ <rdar://problem/56960774>
+
+ Reviewed by Tim Horton and Simon Fraser.
+
+ Add a new layout test to verify that double tapping an element doesn't cause the page to scroll if `overflow:
+ hidden` is applied to the body.
+
+ * fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled-expected.txt: Added.
+ * fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html: Added.
+
2020-02-07 Kate Cheney <katherine_che...@apple.com>
Regression (r256011): http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access.html is consistently failing
Added: trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled-expected.txt (0 => 256072)
--- trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled-expected.txt 2020-02-07 23:25:45 UTC (rev 256072)
@@ -0,0 +1,10 @@
+Verifies that double-tapping does not trigger mainframe scrolling when overflow: hidden is specified. To manually run the test, double tap the text below; the page should not scroll.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.scrollingElement.scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Double tap here
Added: trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html (0 => 256072)
--- trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html 2020-02-07 23:25:45 UTC (rev 256072)
@@ -0,0 +1,44 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <style>
+ body {
+ margin: 0;
+ overflow: hidden;
+ height: 200vh;
+ }
+
+ #target {
+ width: 100%;
+ height: 100px;
+ background-color: red;
+ font-size: 80px;
+ text-align: center;
+ position: absolute;
+ top: 75vh;
+ color: white;
+ }
+ </style>
+ <script src=""
+ <script src=""
+ <script>
+ addEventListener("load", async () => {
+ jsTestIsAsync = true;
+ description("Verifies that double-tapping does not trigger mainframe scrolling when <code>overflow: hidden</code> is specified. To manually run the test, double tap the text below; the page should not scroll.");
+
+ if (!window.testRunner)
+ return;
+
+ const rect = target.getBoundingClientRect();
+ await UIHelper.doubleTapAt(rect.left + rect.width / 2, rect.top + rect.height / 2);
+ await UIHelper.delayFor(100);
+ shouldBe("document.scrollingElement.scrollTop", "0");
+ finishJSTest();
+ });
+ </script>
+ </head>
+ <body>
+ <div id="target">Double tap here</div>
+ </body>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (256071 => 256072)
--- trunk/Source/WebKit/ChangeLog 2020-02-07 23:19:52 UTC (rev 256071)
+++ trunk/Source/WebKit/ChangeLog 2020-02-07 23:25:45 UTC (rev 256072)
@@ -1,3 +1,26 @@
+2020-02-07 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS] Double tapping shouldn't scroll the page when the body has `overflow: hidden`
+ https://bugs.webkit.org/show_bug.cgi?id=207390
+ <rdar://problem/56960774>
+
+ Reviewed by Tim Horton and Simon Fraser.
+
+ Bail out of several codepaths that zoom and scroll WKScrollView as a result of smart magnification gestures
+ (e.g. one-finger double taps), in the case where scrolling has been disabled on WKScrollView. This may occur
+ if the page has `overflow: hidden` on the body or root, but may also happen due to a WebKit client disabling
+ scrolling via native API, such as `webView.scrollView.scrollingEnabled = NO;`.
+
+ Test: fast/scrolling/ios/double-tap-to-scroll-with-scrolling-disabled.html
+
+ * UIProcess/API/ios/WKWebViewIOS.mm:
+ (-[WKWebView _zoomToPoint:atScale:animated:]):
+ (-[WKWebView _scrollToRect:origin:minimumScrollDistance:]):
+
+ Drive-by fix: change some `false`s to `NO`s, and `true`s to `YES`s.
+
+ (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
+
2020-02-07 Timothy Hatcher <timo...@apple.com>
Crash under WKBundleFrameForJavaScriptContext dereferencing a NULL WebCore::Frame.
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (256071 => 256072)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2020-02-07 23:19:52 UTC (rev 256071)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2020-02-07 23:25:45 UTC (rev 256072)
@@ -1042,6 +1042,9 @@
- (void)_zoomToPoint:(WebCore::FloatPoint)point atScale:(double)scale animated:(BOOL)animated
{
+ if (![_scrollView isScrollEnabled])
+ return;
+
CFTimeInterval duration = 0;
CGFloat zoomScale = contentZoomScale(self);
@@ -1124,6 +1127,9 @@
- (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance
{
+ if (![_scrollView isScrollEnabled])
+ return NO;
+
WebCore::FloatRect unobscuredContentRect([self _contentRectForUserInteraction]);
WebCore::FloatPoint unobscuredContentOffset = unobscuredContentRect.location();
WebCore::FloatSize contentSize([self._currentContentView bounds].size);
@@ -1154,7 +1160,7 @@
float scrollDistance = scrollViewOffsetDelta.diagonalLength();
if (scrollDistance < minimumScrollDistance)
- return false;
+ return NO;
[_contentView willStartZoomOrScroll];
@@ -1161,7 +1167,7 @@
LOG_WITH_STREAM(VisibleRects, stream << "_scrollToRect: scrolling to " << [_scrollView contentOffset] + scrollViewOffsetDelta);
[_scrollView setContentOffset:([_scrollView contentOffset] + scrollViewOffsetDelta) animated:YES];
- return true;
+ return YES;
}
- (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated
@@ -1181,6 +1187,8 @@
{
LOG_WITH_STREAM(VisibleRects, stream << "_zoomToFocusRect:" << focusedElementRectInDocumentCoordinates << " selectionRect:" << selectionRectInDocumentCoordinates);
UNUSED_PARAM(insideFixed);
+ if (![_scrollView isScrollEnabled])
+ return;
const double minimumHeightToShowContentAboveKeyboard = 106;
const CFTimeInterval formControlZoomAnimationDuration = 0.25;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes