<!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>[180447] trunk/Source/WebCore</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/180447">180447</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-02-20 12:50:48 -0800 (Fri, 20 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename ScrollElasticityController to ScrollController
https://bugs.webkit.org/show_bug.cgi?id=141842

Reviewed by Simon Fraser.

No change in functionality.

* PlatformMac.cmake:
* WebCore.order:
* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
(WebCore::ScrollingTreeFrameScrollingNodeMac::startSnapRubberbandTimer):
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::isRubberBandInProgress):
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
* platform/mac/ScrollController.h: Copied from WebCore/platform/mac/ScrollElasticityController.h.
(WebCore::ScrollControllerClient::~ScrollControllerClient):
(WebCore::ScrollElasticityControllerClient::~ScrollElasticityControllerClient): Deleted.
* platform/mac/ScrollController.mm: Copied from WebCore/platform/mac/ScrollElasticityController.mm.
(WebCore::ScrollController::ScrollController):
(WebCore::ScrollController::handleWheelEvent):
(WebCore::ScrollController::snapRubberBandTimerFired):
(WebCore::ScrollController::isRubberBandInProgress):
(WebCore::ScrollController::stopSnapRubberbandTimer):
(WebCore::ScrollController::snapRubberBand):
(WebCore::ScrollController::shouldRubberBandInHorizontalDirection):
(WebCore::ScrollElasticityController::ScrollElasticityController): Deleted.
(WebCore::ScrollElasticityController::handleWheelEvent): Deleted.
(WebCore::ScrollElasticityController::snapRubberBandTimerFired): Deleted.
(WebCore::ScrollElasticityController::isRubberBandInProgress): Deleted.
(WebCore::ScrollElasticityController::stopSnapRubberbandTimer): Deleted.
(WebCore::ScrollElasticityController::snapRubberBand): Deleted.
(WebCore::ScrollElasticityController::shouldRubberBandInHorizontalDirection): Deleted.
* platform/mac/ScrollElasticityController.h: Removed.
* platform/mac/ScrollElasticityController.mm: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCoreorder">trunk/Source/WebCore/WebCore.order</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</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="#trunkSourceWebCoreplatformmacScrollAnimatorMach">trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollAnimatorMacmm">trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmacScrollControllerh">trunk/Source/WebCore/platform/mac/ScrollController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollControllermm">trunk/Source/WebCore/platform/mac/ScrollController.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmacScrollElasticityControllerh">trunk/Source/WebCore/platform/mac/ScrollElasticityController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollElasticityControllermm">trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/ChangeLog        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2015-02-20  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        Rename ScrollElasticityController to ScrollController
+        https://bugs.webkit.org/show_bug.cgi?id=141842
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * PlatformMac.cmake:
+        * WebCore.order:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::startSnapRubberbandTimer):
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+        (WebCore::ScrollAnimatorMac::isRubberBandInProgress):
+        (WebCore::ScrollAnimatorMac::handleWheelEvent):
+        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+        * platform/mac/ScrollController.h: Copied from WebCore/platform/mac/ScrollElasticityController.h.
+        (WebCore::ScrollControllerClient::~ScrollControllerClient):
+        (WebCore::ScrollElasticityControllerClient::~ScrollElasticityControllerClient): Deleted.
+        * platform/mac/ScrollController.mm: Copied from WebCore/platform/mac/ScrollElasticityController.mm.
+        (WebCore::ScrollController::ScrollController):
+        (WebCore::ScrollController::handleWheelEvent):
+        (WebCore::ScrollController::snapRubberBandTimerFired):
+        (WebCore::ScrollController::isRubberBandInProgress):
+        (WebCore::ScrollController::stopSnapRubberbandTimer):
+        (WebCore::ScrollController::snapRubberBand):
+        (WebCore::ScrollController::shouldRubberBandInHorizontalDirection):
+        (WebCore::ScrollElasticityController::ScrollElasticityController): Deleted.
+        (WebCore::ScrollElasticityController::handleWheelEvent): Deleted.
+        (WebCore::ScrollElasticityController::snapRubberBandTimerFired): Deleted.
+        (WebCore::ScrollElasticityController::isRubberBandInProgress): Deleted.
+        (WebCore::ScrollElasticityController::stopSnapRubberbandTimer): Deleted.
+        (WebCore::ScrollElasticityController::snapRubberBand): Deleted.
+        (WebCore::ScrollElasticityController::shouldRubberBandInHorizontalDirection): Deleted.
+        * platform/mac/ScrollElasticityController.h: Removed.
+        * platform/mac/ScrollElasticityController.mm: Removed.
+
</ins><span class="cx"> 2015-02-20  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove svn:keywords property.
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/PlatformMac.cmake        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">     platform/mac/PurgeableBufferMac.cpp
</span><span class="cx">     platform/mac/SSLKeyGeneratorMac.cpp
</span><span class="cx">     platform/mac/ScrollAnimatorMac.mm
</span><del>-    platform/mac/ScrollElasticityController.mm
</del><ins>+    platform/mac/ScrollController.mm
</ins><span class="cx">     platform/mac/ScrollViewMac.mm
</span><span class="cx">     platform/mac/ScrollbarThemeMac.mm
</span><span class="cx">     platform/mac/SerializedPlatformRepresentationMac.mm
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreorder"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.order (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.order        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/WebCore.order        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -2007,7 +2007,7 @@
</span><span class="cx"> __ZN7WebCore14ScrollAnimator6createEPNS_14ScrollableAreaE
</span><span class="cx"> __ZN7WebCore17ScrollAnimatorMacC2EPNS_14ScrollableAreaE
</span><span class="cx"> __ZN7WebCore14ScrollAnimatorC2EPNS_14ScrollableAreaE
</span><del>-__ZN7WebCore26ScrollElasticityControllerC1EPNS_32ScrollElasticityControllerClientE
</del><ins>+__ZN7WebCore26ScrollControllerC1EPNS_32ScrollControllerClientE
</ins><span class="cx"> -[WebScrollAnimationHelperDelegate initWithScrollAnimator:]
</span><span class="cx"> -[WebScrollbarPainterControllerDelegate initWithScrollableArea:]
</span><span class="cx"> __ZN7WebCore17ScrollAnimatorMac23didAddVerticalScrollbarEPNS_9ScrollbarE
</span><span class="lines">@@ -2333,7 +2333,7 @@
</span><span class="cx"> __ZN7WebCore9FrameView23sendResizeEventIfNeededEv
</span><span class="cx"> __ZN7WebCore10ScrollView26invalidateScrollCornerRectERKNS_7IntRectE
</span><span class="cx"> __ZNK7WebCore17ScrollAnimatorMac22isRubberBandInProgressEv
</span><del>-__ZNK7WebCore26ScrollElasticityController22isRubberBandInProgressEv
</del><ins>+__ZNK7WebCore26ScrollController22isRubberBandInProgressEv
</ins><span class="cx"> __ZN7WebCore10ScrollView19updateOverhangAreasEv
</span><span class="cx"> __ZN7WebCore10ScrollView33calculateOverhangAreasForPaintingERNS_7IntRectES2_
</span><span class="cx"> __ZNK7WebCore6Chrome19contentsSizeChangedEPNS_5FrameERKNS_7IntSizeE
</span><span class="lines">@@ -12665,7 +12665,7 @@
</span><span class="cx"> __ZNK7WebCore6Widget17convertToRootViewERKNS_7IntRectE
</span><span class="cx"> __ZN7WebCore11RenderImage11nodeAtPointERKNS_14HitTestRequestERNS_13HitTestResultERKNS_15HitTestLocationERKNS_11LayoutPointENS_13HitTestActionE
</span><span class="cx"> __ZN7WebCore13ScrollingTree22updateBackForwardStateEbb
</span><del>-__ZN7WebCore26ScrollElasticityController16handleWheelEventERKNS_18PlatformWheelEventE
</del><ins>+__ZN7WebCore26ScrollController16handleWheelEventERKNS_18PlatformWheelEventE
</ins><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac17pinnedInDirectionERKNS_9FloatSizeE
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeMac17pinnedInDirectionERKNS_9FloatSizeE
</span><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac27shouldRubberBandInDirectionENS_15ScrollDirectionE
</span><span class="lines">@@ -12738,11 +12738,11 @@
</span><span class="cx"> __ZN7WebCore12EventHandler28fakeMouseMoveEventTimerFiredEPNS_5TimerIS0_EE
</span><span class="cx"> __ZN7WebCore21PlatformKeyboardEvent23getCurrentModifierStateERbS1_S1_S1_
</span><span class="cx"> __ZN7WebCore9Scrollbar19updateThumbPositionEv
</span><del>-__ZN7WebCore26ScrollElasticityController14snapRubberBandEv
</del><ins>+__ZN7WebCore26ScrollController14snapRubberBandEv
</ins><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac24startSnapRubberbandTimerEv
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeMac24startSnapRubberbandTimerEv
</span><span class="cx"> ____ZN7WebCore29ScrollingTreeScrollingNodeMac24startSnapRubberbandTimerEv_block_invoke
</span><del>-__ZN7WebCore26ScrollElasticityController24snapRubberBandTimerFiredEv
</del><ins>+__ZN7WebCore26ScrollController24snapRubberBandTimerFiredEv
</ins><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac22absoluteScrollPositionEv
</span><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac21canScrollHorizontallyEv
</span><span class="cx"> __ZThn112_N7WebCore29ScrollingTreeScrollingNodeMac19canScrollVerticallyEv
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -786,8 +786,8 @@
</span><span class="cx">                 1A927FD31416A15B003A83C8 /* npruntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A927FD01416A15B003A83C8 /* npruntime.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1A927FD41416A15B003A83C8 /* nptypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A927FD11416A15B003A83C8 /* nptypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1A98956B0AA78F80005EF5EF /* URLCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A98956A0AA78F80005EF5EF /* URLCF.cpp */; };
</span><del>-                1AA84F04143BA7BD0051D153 /* ScrollElasticityController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA84F02143BA7BD0051D153 /* ScrollElasticityController.mm */; };
-                1AA84F05143BA7BD0051D153 /* ScrollElasticityController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA84F03143BA7BD0051D153 /* ScrollElasticityController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                1AA84F04143BA7BD0051D153 /* ScrollController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA84F02143BA7BD0051D153 /* ScrollController.mm */; };
+                1AA84F05143BA7BD0051D153 /* ScrollController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA84F03143BA7BD0051D153 /* ScrollController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA8798F11CBE846003C664F /* PluginStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1AAADDA314DB409F00AF64B3 /* ScrollingTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */; };
</span><span class="cx">                 1AAADDA414DB409F00AF64B3 /* ScrollingTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -7795,8 +7795,8 @@
</span><span class="cx">                 1A927FD01416A15B003A83C8 /* npruntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = npruntime.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A927FD11416A15B003A83C8 /* nptypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nptypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A98956A0AA78F80005EF5EF /* URLCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = URLCF.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1AA84F02143BA7BD0051D153 /* ScrollElasticityController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollElasticityController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
-                1AA84F03143BA7BD0051D153 /* ScrollElasticityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollElasticityController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                1AA84F02143BA7BD0051D153 /* ScrollController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AA84F03143BA7BD0051D153 /* ScrollController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1AA8798F11CBE846003C664F /* PluginStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginStrategy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTree.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTree.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16551,8 +16551,8 @@
</span><span class="cx">                                 BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */,
</span><span class="cx">                                 BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */,
</span><span class="cx">                                 BCEF869E0E844E9D00A85CD5 /* ScrollbarThemeMac.mm */,
</span><del>-                                1AA84F03143BA7BD0051D153 /* ScrollElasticityController.h */,
-                                1AA84F02143BA7BD0051D153 /* ScrollElasticityController.mm */,
</del><ins>+                                1AA84F03143BA7BD0051D153 /* ScrollController.h */,
+                                1AA84F02143BA7BD0051D153 /* ScrollController.mm */,
</ins><span class="cx">                                 9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */,
</span><span class="cx">                                 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */,
</span><span class="cx">                                 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */,
</span><span class="lines">@@ -26048,7 +26048,7 @@
</span><span class="cx">                                 BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */,
</span><span class="cx">                                 0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */,
</span><span class="cx">                                 5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */,
</span><del>-                                1AA84F05143BA7BD0051D153 /* ScrollElasticityController.h in Headers */,
</del><ins>+                                1AA84F05143BA7BD0051D153 /* ScrollController.h in Headers */,
</ins><span class="cx">                                 0F605AED15F94848004DF0C0 /* ScrollingConstraints.h in Headers */,
</span><span class="cx">                                 1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */,
</span><span class="cx">                                 0FC4E40D187F82E10045882C /* ScrollingCoordinatorIOS.h in Headers */,
</span><span class="lines">@@ -29450,7 +29450,7 @@
</span><span class="cx">                                 BCEF869F0E844E9D00A85CD5 /* ScrollbarThemeMac.mm in Sources */,
</span><span class="cx">                                 0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */,
</span><span class="cx">                                 5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */,
</span><del>-                                1AA84F04143BA7BD0051D153 /* ScrollElasticityController.mm in Sources */,
</del><ins>+                                1AA84F04143BA7BD0051D153 /* ScrollController.mm in Sources */,
</ins><span class="cx">                                 0F605AEC15F94848004DF0C0 /* ScrollingConstraints.cpp in Sources */,
</span><span class="cx">                                 1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */,
</span><span class="cx">                                 0FC4E40E187F82E10045882C /* ScrollingCoordinatorIOS.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING) &amp;&amp; PLATFORM(MAC)
</span><span class="cx"> 
</span><del>-#include &quot;ScrollElasticityController.h&quot;
</del><ins>+#include &quot;ScrollController.h&quot;
</ins><span class="cx"> #include &quot;ScrollbarThemeMac.h&quot;
</span><span class="cx"> #include &quot;ScrollingTreeFrameScrollingNode.h&quot;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class ScrollingTreeFrameScrollingNodeMac : public ScrollingTreeFrameScrollingNode, private ScrollElasticityControllerClient {
</del><ins>+class ScrollingTreeFrameScrollingNodeMac : public ScrollingTreeFrameScrollingNode, private ScrollControllerClient {
</ins><span class="cx"> public:
</span><span class="cx">     WEBCORE_EXPORT static PassRefPtr&lt;ScrollingTreeFrameScrollingNode&gt; create(ScrollingTree&amp;, ScrollingNodeID);
</span><span class="cx">     virtual ~ScrollingTreeFrameScrollingNodeMac();
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     virtual void updateAfterChildren(const ScrollingStateNode&amp;) override;
</span><span class="cx">     virtual void handleWheelEvent(const PlatformWheelEvent&amp;) override;
</span><span class="cx"> 
</span><del>-    // ScrollElasticityController member functions.
</del><ins>+    // ScrollController member functions.
</ins><span class="cx">     virtual bool allowsHorizontalStretching(const PlatformWheelEvent&amp;) override;
</span><span class="cx">     virtual bool allowsVerticalStretching(const PlatformWheelEvent&amp;) override;
</span><span class="cx">     virtual IntSize stretchAmount() override;
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> 
</span><span class="cx">     void logExposedUnfilledArea();
</span><span class="cx"> 
</span><del>-    ScrollElasticityController m_scrollElasticityController;
</del><ins>+    ScrollController m_scrollController;
</ins><span class="cx">     RetainPtr&lt;CFRunLoopTimerRef&gt; m_snapRubberbandTimer;
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CALayer&gt; m_scrollLayer;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFrameScrollingNodeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> 
</span><span class="cx"> ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac(ScrollingTree&amp; scrollingTree, ScrollingNodeID nodeID)
</span><span class="cx">     : ScrollingTreeFrameScrollingNode(scrollingTree, nodeID)
</span><del>-    , m_scrollElasticityController(this)
</del><ins>+    , m_scrollController(this)
</ins><span class="cx">     , m_verticalScrollbarPainter(0)
</span><span class="cx">     , m_horizontalScrollbarPainter(0)
</span><span class="cx">     , m_lastScrollHadUnfilledPixels(false)
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx">         [m_horizontalScrollbarPainter setUsePresentationValue:NO];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_scrollElasticityController.handleWheelEvent(wheelEvent);
</del><ins>+    m_scrollController.handleWheelEvent(wheelEvent);
</ins><span class="cx">     scrollingTree().setOrClearLatchedNode(wheelEvent, scrollingNodeID());
</span><span class="cx">     scrollingTree().handleWheelEventPhase(wheelEvent.phase());
</span><span class="cx"> }
</span><span class="lines">@@ -303,7 +303,7 @@
</span><span class="cx">     CFTimeInterval timerInterval = 1.0 / 60.0;
</span><span class="cx"> 
</span><span class="cx">     m_snapRubberbandTimer = adoptCF(CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + timerInterval, timerInterval, 0, 0, ^(CFRunLoopTimerRef) {
</span><del>-        m_scrollElasticityController.snapRubberBandTimerFired();
</del><ins>+        m_scrollController.snapRubberBandTimerFired();
</ins><span class="cx">     }));
</span><span class="cx">     CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_snapRubberbandTimer.get(), kCFRunLoopDefaultMode);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollAnimatorMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2011, 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">@@ -32,7 +32,7 @@
</span><span class="cx"> #include &quot;FloatPoint.h&quot;
</span><span class="cx"> #include &quot;FloatSize.h&quot;
</span><span class="cx"> #include &quot;ScrollAnimator.h&quot;
</span><del>-#include &quot;ScrollElasticityController.h&quot;
</del><ins>+#include &quot;ScrollController.h&quot;
</ins><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -43,14 +43,14 @@
</span><span class="cx"> typedef id ScrollbarPainterController;
</span><span class="cx"> 
</span><span class="cx"> #if !ENABLE(RUBBER_BANDING)
</span><del>-class ScrollElasticityControllerClient { };
</del><ins>+class ScrollControllerClient { };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Scrollbar;
</span><span class="cx"> 
</span><del>-class ScrollAnimatorMac : public ScrollAnimator, private ScrollElasticityControllerClient {
</del><ins>+class ScrollAnimatorMac : public ScrollAnimator, private ScrollControllerClient {
</ins><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     ScrollAnimatorMac(ScrollableArea*);
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">     virtual bool isRubberBandInProgress() const override;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(RUBBER_BANDING)
</span><del>-    /// ScrollElasticityControllerClient member functions.
</del><ins>+    /// ScrollControllerClient member functions.
</ins><span class="cx">     virtual IntSize stretchAmount() override;
</span><span class="cx">     virtual bool allowsHorizontalStretching(const PlatformWheelEvent&amp;) override;
</span><span class="cx">     virtual bool allowsVerticalStretching(const PlatformWheelEvent&amp;) override;
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent&amp;, ScrollEventAxis);
</span><span class="cx"> 
</span><del>-    ScrollElasticityController m_scrollElasticityController;
</del><ins>+    ScrollController m_scrollController;
</ins><span class="cx">     Timer m_snapRubberBandTimer;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollAnimatorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -644,7 +644,7 @@
</span><span class="cx">     , m_initialScrollbarPaintTimer(*this, &amp;ScrollAnimatorMac::initialScrollbarPaintTimerFired)
</span><span class="cx">     , m_sendContentAreaScrolledTimer(*this, &amp;ScrollAnimatorMac::sendContentAreaScrolledTimerFired)
</span><span class="cx"> #if ENABLE(RUBBER_BANDING)
</span><del>-    , m_scrollElasticityController(this)
</del><ins>+    , m_scrollController(this)
</ins><span class="cx">     , m_snapRubberBandTimer(*this, &amp;ScrollAnimatorMac::snapRubberBandTimerFired)
</span><span class="cx"> #endif
</span><span class="cx">     , m_haveScrolledSincePageLoad(false)
</span><span class="lines">@@ -770,7 +770,7 @@
</span><span class="cx"> #if !ENABLE(RUBBER_BANDING)
</span><span class="cx">     return false;
</span><span class="cx"> #else
</span><del>-    return m_scrollElasticityController.isRubberBandInProgress();
</del><ins>+    return m_scrollController.isRubberBandInProgress();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1098,7 +1098,7 @@
</span><span class="cx">             return ScrollAnimator::handleWheelEvent(wheelEvent);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool didHandleEvent = m_scrollElasticityController.handleWheelEvent(wheelEvent);
</del><ins>+    bool didHandleEvent = m_scrollController.handleWheelEvent(wheelEvent);
</ins><span class="cx"> 
</span><span class="cx">     if (didHandleEvent)
</span><span class="cx">         handleWheelEventPhase(wheelEvent.phase());
</span><span class="lines">@@ -1283,7 +1283,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollAnimatorMac::snapRubberBandTimerFired()
</span><span class="cx"> {
</span><del>-    m_scrollElasticityController.snapRubberBandTimerFired();
</del><ins>+    m_scrollController.snapRubberBandTimerFired();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollControllerhfromrev180420trunkSourceWebCoreplatformmacScrollElasticityControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/mac/ScrollController.h (from rev 180420, trunk/Source/WebCore/platform/mac/ScrollElasticityController.h) (0 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollController.h                                (rev 0)
+++ trunk/Source/WebCore/platform/mac/ScrollController.h        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollController_h
+#define ScrollController_h
+
+#if ENABLE(RUBBER_BANDING)
+
+#include &quot;FloatPoint.h&quot;
+#include &quot;FloatSize.h&quot;
+#include &quot;ScrollTypes.h&quot;
+#include &lt;wtf/Noncopyable.h&gt;
+
+namespace WebCore {
+
+class PlatformWheelEvent;
+
+class ScrollControllerClient {
+protected:
+    virtual ~ScrollControllerClient() { }
+
+public:
+    virtual bool allowsHorizontalStretching(const PlatformWheelEvent&amp;) = 0;
+    virtual bool allowsVerticalStretching(const PlatformWheelEvent&amp;) = 0;
+    virtual IntSize stretchAmount() = 0;
+    virtual bool pinnedInDirection(const FloatSize&amp;) = 0;
+    virtual bool canScrollHorizontally() = 0;
+    virtual bool canScrollVertically() = 0;
+    virtual bool shouldRubberBandInDirection(ScrollDirection) = 0;
+
+    // Return the absolute scroll position, not relative to the scroll origin.
+    virtual WebCore::IntPoint absoluteScrollPosition() = 0;
+
+    virtual void immediateScrollBy(const FloatSize&amp;) = 0;
+    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&amp;) = 0;
+    virtual void startSnapRubberbandTimer() = 0;
+    virtual void stopSnapRubberbandTimer() = 0;
+
+    // If the current scroll position is within the overhang area, this function will cause
+    // the page to scroll to the nearest boundary point.
+    virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
+};
+
+class ScrollController {
+    WTF_MAKE_NONCOPYABLE(ScrollController);
+
+public:
+    explicit ScrollController(ScrollControllerClient*);
+
+    bool handleWheelEvent(const PlatformWheelEvent&amp;);
+    void snapRubberBandTimerFired();
+
+    bool isRubberBandInProgress() const;
+
+private:
+    void stopSnapRubberbandTimer();
+    void snapRubberBand();
+
+    bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&amp;);
+
+    ScrollControllerClient* m_client;
+
+    bool m_inScrollGesture;
+    bool m_momentumScrollInProgress;
+    bool m_ignoreMomentumScrolls;
+    
+    CFTimeInterval m_lastMomentumScrollTimestamp;
+    FloatSize m_overflowScrollDelta;
+    FloatSize m_stretchScrollForce;
+    FloatSize m_momentumVelocity;
+
+    // Rubber band state.
+    CFTimeInterval m_startTime;
+    FloatSize m_startStretch;
+    FloatPoint m_origOrigin;
+    FloatSize m_origVelocity;
+
+    bool m_snapRubberbandTimerIsActive;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(RUBBER_BANDING)
+
+#endif // ScrollController_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollControllermmfromrev180420trunkSourceWebCoreplatformmacScrollElasticityControllermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/mac/ScrollController.mm (from rev 180420, trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm) (0 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollController.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/mac/ScrollController.mm        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -0,0 +1,406 @@
</span><ins>+/*
+ * Copyright (C) 2011, 2014-2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ScrollController.h&quot;
+
+#include &quot;PlatformWheelEvent.h&quot;
+#include &quot;WebCoreSystemInterface.h&quot;
+#include &lt;sys/sysctl.h&gt;
+#include &lt;sys/time.h&gt;
+
+#if ENABLE(RUBBER_BANDING)
+
+static NSTimeInterval systemUptime()
+{
+    if ([[NSProcessInfo processInfo] respondsToSelector:@selector(systemUptime)])
+        return [[NSProcessInfo processInfo] systemUptime];
+
+    // Get how long system has been up. Found by looking getting &quot;boottime&quot; from the kernel.
+    static struct timeval boottime = {0, 0};
+    if (!boottime.tv_sec) {
+        int mib[2] = {CTL_KERN, KERN_BOOTTIME};
+        size_t size = sizeof(boottime);
+        if (-1 == sysctl(mib, 2, &amp;boottime, &amp;size, 0, 0))
+            boottime.tv_sec = 0;
+    }
+    struct timeval now;
+    if (boottime.tv_sec &amp;&amp; -1 != gettimeofday(&amp;now, 0)) {
+        struct timeval uptime;
+        timersub(&amp;now, &amp;boottime, &amp;uptime);
+        NSTimeInterval result = uptime.tv_sec + (uptime.tv_usec / 1E+6);
+        return result;
+    }
+    return 0;
+}
+
+
+namespace WebCore {
+
+static const float scrollVelocityZeroingTimeout = 0.10f;
+static const float rubberbandDirectionLockStretchRatio = 1;
+static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10;
+
+static float elasticDeltaForTimeDelta(float initialPosition, float initialVelocity, float elapsedTime)
+{
+    return wkNSElasticDeltaForTimeDelta(initialPosition, initialVelocity, elapsedTime);
+}
+
+static float elasticDeltaForReboundDelta(float delta)
+{
+    return wkNSElasticDeltaForReboundDelta(delta);
+}
+
+static float reboundDeltaForElasticDelta(float delta)
+{
+    return wkNSReboundDeltaForElasticDelta(delta);
+}
+
+static float scrollWheelMultiplier()
+{
+    static float multiplier = -1;
+    if (multiplier &lt; 0) {
+        multiplier = [[NSUserDefaults standardUserDefaults] floatForKey:@&quot;NSScrollWheelMultiplier&quot;];
+        if (multiplier &lt;= 0)
+            multiplier = 1;
+    }
+    return multiplier;
+}
+
+ScrollController::ScrollController(ScrollControllerClient* client)
+    : m_client(client)
+    , m_inScrollGesture(false)
+    , m_momentumScrollInProgress(false)
+    , m_ignoreMomentumScrolls(false)
+    , m_lastMomentumScrollTimestamp(0)
+    , m_startTime(0)
+    , m_snapRubberbandTimerIsActive(false)
+{
+}
+
+bool ScrollController::handleWheelEvent(const PlatformWheelEvent&amp; wheelEvent)
+{
+    if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
+        // First, check if we should rubber-band at all.
+        if (m_client-&gt;pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0))
+            &amp;&amp; !shouldRubberBandInHorizontalDirection(wheelEvent))
+            return false;
+
+        m_inScrollGesture = true;
+        m_momentumScrollInProgress = false;
+        m_ignoreMomentumScrolls = false;
+        m_lastMomentumScrollTimestamp = 0;
+        m_momentumVelocity = FloatSize();
+
+        IntSize stretchAmount = m_client-&gt;stretchAmount();
+        m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width()));
+        m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height()));
+        m_overflowScrollDelta = FloatSize();
+
+        stopSnapRubberbandTimer();
+
+        return true;
+    }
+
+    if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) {
+        snapRubberBand();
+        return true;
+    }
+
+    bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
+    if (m_ignoreMomentumScrolls &amp;&amp; (isMomentumScrollEvent || m_snapRubberbandTimerIsActive)) {
+        if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
+            m_ignoreMomentumScrolls = false;
+            return true;
+        }
+        return false;
+    }
+
+    float deltaX = m_overflowScrollDelta.width();
+    float deltaY = m_overflowScrollDelta.height();
+
+    // Reset overflow values because we may decide to remove delta at various points and put it into overflow.
+    m_overflowScrollDelta = FloatSize();
+
+    IntSize stretchAmount = m_client-&gt;stretchAmount();
+    bool isVerticallyStretched = stretchAmount.height();
+    bool isHorizontallyStretched = stretchAmount.width();
+
+    float eventCoalescedDeltaX;
+    float eventCoalescedDeltaY;
+
+    if (isVerticallyStretched || isHorizontallyStretched) {
+        eventCoalescedDeltaX = -wheelEvent.unacceleratedScrollingDeltaX();
+        eventCoalescedDeltaY = -wheelEvent.unacceleratedScrollingDeltaY();
+    } else {
+        eventCoalescedDeltaX = -wheelEvent.deltaX();
+        eventCoalescedDeltaY = -wheelEvent.deltaY();
+    }
+
+    deltaX += eventCoalescedDeltaX;
+    deltaY += eventCoalescedDeltaY;
+
+    // Slightly prefer scrolling vertically by applying the = case to deltaY
+    if (fabsf(deltaY) &gt;= fabsf(deltaX))
+        deltaX = 0;
+    else
+        deltaY = 0;
+
+    bool shouldStretch = false;
+
+    PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase();
+
+    // If we are starting momentum scrolling then do some setup.
+    if (!m_momentumScrollInProgress &amp;&amp; (momentumPhase == PlatformWheelEventPhaseBegan || momentumPhase == PlatformWheelEventPhaseChanged))
+        m_momentumScrollInProgress = true;
+
+    CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomentumScrollTimestamp;
+    if (m_inScrollGesture || m_momentumScrollInProgress) {
+        if (m_lastMomentumScrollTimestamp &amp;&amp; timeDelta &gt; 0 &amp;&amp; timeDelta &lt; scrollVelocityZeroingTimeout) {
+            m_momentumVelocity.setWidth(eventCoalescedDeltaX / (float)timeDelta);
+            m_momentumVelocity.setHeight(eventCoalescedDeltaY / (float)timeDelta);
+            m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
+        } else {
+            m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
+            m_momentumVelocity = FloatSize();
+        }
+
+        if (isVerticallyStretched) {
+            if (!isHorizontallyStretched &amp;&amp; m_client-&gt;pinnedInDirection(FloatSize(deltaX, 0))) {
+                // Stretching only in the vertical.
+                if (deltaY &amp;&amp; (fabsf(deltaX / deltaY) &lt; rubberbandDirectionLockStretchRatio))
+                    deltaX = 0;
+                else if (fabsf(deltaX) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
+                    m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
+                    deltaX = 0;
+                } else
+                    m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
+            }
+        } else if (isHorizontallyStretched) {
+            // Stretching only in the horizontal.
+            if (m_client-&gt;pinnedInDirection(FloatSize(0, deltaY))) {
+                if (deltaX &amp;&amp; (fabsf(deltaY / deltaX) &lt; rubberbandDirectionLockStretchRatio))
+                    deltaY = 0;
+                else if (fabsf(deltaY) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
+                    m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY);
+                    deltaY = 0;
+                } else
+                    m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY);
+            }
+        } else {
+            // Not stretching at all yet.
+            if (m_client-&gt;pinnedInDirection(FloatSize(deltaX, deltaY))) {
+                if (fabsf(deltaY) &gt;= fabsf(deltaX)) {
+                    if (fabsf(deltaX) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
+                        m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
+                        deltaX = 0;
+                    } else
+                        m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
+                }
+                shouldStretch = true;
+            }
+        }
+    }
+
+    if (deltaX || deltaY) {
+        if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) {
+            if (deltaY) {
+                deltaY *= scrollWheelMultiplier();
+                m_client-&gt;immediateScrollBy(FloatSize(0, deltaY));
+            }
+            if (deltaX) {
+                deltaX *= scrollWheelMultiplier();
+                m_client-&gt;immediateScrollBy(FloatSize(deltaX, 0));
+            }
+        } else {
+            if (!m_client-&gt;allowsHorizontalStretching(wheelEvent)) {
+                deltaX = 0;
+                eventCoalescedDeltaX = 0;
+            } else if (deltaX &amp;&amp; !isHorizontallyStretched &amp;&amp; !m_client-&gt;pinnedInDirection(FloatSize(deltaX, 0))) {
+                deltaX *= scrollWheelMultiplier();
+
+                m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
+                deltaX = 0;
+            }
+
+            if (!m_client-&gt;allowsVerticalStretching(wheelEvent)) {
+                deltaY = 0;
+                eventCoalescedDeltaY = 0;
+            } else if (deltaY &amp;&amp; !isVerticallyStretched &amp;&amp; !m_client-&gt;pinnedInDirection(FloatSize(0, deltaY))) {
+                deltaY *= scrollWheelMultiplier();
+
+                m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
+                deltaY = 0;
+            }
+
+            IntSize stretchAmount = m_client-&gt;stretchAmount();
+
+            if (m_momentumScrollInProgress) {
+                if ((m_client-&gt;pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) &lt;= 0)) &amp;&amp; m_lastMomentumScrollTimestamp) {
+                    m_ignoreMomentumScrolls = true;
+                    m_momentumScrollInProgress = false;
+                    snapRubberBand();
+                }
+            }
+
+            m_stretchScrollForce.setWidth(m_stretchScrollForce.width() + deltaX);
+            m_stretchScrollForce.setHeight(m_stretchScrollForce.height() + deltaY);
+
+            FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.height())));
+
+            m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
+        }
+    }
+
+    if (m_momentumScrollInProgress &amp;&amp; momentumPhase == PlatformWheelEventPhaseEnded) {
+        m_momentumScrollInProgress = false;
+        m_ignoreMomentumScrolls = false;
+        m_lastMomentumScrollTimestamp = 0;
+    }
+
+    return true;
+}
+
+static inline float roundTowardZero(float num)
+{
+    return num &gt; 0 ? ceilf(num - 0.5f) : floorf(num + 0.5f);
+}
+
+static inline float roundToDevicePixelTowardZero(float num)
+{
+    float roundedNum = roundf(num);
+    if (fabs(num - roundedNum) &lt; 0.125)
+        num = roundedNum;
+
+    return roundTowardZero(num);
+}
+
+void ScrollController::snapRubberBandTimerFired()
+{
+    if (!m_momentumScrollInProgress || m_ignoreMomentumScrolls) {
+        CFTimeInterval timeDelta = [NSDate timeIntervalSinceReferenceDate] - m_startTime;
+
+        if (m_startStretch == FloatSize()) {
+            m_startStretch = m_client-&gt;stretchAmount();
+            if (m_startStretch == FloatSize()) {
+                stopSnapRubberbandTimer();
+
+                m_stretchScrollForce = FloatSize();
+                m_startTime = 0;
+                m_startStretch = FloatSize();
+                m_origOrigin = FloatPoint();
+                m_origVelocity = FloatSize();
+                return;
+            }
+
+            m_origOrigin = m_client-&gt;absoluteScrollPosition() - m_startStretch;
+            m_origVelocity = m_momentumVelocity;
+
+            // Just like normal scrolling, prefer vertical rubberbanding
+            if (fabsf(m_origVelocity.height()) &gt;= fabsf(m_origVelocity.width()))
+                m_origVelocity.setWidth(0);
+
+            // Don't rubber-band horizontally if it's not possible to scroll horizontally
+            if (!m_client-&gt;canScrollHorizontally())
+                m_origVelocity.setWidth(0);
+
+            // Don't rubber-band vertically if it's not possible to scroll vertically
+            if (!m_client-&gt;canScrollVertically())
+                m_origVelocity.setHeight(0);
+        }
+
+        FloatPoint delta(roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), (float)timeDelta)),
+            roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), (float)timeDelta)));
+
+        if (fabs(delta.x()) &gt;= 1 || fabs(delta.y()) &gt;= 1) {
+            m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client-&gt;stretchAmount());
+
+            FloatSize newStretch = m_client-&gt;stretchAmount();
+
+            m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
+            m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
+        } else {
+            m_client-&gt;adjustScrollPositionToBoundsIfNecessary();
+
+            stopSnapRubberbandTimer();
+            m_stretchScrollForce = FloatSize();
+            m_startTime = 0;
+            m_startStretch = FloatSize();
+            m_origOrigin = FloatPoint();
+            m_origVelocity = FloatSize();
+        }
+    } else {
+        m_startTime = [NSDate timeIntervalSinceReferenceDate];
+        m_startStretch = FloatSize();
+    }
+}
+
+bool ScrollController::isRubberBandInProgress() const
+{
+    if (!m_inScrollGesture &amp;&amp; !m_momentumScrollInProgress &amp;&amp; !m_snapRubberbandTimerIsActive)
+        return false;
+
+    return !m_client-&gt;stretchAmount().isZero();
+}
+
+void ScrollController::stopSnapRubberbandTimer()
+{
+    m_client-&gt;stopSnapRubberbandTimer();
+    m_snapRubberbandTimerIsActive = false;
+}
+
+void ScrollController::snapRubberBand()
+{
+    CFTimeInterval timeDelta = systemUptime() - m_lastMomentumScrollTimestamp;
+    if (m_lastMomentumScrollTimestamp &amp;&amp; timeDelta &gt;= scrollVelocityZeroingTimeout)
+        m_momentumVelocity = FloatSize();
+
+    m_inScrollGesture = false;
+
+    if (m_snapRubberbandTimerIsActive)
+        return;
+
+    m_startTime = [NSDate timeIntervalSinceReferenceDate];
+    m_startStretch = FloatSize();
+    m_origOrigin = FloatPoint();
+    m_origVelocity = FloatSize();
+
+    m_client-&gt;startSnapRubberbandTimer();
+    m_snapRubberbandTimerIsActive = true;
+}
+
+bool ScrollController::shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&amp; wheelEvent)
+{
+    if (wheelEvent.deltaX() &gt; 0)
+        return m_client-&gt;shouldRubberBandInDirection(ScrollLeft);
+    if (wheelEvent.deltaX() &lt; 0)
+        return m_client-&gt;shouldRubberBandInDirection(ScrollRight);
+
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(RUBBER_BANDING)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollElasticityControllerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/ScrollElasticityController.h (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.h        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.h        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -1,107 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScrollElasticityController_h
-#define ScrollElasticityController_h
-
-#if ENABLE(RUBBER_BANDING)
-
-#include &quot;FloatPoint.h&quot;
-#include &quot;FloatSize.h&quot;
-#include &quot;ScrollTypes.h&quot;
-#include &lt;wtf/Noncopyable.h&gt;
-
-namespace WebCore {
-
-class PlatformWheelEvent;
-
-class ScrollElasticityControllerClient {
-protected:
-    virtual ~ScrollElasticityControllerClient() { } 
-
-public:
-    virtual bool allowsHorizontalStretching(const PlatformWheelEvent&amp;) = 0;
-    virtual bool allowsVerticalStretching(const PlatformWheelEvent&amp;) = 0;
-    virtual IntSize stretchAmount() = 0;
-    virtual bool pinnedInDirection(const FloatSize&amp;) = 0;
-    virtual bool canScrollHorizontally() = 0;
-    virtual bool canScrollVertically() = 0;
-    virtual bool shouldRubberBandInDirection(ScrollDirection) = 0;
-
-    // Return the absolute scroll position, not relative to the scroll origin.
-    virtual WebCore::IntPoint absoluteScrollPosition() = 0;
-
-    virtual void immediateScrollBy(const FloatSize&amp;) = 0;
-    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&amp;) = 0;
-    virtual void startSnapRubberbandTimer() = 0;
-    virtual void stopSnapRubberbandTimer() = 0;
-
-    // If the current scroll position is within the overhang area, this function will cause
-    // the page to scroll to the nearest boundary point.
-    virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
-};
-
-class ScrollElasticityController {
-    WTF_MAKE_NONCOPYABLE(ScrollElasticityController);
-
-public:
-    explicit ScrollElasticityController(ScrollElasticityControllerClient*);
-
-    bool handleWheelEvent(const PlatformWheelEvent&amp;);
-    void snapRubberBandTimerFired();
-
-    bool isRubberBandInProgress() const;
-
-private:
-    void stopSnapRubberbandTimer();
-    void snapRubberBand();
-
-    bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&amp;);
-
-    ScrollElasticityControllerClient* m_client;
-
-    bool m_inScrollGesture;
-    bool m_momentumScrollInProgress;
-    bool m_ignoreMomentumScrolls;
-    
-    CFTimeInterval m_lastMomentumScrollTimestamp;
-    FloatSize m_overflowScrollDelta;
-    FloatSize m_stretchScrollForce;
-    FloatSize m_momentumVelocity;
-
-    // Rubber band state.
-    CFTimeInterval m_startTime;
-    FloatSize m_startStretch;
-    FloatPoint m_origOrigin;
-    FloatSize m_origVelocity;
-
-    bool m_snapRubberbandTimerIsActive;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(RUBBER_BANDING)
-
-#endif // ScrollElasticityController_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollElasticityControllermm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm (180446 => 180447)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm        2015-02-20 20:41:22 UTC (rev 180446)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm        2015-02-20 20:50:48 UTC (rev 180447)
</span><span class="lines">@@ -1,406 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ScrollElasticityController.h&quot;
-
-#include &quot;PlatformWheelEvent.h&quot;
-#include &quot;WebCoreSystemInterface.h&quot;
-#include &lt;sys/time.h&gt;
-#include &lt;sys/sysctl.h&gt;
-
-#if ENABLE(RUBBER_BANDING)
-
-static NSTimeInterval systemUptime()
-{
-    if ([[NSProcessInfo processInfo] respondsToSelector:@selector(systemUptime)])
-        return [[NSProcessInfo processInfo] systemUptime];
-
-    // Get how long system has been up. Found by looking getting &quot;boottime&quot; from the kernel.
-    static struct timeval boottime = {0, 0};
-    if (!boottime.tv_sec) {
-        int mib[2] = {CTL_KERN, KERN_BOOTTIME};
-        size_t size = sizeof(boottime);
-        if (-1 == sysctl(mib, 2, &amp;boottime, &amp;size, 0, 0))
-            boottime.tv_sec = 0;
-    }
-    struct timeval now;
-    if (boottime.tv_sec &amp;&amp; -1 != gettimeofday(&amp;now, 0)) {
-        struct timeval uptime;
-        timersub(&amp;now, &amp;boottime, &amp;uptime);
-        NSTimeInterval result = uptime.tv_sec + (uptime.tv_usec / 1E+6);
-        return result;
-    }
-    return 0;
-}
-
-
-namespace WebCore {
-
-static const float scrollVelocityZeroingTimeout = 0.10f;
-static const float rubberbandDirectionLockStretchRatio = 1;
-static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10;
-
-static float elasticDeltaForTimeDelta(float initialPosition, float initialVelocity, float elapsedTime)
-{
-    return wkNSElasticDeltaForTimeDelta(initialPosition, initialVelocity, elapsedTime);
-}
-
-static float elasticDeltaForReboundDelta(float delta)
-{
-    return wkNSElasticDeltaForReboundDelta(delta);
-}
-
-static float reboundDeltaForElasticDelta(float delta)
-{
-    return wkNSReboundDeltaForElasticDelta(delta);
-}
-
-static float scrollWheelMultiplier()
-{
-    static float multiplier = -1;
-    if (multiplier &lt; 0) {
-        multiplier = [[NSUserDefaults standardUserDefaults] floatForKey:@&quot;NSScrollWheelMultiplier&quot;];
-        if (multiplier &lt;= 0)
-            multiplier = 1;
-    }
-    return multiplier;
-}
-
-ScrollElasticityController::ScrollElasticityController(ScrollElasticityControllerClient* client)
-    : m_client(client)
-    , m_inScrollGesture(false)
-    , m_momentumScrollInProgress(false)
-    , m_ignoreMomentumScrolls(false)
-    , m_lastMomentumScrollTimestamp(0)
-    , m_startTime(0)
-    , m_snapRubberbandTimerIsActive(false)
-{
-}
-
-bool ScrollElasticityController::handleWheelEvent(const PlatformWheelEvent&amp; wheelEvent)
-{
-    if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
-        // First, check if we should rubber-band at all.
-        if (m_client-&gt;pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0)) &amp;&amp;
-            !shouldRubberBandInHorizontalDirection(wheelEvent))
-            return false;
-
-        m_inScrollGesture = true;
-        m_momentumScrollInProgress = false;
-        m_ignoreMomentumScrolls = false;
-        m_lastMomentumScrollTimestamp = 0;
-        m_momentumVelocity = FloatSize();
-
-        IntSize stretchAmount = m_client-&gt;stretchAmount();
-        m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width()));
-        m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height()));
-        m_overflowScrollDelta = FloatSize();
-
-        stopSnapRubberbandTimer();
-
-        return true;
-    }
-
-    if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) {
-        snapRubberBand();
-        return true;
-    }
-
-    bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
-    if (m_ignoreMomentumScrolls &amp;&amp; (isMomentumScrollEvent || m_snapRubberbandTimerIsActive)) {
-        if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
-            m_ignoreMomentumScrolls = false;
-            return true;
-        }
-        return false;
-    }
-
-    float deltaX = m_overflowScrollDelta.width();
-    float deltaY = m_overflowScrollDelta.height();
-
-    // Reset overflow values because we may decide to remove delta at various points and put it into overflow.
-    m_overflowScrollDelta = FloatSize();
-
-    IntSize stretchAmount = m_client-&gt;stretchAmount();
-    bool isVerticallyStretched = stretchAmount.height();
-    bool isHorizontallyStretched = stretchAmount.width();
-
-    float eventCoalescedDeltaX;
-    float eventCoalescedDeltaY;
-
-    if (isVerticallyStretched || isHorizontallyStretched) {
-        eventCoalescedDeltaX = -wheelEvent.unacceleratedScrollingDeltaX();
-        eventCoalescedDeltaY = -wheelEvent.unacceleratedScrollingDeltaY();
-    } else {
-        eventCoalescedDeltaX = -wheelEvent.deltaX();
-        eventCoalescedDeltaY = -wheelEvent.deltaY();
-    }
-
-    deltaX += eventCoalescedDeltaX;
-    deltaY += eventCoalescedDeltaY;
-
-    // Slightly prefer scrolling vertically by applying the = case to deltaY
-    if (fabsf(deltaY) &gt;= fabsf(deltaX))
-        deltaX = 0;
-    else
-        deltaY = 0;
-
-    bool shouldStretch = false;
-
-    PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase();
-
-    // If we are starting momentum scrolling then do some setup.
-    if (!m_momentumScrollInProgress &amp;&amp; (momentumPhase == PlatformWheelEventPhaseBegan || momentumPhase == PlatformWheelEventPhaseChanged))
-        m_momentumScrollInProgress = true;
-
-    CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomentumScrollTimestamp;
-    if (m_inScrollGesture || m_momentumScrollInProgress) {
-        if (m_lastMomentumScrollTimestamp &amp;&amp; timeDelta &gt; 0 &amp;&amp; timeDelta &lt; scrollVelocityZeroingTimeout) {
-            m_momentumVelocity.setWidth(eventCoalescedDeltaX / (float)timeDelta);
-            m_momentumVelocity.setHeight(eventCoalescedDeltaY / (float)timeDelta);
-            m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
-        } else {
-            m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
-            m_momentumVelocity = FloatSize();
-        }
-
-        if (isVerticallyStretched) {
-            if (!isHorizontallyStretched &amp;&amp; m_client-&gt;pinnedInDirection(FloatSize(deltaX, 0))) {
-                // Stretching only in the vertical.
-                if (deltaY != 0 &amp;&amp; (fabsf(deltaX / deltaY) &lt; rubberbandDirectionLockStretchRatio))
-                    deltaX = 0;
-                else if (fabsf(deltaX) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
-                    m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
-                    deltaX = 0;
-                } else
-                    m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
-            }
-        } else if (isHorizontallyStretched) {
-            // Stretching only in the horizontal.
-            if (m_client-&gt;pinnedInDirection(FloatSize(0, deltaY))) {
-                if (deltaX != 0 &amp;&amp; (fabsf(deltaY / deltaX) &lt; rubberbandDirectionLockStretchRatio))
-                    deltaY = 0;
-                else if (fabsf(deltaY) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
-                    m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY);
-                    deltaY = 0;
-                } else
-                    m_overflowScrollDelta.setHeight(m_overflowScrollDelta.height() + deltaY);
-            }
-        } else {
-            // Not stretching at all yet.
-            if (m_client-&gt;pinnedInDirection(FloatSize(deltaX, deltaY))) {
-                if (fabsf(deltaY) &gt;= fabsf(deltaX)) {
-                    if (fabsf(deltaX) &lt; rubberbandMinimumRequiredDeltaBeforeStretch) {
-                        m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
-                        deltaX = 0;
-                    } else
-                        m_overflowScrollDelta.setWidth(m_overflowScrollDelta.width() + deltaX);
-                }
-                shouldStretch = true;
-            }
-        }
-    }
-
-    if (deltaX != 0 || deltaY != 0) {
-        if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) {
-            if (deltaY != 0) {
-                deltaY *= scrollWheelMultiplier();
-                m_client-&gt;immediateScrollBy(FloatSize(0, deltaY));
-            }
-            if (deltaX != 0) {
-                deltaX *= scrollWheelMultiplier();
-                m_client-&gt;immediateScrollBy(FloatSize(deltaX, 0));
-            }
-        } else {
-            if (!m_client-&gt;allowsHorizontalStretching(wheelEvent)) {
-                deltaX = 0;
-                eventCoalescedDeltaX = 0;
-            } else if ((deltaX != 0) &amp;&amp; !isHorizontallyStretched &amp;&amp; !m_client-&gt;pinnedInDirection(FloatSize(deltaX, 0))) {
-                deltaX *= scrollWheelMultiplier();
-
-                m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
-                deltaX = 0;
-            }
-
-            if (!m_client-&gt;allowsVerticalStretching(wheelEvent)) {
-                deltaY = 0;
-                eventCoalescedDeltaY = 0;
-            } else if ((deltaY != 0) &amp;&amp; !isVerticallyStretched &amp;&amp; !m_client-&gt;pinnedInDirection(FloatSize(0, deltaY))) {
-                deltaY *= scrollWheelMultiplier();
-
-                m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
-                deltaY = 0;
-            }
-
-            IntSize stretchAmount = m_client-&gt;stretchAmount();
-
-            if (m_momentumScrollInProgress) {
-                if ((m_client-&gt;pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) &lt;= 0)) &amp;&amp; m_lastMomentumScrollTimestamp) {
-                    m_ignoreMomentumScrolls = true;
-                    m_momentumScrollInProgress = false;
-                    snapRubberBand();
-                }
-            }
-
-            m_stretchScrollForce.setWidth(m_stretchScrollForce.width() + deltaX);
-            m_stretchScrollForce.setHeight(m_stretchScrollForce.height() + deltaY);
-
-            FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.height())));
-
-            m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
-        }
-    }
-
-    if (m_momentumScrollInProgress &amp;&amp; momentumPhase == PlatformWheelEventPhaseEnded) {
-        m_momentumScrollInProgress = false;
-        m_ignoreMomentumScrolls = false;
-        m_lastMomentumScrollTimestamp = 0;
-    }
-
-    return true;
-}
-
-static inline float roundTowardZero(float num)
-{
-    return num &gt; 0 ? ceilf(num - 0.5f) : floorf(num + 0.5f);
-}
-
-static inline float roundToDevicePixelTowardZero(float num)
-{
-    float roundedNum = roundf(num);
-    if (fabs(num - roundedNum) &lt; 0.125)
-        num = roundedNum;
-
-    return roundTowardZero(num);
-}
-
-void ScrollElasticityController::snapRubberBandTimerFired()
-{
-    if (!m_momentumScrollInProgress || m_ignoreMomentumScrolls) {
-        CFTimeInterval timeDelta = [NSDate timeIntervalSinceReferenceDate] - m_startTime;
-
-        if (m_startStretch == FloatSize()) {
-            m_startStretch = m_client-&gt;stretchAmount();
-            if (m_startStretch == FloatSize()) {
-                stopSnapRubberbandTimer();
-
-                m_stretchScrollForce = FloatSize();
-                m_startTime = 0;
-                m_startStretch = FloatSize();
-                m_origOrigin = FloatPoint();
-                m_origVelocity = FloatSize();
-                return;
-            }
-
-            m_origOrigin = m_client-&gt;absoluteScrollPosition() - m_startStretch;
-            m_origVelocity = m_momentumVelocity;
-
-            // Just like normal scrolling, prefer vertical rubberbanding
-            if (fabsf(m_origVelocity.height()) &gt;= fabsf(m_origVelocity.width()))
-                m_origVelocity.setWidth(0);
-
-            // Don't rubber-band horizontally if it's not possible to scroll horizontally
-            if (!m_client-&gt;canScrollHorizontally())
-                m_origVelocity.setWidth(0);
-
-            // Don't rubber-band vertically if it's not possible to scroll vertically
-            if (!m_client-&gt;canScrollVertically())
-                m_origVelocity.setHeight(0);
-        }
-
-        FloatPoint delta(roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.width(), -m_origVelocity.width(), (float)timeDelta)),
-                         roundToDevicePixelTowardZero(elasticDeltaForTimeDelta(m_startStretch.height(), -m_origVelocity.height(), (float)timeDelta)));
-
-        if (fabs(delta.x()) &gt;= 1 || fabs(delta.y()) &gt;= 1) {
-            m_client-&gt;immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client-&gt;stretchAmount());
-
-            FloatSize newStretch = m_client-&gt;stretchAmount();
-
-            m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
-            m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
-        } else {
-            m_client-&gt;adjustScrollPositionToBoundsIfNecessary();
-
-            stopSnapRubberbandTimer();
-            m_stretchScrollForce = FloatSize();
-            m_startTime = 0;
-            m_startStretch = FloatSize();
-            m_origOrigin = FloatPoint();
-            m_origVelocity = FloatSize();
-        }
-    } else {
-        m_startTime = [NSDate timeIntervalSinceReferenceDate];
-        m_startStretch = FloatSize();
-    }
-}
-
-bool ScrollElasticityController::isRubberBandInProgress() const
-{
-    if (!m_inScrollGesture &amp;&amp; !m_momentumScrollInProgress &amp;&amp; !m_snapRubberbandTimerIsActive)
-        return false;
-
-    return !m_client-&gt;stretchAmount().isZero();
-}
-
-void ScrollElasticityController::stopSnapRubberbandTimer()
-{
-    m_client-&gt;stopSnapRubberbandTimer();
-    m_snapRubberbandTimerIsActive = false;
-}
-
-void ScrollElasticityController::snapRubberBand()
-{
-    CFTimeInterval timeDelta = systemUptime() - m_lastMomentumScrollTimestamp;
-    if (m_lastMomentumScrollTimestamp &amp;&amp; timeDelta &gt;= scrollVelocityZeroingTimeout)
-        m_momentumVelocity = FloatSize();
-
-    m_inScrollGesture = false;
-
-    if (m_snapRubberbandTimerIsActive)
-        return;
-
-    m_startTime = [NSDate timeIntervalSinceReferenceDate];
-    m_startStretch = FloatSize();
-    m_origOrigin = FloatPoint();
-    m_origVelocity = FloatSize();
-
-    m_client-&gt;startSnapRubberbandTimer();
-    m_snapRubberbandTimerIsActive = true;
-}
-
-bool ScrollElasticityController::shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&amp; wheelEvent)
-{
-    if (wheelEvent.deltaX() &gt; 0)
-        return m_client-&gt;shouldRubberBandInDirection(ScrollLeft);
-    if (wheelEvent.deltaX() &lt; 0)
-        return m_client-&gt;shouldRubberBandInDirection(ScrollRight);
-
-    return true;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(RUBBER_BANDING)
</del></span></pre>
</div>
</div>

</body>
</html>