<!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>[184596] 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/184596">184596</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-05-19 14:58:30 -0700 (Tue, 19 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION(142590): Part 2: Scroll-snap points are improperly snapping to earlier index values (Scrolling Thread) 
https://bugs.webkit.org/show_bug.cgi?id=145175
&lt;rdar://problem/21023785&gt;

Reviewed by Beth Dakin.

Source/WebCore:

Extend the main-thread scrolling changes done in Bug 145140 to also handle Scrolling Thread snapping.
The post-layout fixup (needed to handle window resize and device orientation changes) should not fire
while Scrolling Thread scroll-snap animations are running, since these animations will most likely
move the scroll view into the proper position. If we attempt to 'fix up' the scroll position before
these animations finish, we get an ugly 'jump' in the display.

* page/FrameView.cpp:
(WebCore::FrameView::isScrollSnapInProgress): New method based on isRubberBandInProgress, which considers
both the ScrollAnimator (main thread) scrolling, as well as the ScrollingCoordinator (Scrolling Thread)
scrolling operations. Returns true if a scroll-snap animation is still active.
* page/FrameView.h:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::isScrollSnapInProgress): Added. Returns scrolling tree's
'isScrollSnapInProgress' state.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::isScrollSnapInProgress): Added default 'false' stub.
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::ScrollingTree): Use modern C++11 initializers.
(WebCore::ScrollingTree::isScrollSnapInProgress): Added.
(WebCore::ScrollingTree::setMainFrameIsScrollSnapping): Added.
* page/scrolling/ScrollingTree.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): Update scrolling tree state to match the
ScrollController's scroll-snap state.
(WebCore::ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer): Added. When starting a scroll snap timer,
always set the scrolling tree scroll-snapping state to true.
(WebCore::ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer): Added. When ending a scroll snap timer,
only set the scrolling tree scroll-snapping state to false if the other axis animator is inactive.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::updateScrollSnapState): Revise implementation to use its 'isScrollSnapInProgress'
method, rather than only looking at the ScrollAnimator (main thread) state.
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::isScrollSnapInProgress): Added.
* platform/cocoa/ScrollController.h:
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::hasActiveScrollSnapTimerForAxis): Added. Reports if the scroll snap animation
timer on the requested axis is running or not.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::isScrollSnapInProgress): Added.
* rendering/RenderLayer.h:

Source/WebKit2:

Add a stub implementation of isScrollSnapInProgress to match ScrollingCoordinator signature.

