<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185681] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185681">185681</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-06-17 17:32:33 -0700 (Wed, 17 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Overflow regions with scroll snap points are not reliably rubber banding
https://bugs.webkit.org/show_bug.cgi?id=142522
&lt;rdar://problem/20100726&gt;

Reviewed by Darin Adler.

Source/WebCore:

When computing the target scroll destination, update the nearest snap point index
and other bookkeeping, but keep the original gesture target if it would have taken
us beyond either limit of the scroll container.

* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::scrollExtents): Add new method
to support client API.
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scrollExtents): Add new method to support client API.
* platform/ScrollAnimator.h:
* platform/cocoa/ScrollController.h:
(WebCore::ScrollControllerClient::scrollExtents): Added new pure virtual method to API.
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::beginScrollSnapAnimation): Hold onto original user gesture
target, and use that instead of our nearest snap point if the gesture takes us past
either extreme of the scroll container.

Source/WebKit2:

Make sure we don't block rubberbanding behavior when a scroll gesture should take us past
the end of the scroll container.

* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Don't adjust
target point if we were going to scroll past the edges of the scroll container.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimatorcpp">trunk/Source/WebCore/platform/ScrollAnimator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimatorh">trunk/Source/WebCore/platform/ScrollAnimator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaScrollControllerh">trunk/Source/WebCore/platform/cocoa/ScrollController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaScrollControllermm">trunk/Source/WebCore/platform/cocoa/ScrollController.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/ChangeLog        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-06-17  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        Overflow regions with scroll snap points are not reliably rubber banding
+        https://bugs.webkit.org/show_bug.cgi?id=142522
+        &lt;rdar://problem/20100726&gt;
+
+        Reviewed by Darin Adler.
+
+        When computing the target scroll destination, update the nearest snap point index
+        and other bookkeeping, but keep the original gesture target if it would have taken
+        us beyond either limit of the scroll container.
+
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollExtents): Add new method
+        to support client API.
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::scrollExtents): Add new method to support client API.
+        * platform/ScrollAnimator.h:
+        * platform/cocoa/ScrollController.h:
+        (WebCore::ScrollControllerClient::scrollExtents): Added new pure virtual method to API.
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::beginScrollSnapAnimation): Hold onto original user gesture
+        target, and use that instead of our nearest snap point if the gesture takes us past
+        either extreme of the scroll container.
+
</ins><span class="cx"> 2015-06-17  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Swipe gesture can get stuck, preventing scrolling and other gestures
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx">     float pageScaleFactor() const override;
</span><span class="cx">     void startScrollSnapTimer(ScrollEventAxis) override;
</span><span class="cx">     void stopScrollSnapTimer(ScrollEventAxis) override;
</span><ins>+    LayoutSize scrollExtent() const override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void logExposedUnfilledArea();
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING) &amp;&amp; PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;FrameView.h&quot;
</span><ins>+#import &quot;LayoutSize.h&quot;
</ins><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;NSScrollerImpDetails.h&quot;
</span><span class="cx"> #import &quot;PlatformWheelEvent.h&quot;
</span><span class="lines">@@ -587,6 +588,11 @@
</span><span class="cx">     if (!m_scrollController.hasActiveScrollSnapTimerForAxis(otherAxis))
</span><span class="cx">         scrollingTree().setMainFrameIsScrollSnapping(false);
</span><span class="cx"> }
</span><ins>+    
+LayoutSize ScrollingTreeFrameScrollingNodeMac::scrollExtent() const
+{
+    return LayoutSize(totalContentsSize());
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTreeFrameScrollingNodeMac::deferTestsForReason(WheelEventTestTrigger::ScrollableAreaIdentifier identifier, WheelEventTestTrigger::DeferTestTriggerReason reason) const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimator.cpp        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;ScrollAnimator.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FloatPoint.h&quot;
</span><ins>+#include &quot;LayoutSize.h&quot;
</ins><span class="cx"> #include &quot;PlatformWheelEvent.h&quot;
</span><span class="cx"> #include &quot;ScrollableArea.h&quot;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><span class="lines">@@ -213,6 +214,11 @@
</span><span class="cx">     else
</span><span class="cx">         scrollToOffsetWithoutAnimation(FloatPoint(currentPosition.x(), currentPosition.y() + delta));
</span><span class="cx"> }
</span><ins>+
+LayoutSize ScrollAnimator::scrollExtent() const
+{
+    return m_scrollableArea.contentsSize();
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) &amp;&amp; PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimator.h        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -135,6 +135,7 @@
</span><span class="cx">     void immediateScrollOnAxis(ScrollEventAxis, float delta) override;
</span><span class="cx">     bool activeScrollSnapIndexDidChange() const;
</span><span class="cx">     unsigned activeScrollSnapIndexForAxis(ScrollEventAxis) const;
</span><ins>+    LayoutSize scrollExtent() const override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaScrollControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.h (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ScrollController.h        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.h        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class LayoutSize;
</ins><span class="cx"> class PlatformWheelEvent;
</span><span class="cx"> class ScrollableArea;
</span><span class="cx"> class WheelEventTestTrigger;
</span><span class="lines">@@ -102,6 +103,8 @@
</span><span class="cx">     {
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><ins>+
+    virtual LayoutSize scrollExtent() const = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaScrollControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.mm (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ScrollController.mm        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.mm        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ScrollController.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;LayoutSize.h&quot;
</ins><span class="cx"> #include &quot;PlatformWheelEvent.h&quot;
</span><span class="cx"> #include &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #include &quot;WheelEventTestTrigger.h&quot;
</span><span class="lines">@@ -752,18 +753,24 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit offset = m_client.scrollOffsetOnAxis(axis);
</span><span class="cx">     float initialWheelDelta = newState == ScrollSnapState::Gliding ? snapState.averageInitialWheelDelta() : 0;
</span><del>-    LayoutUnit projectedScrollDestination = newState == ScrollSnapState::Gliding ? snapState.m_beginTrackingWheelDeltaOffset + LayoutUnit(projectedInertialScrollDistance(initialWheelDelta)) : offset;
</del><ins>+    LayoutUnit scaledProjectedScrollDestination = newState == ScrollSnapState::Gliding ? snapState.m_beginTrackingWheelDeltaOffset + LayoutUnit(projectedInertialScrollDistance(initialWheelDelta)) : offset;
</ins><span class="cx">     if (snapState.m_snapOffsets.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     float scaleFactor = m_client.pageScaleFactor();
</span><ins>+    LayoutUnit originalProjectedScrollDestination = scaledProjectedScrollDestination / scaleFactor;
</ins><span class="cx">     
</span><del>-    projectedScrollDestination = std::min(std::max(LayoutUnit(projectedScrollDestination / scaleFactor), snapState.m_snapOffsets.first()), snapState.m_snapOffsets.last());
</del><ins>+    LayoutUnit clampedScrollDestination = std::min(std::max(originalProjectedScrollDestination, snapState.m_snapOffsets.first()), snapState.m_snapOffsets.last());
</ins><span class="cx">     snapState.m_initialOffset = offset;
</span><span class="cx">     m_activeScrollSnapIndexDidChange = false;
</span><del>-    snapState.m_targetOffset = scaleFactor * closestSnapOffset&lt;LayoutUnit, float&gt;(snapState.m_snapOffsets, projectedScrollDestination, initialWheelDelta, snapState.m_activeSnapIndex);
</del><ins>+    snapState.m_targetOffset = scaleFactor * closestSnapOffset&lt;LayoutUnit, float&gt;(snapState.m_snapOffsets, clampedScrollDestination, initialWheelDelta, snapState.m_activeSnapIndex);
</ins><span class="cx">     if (snapState.m_initialOffset == snapState.m_targetOffset)
</span><span class="cx">         return;
</span><ins>+
+    LayoutUnit scrollExtent = (axis == ScrollEventAxis::Horizontal) ? m_client.scrollExtent().width() : m_client.scrollExtent().height();
+    LayoutUnit projectedScrollDestination = clampedScrollDestination;
+    if (originalProjectedScrollDestination &lt; 0 || originalProjectedScrollDestination &gt; scrollExtent)
+        projectedScrollDestination = originalProjectedScrollDestination;
</ins><span class="cx">     
</span><span class="cx">     m_activeScrollSnapIndexDidChange = true;
</span><span class="cx">     snapState.m_currentState = newState;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebKit2/ChangeLog        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-06-17  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        Overflow regions with scroll snap points are not reliably rubber banding
+        https://bugs.webkit.org/show_bug.cgi?id=142522
+        &lt;rdar://problem/20100726&gt;
+
+        Reviewed by Darin Adler.
+
+        Make sure we don't block rubberbanding behavior when a scroll gesture should take us past
+        the end of the scroll container.
+
+        * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+        (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Don't adjust
+        target point if we were going to scroll past the edges of the scroll container.
+
</ins><span class="cx"> 2015-06-17  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Would like a way, in the API, to get notified about a web process crash
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (185680 => 185681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2015-06-18 00:22:23 UTC (rev 185680)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2015-06-18 00:32:33 UTC (rev 185681)
</span><span class="lines">@@ -80,11 +80,14 @@
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><span class="cx"> - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
</span><span class="cx"> {
</span><ins>+    CGFloat horizontalTarget = targetContentOffset-&gt;x;
+    CGFloat verticalTarget = targetContentOffset-&gt;y;
+
</ins><span class="cx">     unsigned ignore;
</span><del>-    if (!_scrollingTreeNode-&gt;horizontalSnapOffsets().isEmpty())
-        targetContentOffset-&gt;x = closestSnapOffset&lt;float, CGFloat&gt;(_scrollingTreeNode-&gt;horizontalSnapOffsets(), targetContentOffset-&gt;x, velocity.x, ignore);
-    if (!_scrollingTreeNode-&gt;verticalSnapOffsets().isEmpty())
-        targetContentOffset-&gt;y = closestSnapOffset&lt;float, CGFloat&gt;(_scrollingTreeNode-&gt;verticalSnapOffsets(), targetContentOffset-&gt;y, velocity.y, ignore);
</del><ins>+    if (!_scrollingTreeNode-&gt;horizontalSnapOffsets().isEmpty() &amp;&amp; horizontalTarget &gt;= 0 &amp;&amp; horizontalTarget &lt;= scrollView.contentSize.width)
+        targetContentOffset-&gt;x = closestSnapOffset&lt;float, CGFloat&gt;(_scrollingTreeNode-&gt;horizontalSnapOffsets(), horizontalTarget, velocity.x, ignore);
+    if (!_scrollingTreeNode-&gt;verticalSnapOffsets().isEmpty() &amp;&amp; verticalTarget &gt;= 0 &amp;&amp; verticalTarget &lt;= scrollView.contentSize.height)
+        targetContentOffset-&gt;y = closestSnapOffset&lt;float, CGFloat&gt;(_scrollingTreeNode-&gt;verticalSnapOffsets(), verticalTarget, velocity.y, ignore);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>