WebKit Bugzilla
Attachment 369135 Details for
Bug 153852
: <body> with overflow:hidden CSS is scrollable on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
overflow-hidden-ios-4.patch (text/plain), 16.78 KB, created by
Antti Koivisto
on 2019-05-06 10:43:20 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2019-05-06 10:43:20 PDT
Size:
16.78 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 244962) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,44 @@ >+2019-05-06 Antti Koivisto <antti@apple.com> >+ >+ <body> with overflow:hidden CSS is scrollable on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=153852 >+ <rdar://problem/38715356> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Disable touch scrolling of the main scroll view when <body> has overflow:hidden. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _setScrollingEnabled:]): >+ * UIProcess/API/Cocoa/WKWebViewInternal.h: >+ * UIProcess/PageClient.h: >+ * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: >+ * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: >+ (WebKit::RemoteScrollingTree::rootScrollingNodeScrollabilityDidChange): >+ * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: >+ * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: >+ (WebKit::RemoteScrollingCoordinatorProxy::rootScrollingNodeScrollabilityDidChange): >+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: >+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): >+ >+ Base the decision on scrolling node canHaveScrollbars(), matching Mac behavior. >+ >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::rootScrollingNodeScrollabilityDidChange): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView cleanupInteraction]): >+ (-[WKContentView _rootScrollingNodeScrollabilityDidChange:]): >+ * UIProcess/ios/WKScrollView.h: >+ * UIProcess/ios/WKScrollView.mm: >+ (-[WKScrollView initWithFrame:]): >+ (-[WKScrollView setScrollEnabled:]): >+ (-[WKScrollView _setScrollEnabledInternal:]): >+ (-[WKScrollView updateScrollability]): >+ >+ Since the scroll view is exposed in the API, respect the public scrollEnabled property too. >+ > 2019-05-04 Alex Christensen <achristensen@webkit.org> > > Revert r244953 and r244954 because they broke internal builds. >Index: Source/WebKit/UIProcess/PageClient.h >=================================================================== >--- Source/WebKit/UIProcess/PageClient.h (revision 244904) >+++ Source/WebKit/UIProcess/PageClient.h (working copy) >@@ -400,6 +400,8 @@ public: > virtual void scrollingNodeScrollViewDidScroll() = 0; > virtual void scrollingNodeScrollWillStartScroll() = 0; > virtual void scrollingNodeScrollDidEndScroll() = 0; >+ virtual void rootScrollingNodeScrollabilityDidChange(bool scrollable) = 0; >+ > virtual Vector<String> mimeTypesWithCustomContentProviders() = 0; > > virtual void showInspectorHighlight(const WebCore::Highlight&) = 0; >Index: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (revision 244904) >+++ Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (working copy) >@@ -2634,6 +2634,11 @@ - (void)_didFinishScrolling > [_contentView didFinishScrolling]; > } > >+- (void)_setScrollingEnabled:(BOOL)enabled >+{ >+ [_scrollView _setScrollEnabledInternal:enabled]; >+} >+ > - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset > { > // Work around <rdar://problem/16374753> by avoiding deceleration while >Index: Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (revision 244904) >+++ Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (working copy) >@@ -107,6 +107,7 @@ struct PrintInfo; > - (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated; > - (void)_zoomToInitialScaleWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated; > - (void)_didFinishScrolling; >+- (void)_setScrollingEnabled:(BOOL)enabled; > > - (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType; > - (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data; >Index: Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (revision 244904) >+++ Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (working copy) >@@ -90,6 +90,7 @@ public: > void scrollingTreeNodeWillStartPanGesture(); > void scrollingTreeNodeWillStartScroll(); > void scrollingTreeNodeDidEndScroll(); >+ void rootScrollingNodeScrollabilityDidChange(bool scrollable); > #if ENABLE(CSS_SCROLL_SNAP) > void adjustTargetContentOffsetForSnapping(CGSize maxScrollDimensions, CGPoint velocity, CGFloat topInset, CGPoint* targetContentOffset); > bool hasActiveSnapPoint() const; >Index: Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (revision 244904) >+++ Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (working copy) >@@ -95,6 +95,10 @@ void RemoteScrollingTree::scrollingTreeN > m_scrollingCoordinatorProxy.scrollingTreeNodeDidEndScroll(); > } > >+void RemoteScrollingTree::rootScrollingNodeScrollabilityDidChange(bool scrollable) >+{ >+ m_scrollingCoordinatorProxy.rootScrollingNodeScrollabilityDidChange(scrollable); >+} > #endif > > void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction) >Index: Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (revision 244904) >+++ Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (working copy) >@@ -56,6 +56,10 @@ public: > > void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override; > >+#if PLATFORM(IOS_FAMILY) >+ void rootScrollingNodeScrollabilityDidChange(bool scrollable); >+#endif >+ > private: > explicit RemoteScrollingTree(RemoteScrollingCoordinatorProxy&); > >Index: Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (revision 244904) >+++ Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (working copy) >@@ -29,6 +29,7 @@ > #if PLATFORM(IOS_FAMILY) > #if ENABLE(ASYNC_SCROLLING) > >+#import "PageClient.h" > #import "RemoteLayerTreeHost.h" > #import "RemoteLayerTreeNode.h" > #import "WebPageProxy.h" >@@ -119,6 +120,11 @@ void RemoteScrollingCoordinatorProxy::sc > m_webPageProxy.scrollingNodeScrollDidEndScroll(); > } > >+void RemoteScrollingCoordinatorProxy::rootScrollingNodeScrollabilityDidChange(bool scrollable) >+{ >+ m_webPageProxy.pageClient().rootScrollingNodeScrollabilityDidChange(scrollable); >+} >+ > void RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations(const RemoteLayerTreeHost& remoteLayerTreeHost) > { > for (auto layerID : m_layersWithScrollingRelations) { >Index: Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm >=================================================================== >--- Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (revision 244904) >+++ Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (working copy) >@@ -28,10 +28,10 @@ > > #if PLATFORM(IOS_FAMILY) && ENABLE(ASYNC_SCROLLING) > >+#import "RemoteScrollingTree.h" > #import "ScrollingTreeScrollingNodeDelegateIOS.h" > #import <WebCore/ScrollingStateFrameScrollingNode.h> > #import <WebCore/ScrollingStateScrollingNode.h> >-#import <WebCore/ScrollingTree.h> > > namespace WebKit { > using namespace WebCore; >@@ -87,6 +87,9 @@ void ScrollingTreeFrameScrollingNodeRemo > return; > } > >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaParams)) >+ downcast<RemoteScrollingTree>(scrollingTree()).rootScrollingNodeScrollabilityDidChange(canHaveScrollbars()); >+ > // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens. > if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) { > auto scrollType = scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll() ? ScrollType::Programmatic : ScrollType::User; >Index: Source/WebKit/UIProcess/ios/PageClientImplIOS.h >=================================================================== >--- Source/WebKit/UIProcess/ios/PageClientImplIOS.h (revision 244904) >+++ Source/WebKit/UIProcess/ios/PageClientImplIOS.h (working copy) >@@ -182,6 +182,7 @@ private: > void scrollingNodeScrollViewDidScroll() override; > void scrollingNodeScrollWillStartScroll() override; > void scrollingNodeScrollDidEndScroll() override; >+ void rootScrollingNodeScrollabilityDidChange(bool scrollable) override; > > // Auxiliary Client Creation > #if ENABLE(FULLSCREEN_API) >Index: Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >=================================================================== >--- Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (revision 244904) >+++ Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (working copy) >@@ -690,6 +690,11 @@ void PageClientImpl::scrollingNodeScroll > [m_contentView _scrollingNodeScrollingDidEnd]; > } > >+void PageClientImpl::rootScrollingNodeScrollabilityDidChange(bool scrollable) >+{ >+ [m_contentView _rootScrollingNodeScrollabilityDidChange:scrollable]; >+} >+ > Vector<String> PageClientImpl::mimeTypesWithCustomContentProviders() > { > return [m_webView _contentProviderRegistry]._mimeTypesWithCustomContentProviders; >Index: Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >=================================================================== >--- Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (revision 244904) >+++ Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (working copy) >@@ -442,6 +442,7 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DE > - (void)_didEndScrollingOrZooming; > - (void)_scrollingNodeScrollingWillBegin; > - (void)_scrollingNodeScrollingDidEnd; >+- (void)_rootScrollingNodeScrollabilityDidChange:(BOOL)scrollable; > - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect routeSharingPolicy:(WebCore::RouteSharingPolicy)policy routingContextUID:(NSString *)contextUID; > - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; > - (void)_showShareSheet:(const WebCore::ShareDataWithParsedURL&)shareData inRect:(WTF::Optional<WebCore::FloatRect>)rect completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler; >Index: Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >=================================================================== >--- Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (revision 244904) >+++ Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (working copy) >@@ -940,6 +940,8 @@ - (void)cleanupInteraction > [self _resetPanningPreventionFlags]; > #endif > [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; >+ >+ [_webView _setScrollingEnabled:YES]; > } > > - (void)_removeDefaultGestureRecognizers >@@ -1615,6 +1617,11 @@ - (void)_scrollingNodeScrollingDidEnd > [_textSelectionAssistant didEndScrollingOverflow]; > } > >+- (void)_rootScrollingNodeScrollabilityDidChange:(BOOL)scrollable >+{ >+ [_webView _setScrollingEnabled:scrollable]; >+} >+ > - (BOOL)shouldShowAutomaticKeyboardUI > { > // FIXME: We should support inputmode="none" when the hardware keyboard is attached. >Index: Source/WebKit/UIProcess/ios/WKScrollView.h >=================================================================== >--- Source/WebKit/UIProcess/ios/WKScrollView.h (revision 244904) >+++ Source/WebKit/UIProcess/ios/WKScrollView.h (working copy) >@@ -34,6 +34,7 @@ > @property (nonatomic, assign) WKWebView <UIScrollViewDelegate> *internalDelegate; > > - (void)_setContentSizePreservingContentOffsetDuringRubberband:(CGSize)contentSize; >+- (void)_setScrollEnabledInternal:(BOOL)enabled; > > #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 > @property (nonatomic, assign, readonly) BOOL _contentInsetAdjustmentBehaviorWasExternallyOverridden; >Index: Source/WebKit/UIProcess/ios/WKScrollView.mm >=================================================================== >--- Source/WebKit/UIProcess/ios/WKScrollView.mm (revision 244904) >+++ Source/WebKit/UIProcess/ios/WKScrollView.mm (working copy) >@@ -130,6 +130,8 @@ - (id)forwardingTargetForSelector:(SEL)a > BOOL _contentInsetAdjustmentBehaviorWasExternallyOverridden; > #endif > CGFloat _keyboardBottomInsetAdjustment; >+ BOOL _scrollEnabledByClient; >+ BOOL _scrollEnabledInternal; > } > > - (id)initWithFrame:(CGRect)frame >@@ -139,6 +141,9 @@ - (id)initWithFrame:(CGRect)frame > if (!self) > return nil; > >+ _scrollEnabledByClient = YES; >+ _scrollEnabledInternal = YES; >+ > self.alwaysBounceVertical = YES; > self.directionalLockEnabled = YES; > [self _setIndicatorInsetAdjustmentBehavior:UIScrollViewIndicatorInsetAdjustmentAlways]; >@@ -354,6 +359,27 @@ - (UIEdgeInsets)_systemContentInset > return systemContentInset; > } > >+- (void)setScrollEnabled:(BOOL)value >+{ >+ if (_scrollEnabledByClient == value) >+ return; >+ _scrollEnabledByClient = value; >+ [self updateScrollability]; >+} >+ >+- (void)_setScrollEnabledInternal:(BOOL)value >+{ >+ if (_scrollEnabledInternal == value) >+ return; >+ _scrollEnabledInternal = value; >+ [self updateScrollability]; >+} >+ >+- (void)updateScrollability >+{ >+ [super setScrollEnabled:(_scrollEnabledByClient && _scrollEnabledInternal)]; >+} >+ > #if PLATFORM(WATCHOS) > > - (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 244904) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2019-05-06 Antti Koivisto <antti@apple.com> >+ >+ <body> with overflow:hidden CSS is scrollable on iOS >+ https://bugs.webkit.org/show_bug.cgi?id=153852 >+ <rdar://problem/38715356> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/scrolling/ios/body-overflow-hidden-expected.html: Added. >+ * fast/scrolling/ios/body-overflow-hidden.html: Added. >+ > 2019-05-02 Ryosuke Niwa <rniwa@webkit.org> > > Make focusing-element-with-tabindex-by-tap-or-click.html more robust on iOS >Index: LayoutTests/fast/scrolling/ios/body-overflow-hidden-expected.html >=================================================================== >--- LayoutTests/fast/scrolling/ios/body-overflow-hidden-expected.html (nonexistent) >+++ LayoutTests/fast/scrolling/ios/body-overflow-hidden-expected.html (working copy) >@@ -0,0 +1,13 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<style> >+.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> >Index: LayoutTests/fast/scrolling/ios/body-overflow-hidden.html >=================================================================== >--- LayoutTests/fast/scrolling/ios/body-overflow-hidden.html (nonexistent) >+++ LayoutTests/fast/scrolling/ios/body-overflow-hidden.html (working copy) >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<script src="../../../resources/basic-gestures.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 touchAndDragFromPointToPoint(150, 300, 150, 150); >+ await liftUpAtPoint(150, 150); >+ await waitPromise(50); >+ >+ testRunner.notifyDone(); >+} >+</script> >+<body onload="runTest()"> >+<div class="scroll-content"> >+This document shouldn't be scrollable. >+</div> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 153852
:
270621
|
270644
|
369132
|
369135
|
369263
|
369267
|
369268