<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>218277</bug_id>
          
          <creation_ts>2020-10-28 03:25:33 -0700</creation_ts>
          <short_desc>Reconsider ScrollAnimator/ScrollController split</short_desc>
          <delta_ts>2020-11-12 09:29:47 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Scrolling</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=217709</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Robinson">mrobinson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alex</cc>
    
    <cc>cathiechen</cc>
    
    <cc>fred.wang</cc>
    
    <cc>rwlbuis</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1702260</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2020-10-28 03:25:33 -0700</bug_when>
    <thetext>See https://bugs.webkit.org/show_bug.cgi?id=217709

Currently ScrollAnimator is a platform-independent class used for animating scrollable areas. If rubber banding or scroll snap are enabled ScrollAnimator owns a ScrollController, which takes care of animating these particular behaviors. There are some issues with this design:

* It&apos;s unclear where the boundaries of the areas-of-concern are. Should state be stored in ScrollController or ScrollAnimator?
* Platform-specific code boundaries are a little fuzzy. There is Mac-specific code in ScrollController, ScrollAnimator, and ScrollAnimatorMac.
* We&apos;d like to enable scroll snap support on other platforms, but probably not rubber banding. ScrollController currently manages both of those.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1702261</commentid>
    <comment_count>1</comment_count>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2020-10-28 03:29:19 -0700</bug_when>
    <thetext>So my spitball proposal for this is:

 1. Move state common to both rubber banding and scroll snap into ScrollAnimator.
 2. Split ScrollController into ScrollSnapController and RubberBandingController or ScrollSnapAnimator/RubberBandingAnimator.
 3. Try to push as much Mac-specific code as possible into ScrollAnimatorMac and ScrollSnapControllerMac/RubberBandingControllerMac.

There are probably other ways to do this and I&apos;m definitely happy to hear them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1702344</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-10-28 09:42:33 -0700</bug_when>
    <thetext>Yes, I&apos;d love to redo this code. It&apos;s very confusing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1703083</commentid>
    <comment_count>3</comment_count>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2020-10-30 09:21:20 -0700</bug_when>
    <thetext>Another thing to consider here is that scroll snap is a CSS feature and should be supported on all platforms. Perhaps we should move all scroll snap code into ScrollAnimator and rename ScrollController to RubberBandingController.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1703095</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-10-30 09:35:12 -0700</bug_when>
    <thetext>I definitely think that RubberBandingController is a good name (with platform-specific implementations).

Maybe we should have a ScrollSnapController.

It feels like we need a &quot;coordination&quot; class that can allow various delegates to affect the scroll, like rubber banding and scroll snap, but how those delegates interact will be hard to define.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1704358</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-11-04 02:26:15 -0800</bug_when>
    <thetext>&lt;rdar://problem/71029811&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1706880</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-11-12 09:27:39 -0800</bug_when>
    <thetext>Maybe:

ScrollAnimationController, which has as member variables
  ScrollSnapController
  RubberBandingController

ScrollAnimationController knows how to do an animated scroll to a position, via ScrollingMomentumCalculator.

ScrollAnimationController resolves conflicts between concurrent rubberbands/animated scrolls (if that happens).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1706883</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-11-12 09:29:47 -0800</bug_when>
    <thetext>Maybe ScrollAnimationController has a delegate that allows it to delegate smooth scrolls to the platform (UIScrollView) via ScrollingTreeScrollingNodeDelegateIOS</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>