Bug 237696 - [iOS] Fix overscroll-behavior for main document
Summary: [iOS] Fix overscroll-behavior for main document
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nikos Mouchtaris
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-09 19:22 PST by Nikos Mouchtaris
Modified: 2022-03-11 15:44 PST (History)
8 users (show)

See Also:


Attachments
Patch (6.77 KB, patch)
2022-03-09 19:38 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (12.35 KB, patch)
2022-03-10 17:53 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (13.47 KB, patch)
2022-03-10 19:30 PST, Nikos Mouchtaris
simon.fraser: review+
simon.fraser: commit-queue-
Details | Formatted Diff | Diff
Patch (14.72 KB, patch)
2022-03-10 20:47 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (15.28 KB, patch)
2022-03-11 11:52 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (15.39 KB, patch)
2022-03-11 12:10 PST, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Mouchtaris 2022-03-09 19:22:04 PST
Make overscroll-behavior on html element work for iOS.
Comment 1 Nikos Mouchtaris 2022-03-09 19:22:45 PST
rdar://89501965
Comment 2 Nikos Mouchtaris 2022-03-09 19:38:42 PST
Created attachment 454309 [details]
Patch
Comment 3 Nikos Mouchtaris 2022-03-10 17:53:07 PST
Created attachment 454432 [details]
Patch
Comment 4 Nikos Mouchtaris 2022-03-10 19:30:25 PST
Created attachment 454437 [details]
Patch
Comment 5 Simon Fraser (smfr) 2022-03-10 19:45:04 PST
Comment on attachment 454437 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454437&action=review

> Source/WebKit/ChangeLog:10
> +        UIScrollView should rubber band or not. Need to investigate adding a test for this,
> +        as this doesn't require the new UIKit SPI.

The comment about testing is no longer relevant.

> Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:232
> +#if HAVE(UIKIT_OVERSCROLL_BEHAVIOR_SUPPORT)
> +    scrollView._allowsParentToBeginHorizontally = horizontalOverscrollBehavior == OverscrollBehavior::Auto;
> +    scrollView._allowsParentToBeginVertically = verticalOverscrollBehavior == OverscrollBehavior::Auto;
> +#endif

I don't think we want to set this on the root scroll view. That would allow web content to prevent scroll gestures in the web view from propagating to some ancestor scroller.
Comment 6 Nikos Mouchtaris 2022-03-10 20:47:34 PST
Created attachment 454442 [details]
Patch
Comment 7 Simon Fraser (smfr) 2022-03-11 09:38:13 PST
Comment on attachment 454442 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454442&action=review

> Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:86
> +    static void updateScrollViewForOverscrollBehavior(UIScrollView *, const WebCore::OverscrollBehavior, const WebCore::OverscrollBehavior, bool);

We try to avoid bool function parameters where it's hard to know at the call site what it means (this is called "the boolean trap"). You make it harder here by not naming the parameters in the header.

Possible solution are to use an enum, like 
enum class AllowScrollPropagation : bool { No, Yes };

or two functions.
Comment 8 Nikos Mouchtaris 2022-03-11 11:52:21 PST
Created attachment 454501 [details]
Patch
Comment 9 Simon Fraser (smfr) 2022-03-11 12:00:31 PST
Comment on attachment 454501 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454501&action=review

> Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:229
> +    if (allowPropogation == AllowScrollPropagation::No) {

Isn't this backwards?

Or maybe it's confusing that the enum is called "AllowScrollPropagation" (bad suggestion on my part). I was thinking more like "AllowOverscrollToPreventScrollPropagation"
Comment 10 Nikos Mouchtaris 2022-03-11 12:10:35 PST
Created attachment 454504 [details]
Patch
Comment 11 Nikos Mouchtaris 2022-03-11 12:12:13 PST
(In reply to Simon Fraser (smfr) from comment #9)
> Comment on attachment 454501 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454501&action=review
> 
> > Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:229
> > +    if (allowPropogation == AllowScrollPropagation::No) {
> 
> Isn't this backwards?
> 
> Or maybe it's confusing that the enum is called "AllowScrollPropagation"
> (bad suggestion on my part). I was thinking more like
> "AllowOverscrollToPreventScrollPropagation"

Ah I had interpreted AllowScrollPropagation::No to mean we were disabling scroll propagation. I updated to AllowOverscrollToPreventScrollPropagation as its a bit more clear.
Comment 12 EWS 2022-03-11 15:44:01 PST
Committed r291198 (248353@main): <https://commits.webkit.org/248353@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454504 [details].