* WebProcess/Scrolling/RemoteScrollingCoordinator.h:
* WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress): Added stub.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeh">trunk/Source/WebCore/page/scrolling/ScrollingTree.h</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="#trunkSourceWebCoreplatformScrollableAreacpp">trunk/Source/WebCore/platform/ScrollableArea.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollableAreah">trunk/Source/WebCore/platform/ScrollableArea.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="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatorh">trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm">trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/ChangeLog        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2015-05-19  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        REGRESSION(142590): Part 2: Scroll-snap points are improperly snapping to earlier index values (Scrolling Thread) 
+        https://bugs.webkit.org/show_bug.cgi?id=145175
+        &lt;rdar://problem/21023785&gt;
+
+        Reviewed by Beth Dakin.
+
+        Extend the main-thread scrolling changes done in Bug 145140 to also handle Scrolling Thread snapping.
+        The post-layout fixup (needed to handle window resize and device orientation changes) should not fire
+        while Scrolling Thread scroll-snap animations are running, since these animations will most likely
+        move the scroll view into the proper position. If we attempt to 'fix up' the scroll position before
+        these animations finish, we get an ugly 'jump' in the display.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::isScrollSnapInProgress): New method based on isRubberBandInProgress, which considers
+        both the ScrollAnimator (main thread) scrolling, as well as the ScrollingCoordinator (Scrolling Thread)
+        scrolling operations. Returns true if a scroll-snap animation is still active.
+        * page/FrameView.h:
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::isScrollSnapInProgress): Added. Returns scrolling tree's
+        'isScrollSnapInProgress' state.
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::isScrollSnapInProgress): Added default 'false' stub.
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::ScrollingTree): Use modern C++11 initializers.
+        (WebCore::ScrollingTree::isScrollSnapInProgress): Added.
+        (WebCore::ScrollingTree::setMainFrameIsScrollSnapping): Added.
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent): Update scrolling tree state to match the
+        ScrollController's scroll-snap state.
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer): Added. When starting a scroll snap timer,
+        always set the scrolling tree scroll-snapping state to true.
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer): Added. When ending a scroll snap timer,
+        only set the scrolling tree scroll-snapping state to false if the other axis animator is inactive.
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::updateScrollSnapState): Revise implementation to use its 'isScrollSnapInProgress'
+        method, rather than only looking at the ScrollAnimator (main thread) state.
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::isScrollSnapInProgress): Added.
+        * platform/cocoa/ScrollController.h:
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::hasActiveScrollSnapTimerForAxis): Added. Reports if the scroll snap animation
+        timer on the requested axis is running or not.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::isScrollSnapInProgress): Added.
+        * rendering/RenderLayer.h:
+
</ins><span class="cx"> 2015-05-19  Roger Fong  &lt;roger_fong@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Media Controls stop updating after hovering for a few seconds.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -905,6 +905,28 @@
</span><span class="cx">     
</span><span class="cx">     updateSnapOffsetsForScrollableArea(*this, *body, *renderView(), body-&gt;renderer()-&gt;style());
</span><span class="cx"> }
</span><ins>+
+bool FrameView::isScrollSnapInProgress() const
+{
+    if (scrollbarsSuppressed())
+        return false;
+    
+    // If the scrolling thread updates the scroll position for this FrameView, then we should return
+    // ScrollingCoordinator::isScrollSnapInProgress().
+    if (Page* page = frame().page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = page-&gt;scrollingCoordinator()) {
+            if (!scrollingCoordinator-&gt;shouldUpdateScrollLayerPositionSynchronously())
+                return scrollingCoordinator-&gt;isScrollSnapInProgress();
+        }
+    }
+    
+    // If the main thread updates the scroll position for this FrameView, we should return
+    // ScrollAnimator::isScrollSnapInProgress().
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        return scrollAnimator-&gt;isScrollSnapInProgress();
+    
+    return false;
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/FrameView.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">              (C) 1998, 1999 Torben Weis (weis@kde.org)
</span><span class="cx">              (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">              (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><del>-   Copyright (C) 2004-2009, 2014 Apple Inc. All rights reserved.
</del><ins>+   Copyright (C) 2004-2009, 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> 
</span><span class="cx">    This library is free software; you can redistribute it and/or
</span><span class="cx">    modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -538,7 +538,8 @@
</span><span class="cx">     FloatRect exposedRect() const { return m_exposedRect; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><del>-    virtual void updateSnapOffsets() override;
</del><ins>+    void updateSnapOffsets() override;
+    bool isScrollSnapInProgress() const override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual float adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity) override;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -611,6 +611,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_SCROLL_SNAP)
+bool AsyncScrollingCoordinator::isScrollSnapInProgress() const
+{
+    return scrollingTree()-&gt;isScrollSnapInProgress();
+}
+#endif
+    
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -102,6 +102,10 @@
</span><span class="cx">     virtual bool isRubberBandInProgress() const override;
</span><span class="cx">     virtual void setScrollPinningBehavior(ScrollPinningBehavior) override;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_SCROLL_SNAP)
+    bool isScrollSnapInProgress() const override;
+#endif
+
</ins><span class="cx">     WEBCORE_EXPORT virtual void syncChildPositions(const LayoutRect&amp; viewportRect) override;
</span><span class="cx">     WEBCORE_EXPORT virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea&amp;, ScrollbarOrientation) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -176,6 +176,7 @@
</span><span class="cx">     virtual void syncChildPositions(const LayoutRect&amp;) { }
</span><span class="cx">     virtual String scrollingStateTreeAsText() const;
</span><span class="cx">     virtual bool isRubberBandInProgress() const { return false; }
</span><ins>+    virtual bool isScrollSnapInProgress() const { return false; }
</ins><span class="cx">     virtual void setScrollPinningBehavior(ScrollPinningBehavior) { }
</span><span class="cx"> 
</span><span class="cx">     // Generated a unique id for scroll layers.
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -39,20 +39,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> ScrollingTree::ScrollingTree()
</span><del>-    : m_rubberBandsAtLeft(true)
-    , m_rubberBandsAtRight(true)
-    , m_rubberBandsAtTop(true)
-    , m_rubberBandsAtBottom(true)
-    , m_mainFramePinnedToTheLeft(true)
-    , m_mainFramePinnedToTheRight(true)
-    , m_mainFramePinnedToTheTop(true)
-    , m_mainFramePinnedToTheBottom(true)
-    , m_mainFrameIsRubberBanding(false)
-    , m_scrollPinningBehavior(DoNotPin)
-    , m_latchedNode(0)
-    , m_scrollingPerformanceLoggingEnabled(false)
-    , m_isHandlingProgrammaticScroll(false)
-    , m_fixedOrStickyNodeCount(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -263,6 +249,20 @@
</span><span class="cx">     m_mainFrameIsRubberBanding = isRubberBanding;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ScrollingTree::isScrollSnapInProgress()
+{
+    MutexLocker lock(m_mutex);
+    
+    return m_mainFrameIsScrollSnapping;
+}
+    
+void ScrollingTree::setMainFrameIsScrollSnapping(bool isScrollSnapping)
+{
+    MutexLocker locker(m_mutex);
+    
+    m_mainFrameIsScrollSnapping = isScrollSnapping;
+}
+
</ins><span class="cx"> void ScrollingTree::setCanRubberBandState(bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom)
</span><span class="cx"> {
</span><span class="cx">     MutexLocker locker(m_swipeStateMutex);
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx">     
</span><span class="cx">     void setMainFrameIsRubberBanding(bool);
</span><span class="cx">     bool isRubberBandInProgress();
</span><ins>+    void setMainFrameIsScrollSnapping(bool);
+    bool isScrollSnapInProgress();
</ins><span class="cx"> 
</span><span class="cx">     virtual void invalidate() { }
</span><span class="cx">     WEBCORE_EXPORT virtual void commitNewTreeState(std::unique_ptr&lt;ScrollingStateTree&gt;);
</span><span class="lines">@@ -161,24 +163,25 @@
</span><span class="cx">     FloatPoint m_mainFrameScrollPosition;
</span><span class="cx"> 
</span><span class="cx">     Mutex m_swipeStateMutex;
</span><del>-    bool m_rubberBandsAtLeft;
-    bool m_rubberBandsAtRight;
-    bool m_rubberBandsAtTop;
-    bool m_rubberBandsAtBottom;
-    bool m_mainFramePinnedToTheLeft;
-    bool m_mainFramePinnedToTheRight;
-    bool m_mainFramePinnedToTheTop;
-    bool m_mainFramePinnedToTheBottom;
-    bool m_mainFrameIsRubberBanding;
-    ScrollPinningBehavior m_scrollPinningBehavior;
-    ScrollingNodeID m_latchedNode;
</del><ins>+    ScrollPinningBehavior m_scrollPinningBehavior { DoNotPin };
+    ScrollingNodeID m_latchedNode { 0 };
</ins><span class="cx"> 
</span><del>-    bool m_scrollingPerformanceLoggingEnabled;
</del><ins>+    unsigned m_fixedOrStickyNodeCount { 0 };
+
+    bool m_rubberBandsAtLeft { true };
+    bool m_rubberBandsAtRight { true };
+    bool m_rubberBandsAtTop { true };
+    bool m_rubberBandsAtBottom { true };
+    bool m_mainFramePinnedToTheLeft { true };
+    bool m_mainFramePinnedToTheRight { true };
+    bool m_mainFramePinnedToTheTop { true };
+    bool m_mainFramePinnedToTheBottom { true };
+    bool m_mainFrameIsRubberBanding { false };
+    bool m_mainFrameIsScrollSnapping { false };
+    bool m_scrollingPerformanceLoggingEnabled { false };
+    bool m_isHandlingProgrammaticScroll { false };
+};
</ins><span class="cx">     
</span><del>-    bool m_isHandlingProgrammaticScroll;
-    unsigned m_fixedOrStickyNodeCount;
-};
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #define SPECIALIZE_TYPE_TRAITS_SCROLLING_TREE(ToValueTypeName, predicate) \
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -86,6 +86,8 @@
</span><span class="cx">     LayoutUnit scrollOffsetOnAxis(ScrollEventAxis) const override;
</span><span class="cx">     void immediateScrollOnAxis(ScrollEventAxis, float delta) override;
</span><span class="cx">     float pageScaleFactor() const override;
</span><ins>+    void startScrollSnapTimer(ScrollEventAxis) override;
+    void stopScrollSnapTimer(ScrollEventAxis) 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 (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -185,6 +185,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_scrollController.handleWheelEvent(wheelEvent);
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span><ins>+    scrollingTree().setMainFrameIsScrollSnapping(m_scrollController.isScrollSnapInProgress());
</ins><span class="cx">     if (m_scrollController.activeScrollSnapIndexDidChange())
</span><span class="cx">         scrollingTree().setActiveScrollSnapIndices(scrollingNodeID(), m_scrollController.activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal), m_scrollController.activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical));
</span><span class="cx"> #endif
</span><span class="lines">@@ -574,6 +575,18 @@
</span><span class="cx"> {
</span><span class="cx">     return frameScaleFactor();
</span><span class="cx"> }
</span><ins>+
+void ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer(ScrollEventAxis)
+{
+    scrollingTree().setMainFrameIsScrollSnapping(true);
+}
+
+void ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer(ScrollEventAxis axis)
+{
+    ScrollEventAxis otherAxis = (axis == ScrollEventAxis::Horizontal) ? ScrollEventAxis::Vertical : ScrollEventAxis::Horizontal;
+    if (!m_scrollController.hasActiveScrollSnapTimerForAxis(otherAxis))
+        scrollingTree().setMainFrameIsScrollSnapping(false);
+}
</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="trunkSourceWebCoreplatformScrollableAreacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.cpp        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -458,13 +458,13 @@
</span><span class="cx"> void ScrollableArea::updateScrollSnapState()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) {
</del><ins>+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
</ins><span class="cx">         scrollAnimator-&gt;updateScrollAnimatorsAndTimers();
</span><del>-        if (scrollAnimator-&gt;isScrollSnapInProgress())
-            return;
-    }
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    if (isScrollSnapInProgress())
+        return;
+
</ins><span class="cx">     IntPoint currentPosition = scrollPosition();
</span><span class="cx">     IntPoint correctedPosition = nearestActiveSnapPoint(currentPosition);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollableAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/platform/ScrollableArea.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -230,6 +230,7 @@
</span><span class="cx">     virtual IntRect scrollableAreaBoundingBox() const = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual bool isRubberBandInProgress() const { return false; }
</span><ins>+    virtual bool isScrollSnapInProgress() const { return false; }
</ins><span class="cx"> 
</span><span class="cx">     virtual bool scrollAnimatorEnabled() const { return false; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaScrollControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ScrollController.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx">     void setActiveScrollSnapIndexForAxis(ScrollEventAxis, unsigned);
</span><span class="cx">     bool activeScrollSnapIndexDidChange() const { return m_activeScrollSnapIndexDidChange; }
</span><span class="cx">     void setScrollSnapIndexDidChange(bool state) { m_activeScrollSnapIndexDidChange = state; }
</span><ins>+    bool hasActiveScrollSnapTimerForAxis(ScrollEventAxis) const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaScrollControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ScrollController.mm (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ScrollController.mm        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/platform/cocoa/ScrollController.mm        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -477,6 +477,11 @@
</span><span class="cx">     return (axis == ScrollEventAxis::Horizontal) ? *m_horizontalScrollSnapState : *m_verticalScrollSnapState;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ScrollController::hasActiveScrollSnapTimerForAxis(ScrollEventAxis axis) const
+{
+    return (axis == ScrollEventAxis::Horizontal) ? m_horizontalScrollSnapTimer.isActive() : m_verticalScrollSnapTimer.isActive();
+}
+
</ins><span class="cx"> static inline WheelEventStatus toWheelEventStatus(PlatformWheelEventPhase phase, PlatformWheelEventPhase momentumPhase)
</span><span class="cx"> {
</span><span class="cx">     if (phase == PlatformWheelEventPhaseNone) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -3204,6 +3204,17 @@
</span><span class="cx">     RenderBox* box = enclosingElement()-&gt;renderBox();
</span><span class="cx">     updateSnapOffsetsForScrollableArea(*this, *downcast&lt;HTMLElement&gt;(enclosingElement()), *box, box-&gt;style());
</span><span class="cx"> }
</span><ins>+
+bool RenderLayer::isScrollSnapInProgress() const
+{
+    if (!scrollsOverflow())
+        return false;
+    
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        return scrollAnimator-&gt;isScrollSnapInProgress();
+    
+    return false;
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003, 2009, 2012, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Portions are Copyright (C) 1998 Netscape Communications Corporation.
</span><span class="cx">  *
</span><span class="lines">@@ -877,6 +877,9 @@
</span><span class="cx">     virtual bool isRubberBandInProgress() const override;
</span><span class="cx">     virtual bool updatesScrollLayerPositionOnMainThread() const override { return true; }
</span><span class="cx">     virtual bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const override;
</span><ins>+#if ENABLE(CSS_SCROLL_SNAP)
+    bool isScrollSnapInProgress() const override;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     void registerAsTouchEventListenerForScrolling();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-05-19  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        REGRESSION(142590): Part 2: Scroll-snap points are improperly snapping to earlier index values (Scrolling Thread) 
+        https://bugs.webkit.org/show_bug.cgi?id=145175
+        &lt;rdar://problem/21023785&gt;
+
+        Reviewed by Beth Dakin.
+
+        Add a stub implementation of isScrollSnapInProgress to match ScrollingCoordinator signature.
+
+        * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
+        * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
+        (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress): Added stub.
+
</ins><span class="cx"> 2015-05-19  Jeremy Jones  &lt;jeremyj@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebVideoFullscreenManagerProxy has incorrect OS_VERSION_MIN_REQUIRED conditionals.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isRubberBandInProgress() const override;
</span><span class="cx">     virtual void setScrollPinningBehavior(WebCore::ScrollPinningBehavior) override;
</span><ins>+    bool isScrollSnapInProgress() const override;
</ins><span class="cx"> 
</span><span class="cx">     // IPC::MessageReceiver
</span><span class="cx">     virtual void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm (184595 => 184596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm        2015-05-19 21:52:15 UTC (rev 184595)
+++ trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm        2015-05-19 21:58:30 UTC (rev 184596)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -79,6 +79,12 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RemoteScrollingCoordinator::isScrollSnapInProgress() const
+{
+    // FIXME: need to maintain state in the web process?
+    return false;
+}
+
</ins><span class="cx"> void RemoteScrollingCoordinator::setScrollPinningBehavior(ScrollPinningBehavior)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: send to the UI process.
</span></span></pre>
</div>
</div>

</body>
</html>