Source/WebKit/chromium/public/WebFlingAnimator.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef WebFlingAnimator_h
 27#define WebFlingAnimator_h
 28
 29#include "FloatPoint.h"
 30#include "IntPoint.h"
 31#include "IntRect.h"
 32
 33namespace WebKit {
 34
 35class WebFlingAnimator {
 36public:
 37 virtual ~WebFlingAnimator() { }
 38
 39 virtual void startFling(const WebCore::FloatPoint& velocity, const WebCore::IntRect& range) = 0;
 40 // Returns true if the animation is not yet finished.
 41 virtual bool updatePosition() = 0;
 42 virtual WebCore::IntPoint getCurrentPosition() = 0;
 43 virtual void cancelFling() = 0;
 44};
 45
 46} // namespace WebKit
 47
 48#endif // WebFlingAnimator_h
0

Source/WebKit/chromium/WebKit.gyp

154154 'public/WebFileWriter.h',
155155 'public/WebFileWriterClient.h',
156156 'public/WebFindOptions.h',
 157 'public/WebFlingAnimator.h',
157158 'public/WebFont.h',
158159 'public/WebFontCache.h',
159160 'public/WebFontDescription.h',

454455 'src/PageOverlayList.h',
455456 'src/PageWidgetDelegate.cpp',
456457 'src/PageWidgetDelegate.h',
 458 'src/PlatformGestureCurveFactory.cpp',
 459 'src/PlatformGestureCurveFactory.h',
457460 'src/PlatformMessagePortChannel.cpp',
458461 'src/PlatformMessagePortChannel.h',
459462 'src/PlatformSupport.cpp',

530533 'src/WebFileChooserCompletionImpl.h',
531534 'src/WebFileSystemCallbacksImpl.cpp',
532535 'src/WebFileSystemCallbacksImpl.h',
 536 'src/WebFlingAnimatorToGestureCurveAdapter.h',
533537 'src/WebFloatAnimationCurve.cpp',
534538 'src/WebFontCache.cpp',
535539 'src/WebFontDescription.cpp',
124857

Source/WebKit/chromium/ChangeLog

 12012-08-07 Nate Chapin <japhet@chromium.org>
 2
 3 [chromium] Upstream android's FlingAnimator
 4 https://bugs.webkit.org/show_bug.cgi?id=92900
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Tests in chromium's WebCompositorInputHandlerImplTest.
 9
 10 * WebKit.gyp:
 11 * public/WebFlingAnimator.h: Added.
 12 (WebKit):
 13 (WebFlingAnimator):
 14 (WebKit::WebFlingAnimator::~WebFlingAnimator):
 15 * src/PlatformGestureCurveFactory.cpp: Added.
 16 (WebKit):
 17 (WebKit::PlatformGestureCurveFactory::get):
 18 (WebKit::PlatformGestureCurveFactory::createCurve):
 19 (WebKit::PlatformGestureCurveFactory::setWebFlingAnimatorForTest):
 20 * src/PlatformGestureCurveFactory.h: Added.
 21 (WebKit):
 22 (PlatformGestureCurveFactory):
 23 * src/WebCompositorInputHandlerImpl.cpp:
 24 (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
 25 (WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling):
 26 (WebKit::WebCompositorInputHandlerImpl::scrollBy):
 27 * src/WebFlingAnimatorToGestureCurveAdapter.h: Added.
 28 (WebKit):
 29 (WebFlingAnimatorToGestureCurveAdapter):
 30 (WebKit::WebFlingAnimatorToGestureCurveAdapter::create):
 31 (WebKit::WebFlingAnimatorToGestureCurveAdapter::debugName):
 32 (WebKit::WebFlingAnimatorToGestureCurveAdapter::apply):
 33 (WebKit::WebFlingAnimatorToGestureCurveAdapter::WebFlingAnimatorToGestureCurveAdapter):
 34 * tests/WebCompositorInputHandlerImplTest.cpp:
 35 (WebKit::MockCCInputHandlerClient::scrollRange):
 36 (MockCCInputHandlerClient):
 37 (TestFlingAnimator):
 38 (WebKit::TestFlingAnimator::startFling):
 39 (WebKit::TestFlingAnimator::updatePosition):
 40 (WebKit::TestFlingAnimator::getCurrentPosition):
 41 (WebKit::TestFlingAnimator::cancelFling):
 42 (WebKit):
 43 (WebKit::TEST_F):
 44
1452012-08-07 Alexei Filippov <alexeif@chromium.org>
246
347 Web Inspector: make the MemoryClassInfo class a not-template
124899

Source/WebKit/chromium/src/PlatformGestureCurveFactory.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "PlatformGestureCurveFactory.h"
 28
 29#include "IntRect.h"
 30#include "FloatPoint.h"
 31#include "TouchpadFlingPlatformGestureCurve.h"
 32#include "WebFlingAnimatorToGestureCurveAdapter.h"
 33
 34namespace WebKit {
 35
 36PlatformGestureCurveFactory* PlatformGestureCurveFactory::get()
 37{
 38 DEFINE_STATIC_LOCAL(PlatformGestureCurveFactory, factory, ());
 39 return &factory;
 40}
 41
 42PassOwnPtr<WebCore::PlatformGestureCurve> PlatformGestureCurveFactory::createCurve(const WebCore::FloatPoint& point, const WebCore::IntRect& range)
 43{
 44 OwnPtr<WebFlingAnimator> flingAnimator = m_mockFlingAnimator.release();
 45 if (!flingAnimator)
 46 flingAnimator = adoptPtr(Platform::current()->createFlingAnimator());
 47 if (!flingAnimator)
 48 return WebCore::TouchpadFlingPlatformGestureCurve::create(point);
 49
 50 return WebFlingAnimatorToGestureCurveAdapter::create(point, range, flingAnimator.release());
 51}
 52
 53void PlatformGestureCurveFactory::setWebFlingAnimatorForTest(PassOwnPtr<WebFlingAnimator> mockFlingAnimator)
 54{
 55 m_mockFlingAnimator = mockFlingAnimator;
 56}
 57
 58} // namespace WebKit
0

Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp

2727
2828#include "WebCompositorInputHandlerImpl.h"
2929
 30#include "PlatformGestureCurveFactory.h"
3031#include "PlatformGestureCurveTarget.h"
3132#include "TouchpadFlingPlatformGestureCurve.h"
3233#include "TraceEvent.h"

269270 switch (scrollStatus) {
270271 case CCInputHandlerClient::ScrollStarted: {
271272 TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started");
272  OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY));
 273 OwnPtr<PlatformGestureCurve> flingCurve = PlatformGestureCurveFactory::get()->createCurve(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY), m_inputHandlerClient->scrollRange());
273274 m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this);
274275 m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.deltaX, gestureEvent.deltaY);
275276 m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y);

320321 TRACE_EVENT_INSTANT1("cc", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation);
321322 m_wheelFlingAnimation.clear();
322323 m_wheelFlingParameters = WebActiveWheelFlingParameters();
 324#if OS(ANDROID)
 325 if (hadFlingAnimation)
 326 m_inputHandlerClient->scrollEnd();
 327#endif
323328 return hadFlingAnimation;
324329}
325330

328333 if (increment == IntPoint::zero())
329334 return;
330335
 336#if OS(ANDROID)
 337 m_inputHandlerClient->scrollBy(IntSize(increment.x(), increment.y()));
 338 return;
 339#endif
 340
331341 TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x(), "y", increment.y());
332342 WebMouseWheelEvent syntheticWheel;
333343 syntheticWheel.type = WebInputEvent::MouseWheel;
124857

Source/WebKit/chromium/src/PlatformGestureCurveFactory.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef PlatformGestureCurveFactory_h
 27#define PlatformGestureCurveFactory_h
 28
 29#include "PlatformGestureCurve.h"
 30#include "WebFlingAnimator.h"
 31#include <wtf/PassOwnPtr.h>
 32
 33namespace WebKit {
 34
 35class PlatformGestureCurveFactory {
 36public:
 37 static PlatformGestureCurveFactory* get();
 38
 39 PassOwnPtr<WebCore::PlatformGestureCurve> createCurve(const WebCore::FloatPoint& point, const WebCore::IntRect& range);
 40 void setWebFlingAnimatorForTest(PassOwnPtr<WebFlingAnimator>);
 41
 42private:
 43 ~PlatformGestureCurveFactory();
 44
 45 OwnPtr<WebFlingAnimator> m_mockFlingAnimator;
 46};
 47
 48} // namespace WebKit
 49
 50#endif // PlatformGestureCurveFactory_h
0

Source/WebKit/chromium/src/WebFlingAnimatorToGestureCurveAdapter.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef WebFlingAnimatorToGestureCurveAdapter_h
 27#define WebFlingAnimatorToGestureCurveAdapter_h
 28
 29#include "FloatPoint.h"
 30#include "IntPoint.h"
 31#include "IntRect.h"
 32#include "PlatformGestureCurve.h"
 33#include "PlatformGestureCurveTarget.h"
 34#include "WebFlingAnimator.h"
 35#include <public/Platform.h>
 36
 37namespace WebKit {
 38
 39class WebFlingAnimatorToGestureCurveAdapter : public WebCore::PlatformGestureCurve {
 40public:
 41 static PassOwnPtr<PlatformGestureCurve> create(const WebCore::FloatPoint& velocity, const WebCore::IntRect& range, PassOwnPtr<WebFlingAnimator> animator)
 42 {
 43 return adoptPtr(new WebFlingAnimatorToGestureCurveAdapter(velocity, range, animator));
 44 }
 45
 46 // WebCore::PlatformGestureCurve implementation:
 47 virtual const char* debugName() const { return "WebFlingAnimatorToGestureCurveAdapter"; }
 48 virtual bool apply(double time, WebCore::PlatformGestureCurveTarget* target)
 49 {
 50 if (!m_animator->updatePosition())
 51 return false;
 52
 53 WebCore::IntPoint currentPosition = m_animator->getCurrentPosition();
 54 target->scrollBy(WebCore::IntPoint(currentPosition - m_lastPosition));
 55 m_lastPosition = currentPosition;
 56 return true;
 57 }
 58
 59private:
 60 WebFlingAnimatorToGestureCurveAdapter(const WebCore::FloatPoint& velocity, const WebCore::IntRect& range, PassOwnPtr<WebFlingAnimator> animator)
 61 : m_animator(animator)
 62 {
 63 m_animator->startFling(velocity, range);
 64 }
 65
 66 OwnPtr<WebFlingAnimator> m_animator;
 67 WebCore::IntPoint m_lastPosition;
 68};
 69
 70}
 71
 72#endif // WebFlingAnimatorToGestureCurveAdapter_h
0

Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp

2727
2828#include "WebCompositorInputHandlerImpl.h"
2929
 30#include "IntRect.h"
 31#include "PlatformGestureCurveFactory.h"
3032#include "WebCompositor.h"
3133#include "WebCompositorInputHandlerClient.h"
3234#include "WebInputEvent.h"

6365 MOCK_METHOD1(scrollBy, void(const WebCore::IntSize&));
6466 MOCK_METHOD0(scrollEnd, void());
6567
 68 WebCore::IntRect scrollRange() const { return WebCore::IntRect(); }
 69
6670private:
6771 virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition,
6872 bool anchorPoint,

117121 WebCompositor::shutdown();
118122}
119123
 124class TestFlingAnimator : public WebKit::WebFlingAnimator {
 125public:
 126 virtual void startFling(const WebCore::FloatPoint& velocity, const WebCore::IntRect& range)
 127 {
 128 m_velocity = WebCore::IntSize((int)velocity.x(), (int)velocity.y());
 129 }
 130
 131 virtual bool updatePosition()
 132 {
 133 // Scroll forever once started for the purpose of these tests.
 134 // We don't want to make them timing-sensitive anyways.
 135 return m_velocity.width() > 0 || m_velocity.height() > 0;
 136 }
 137
 138 virtual WebCore::IntPoint getCurrentPosition()
 139 {
 140 return m_lastPosition += m_velocity;
 141 }
 142
 143 virtual void cancelFling()
 144 {
 145 m_velocity = WebCore::IntSize();
 146 }
 147private:
 148 WebCore::IntPoint m_lastPosition;
 149 WebCore::IntSize m_velocity;
 150};
 151
120152class WebCompositorInputHandlerImplTest : public testing::Test {
121153public:
122154 WebCompositorInputHandlerImplTest()

336368 m_inputHandler->handleInputEvent(gesture);
337369}
338370
 371#if OS(ANDROID)
 372// FIXME: Sort out whether differences between touch and wheel fling are needed.
 373// We should either have different concepts of touch and mouse wheel fling based on a macro,
 374// and then run a different test here based on that. Or unify the code and handle the
 375// differences in scroll behavior at a different level.
 376// The current differences come down to mouse wheel fling wrapping each fling update in
 377// a begin/end pair in the other version of the test further down.
339378TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates)
340379{
 380 PlatformGestureCurveFactory::get()->setWebFlingAnimatorForTest(adoptPtr(new TestFlingAnimator));
 381
341382 // We shouldn't send any events to the widget for this gesture.
342383 m_expectedDisposition = DidHandle;
343384 VERIFY_AND_RESET_MOCKS();
 385
 386 gesture.type = WebKit::WebInputEvent::GestureFlingStart;
 387 gesture.deltaX = 1000;
 388 EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
 389 EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
 390 .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
 391 m_inputHandler->handleInputEvent(gesture);
 392
 393 testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
 394 EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
 395 EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
 396 EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Gt(0)))).Times(1);
 397 m_inputHandler->animate(10);
 398}
344399
 400#else
 401TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates)
 402{
 403 // We shouldn't send any events to the widget for this gesture.
 404 m_expectedDisposition = DidHandle;
 405 VERIFY_AND_RESET_MOCKS();
 406
345407 // On the fling start, we should schedule an animation but not actually start
346408 // scrolling.
347409 gesture.type = WebInputEvent::GestureFlingStart;

561623 testing::Field(&WebSize::height, testing::Lt(0))))));
562624 m_inputHandler->animate(30.2);
563625}
 626#endif
564627
565628}
124857

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

8181 virtual void setActiveGestureAnimation(PassOwnPtr<CCActiveGestureAnimation>) OVERRIDE;
8282 virtual void scheduleAnimation() OVERRIDE;
8383
 84 virtual IntRect scrollRange() const OVERRIDE;
 85
8486 struct FrameData {
8587 Vector<IntRect> occludingScreenSpaceRects;
8688 CCRenderPassList renderPasses;
124857

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

924924 clearCurrentlyScrollingLayer();
925925}
926926
 927static bool isValidScrollRange(const IntRect& scrollRange)
 928{
 929 return scrollRange.x() < 0 && scrollRange.y() < 0 && scrollRange.maxX() > 0 && scrollRange.maxY() > 0;
 930}
 931
 932static void expandScrollRange(IntRect& scrollRange, float scale, IntPoint scrollPosition, IntSize maxScrollPosition)
 933{
 934 scrollPosition.scale(scale, scale);
 935 maxScrollPosition.scale(scale);
 936 scrollPosition.clampNegativeToZero();
 937 maxScrollPosition = maxScrollPosition.expandedTo(toSize(scrollPosition));
 938 // Only expand the scroll range along an axis if there previously was no room to scroll in that direction.
 939 // This is to ensure that flings do not overshoot the boundaries of a scrollable element and start scrolling
 940 // its parent instead.
 941 if (!scrollRange.x()) {
 942 scrollRange.setX(-scrollPosition.x());
 943 scrollRange.setWidth(scrollRange.width() + scrollPosition.x());
 944 }
 945 if (!scrollRange.y()) {
 946 scrollRange.setY(-scrollPosition.y());
 947 scrollRange.setHeight(scrollRange.height() + scrollPosition.y());
 948 }
 949 if (!scrollRange.maxX())
 950 scrollRange.setWidth(maxScrollPosition.width() - scrollPosition.x() - scrollRange.x());
 951 if (!scrollRange.maxY())
 952 scrollRange.setHeight(maxScrollPosition.height() - scrollPosition.y() - scrollRange.y());
 953 ASSERT(scrollRange.x() <= 0 && scrollRange.maxX() >= 0);
 954 ASSERT(scrollRange.y() <= 0 && scrollRange.maxY() >= 0);
 955}
 956
 957IntRect CCLayerTreeHostImpl::scrollRange() const
 958{
 959 const CCLayerImpl* layerImpl = m_rootScrollLayerImpl;
 960 IntRect scrollRange;
 961
 962 if (layerImpl && !isValidScrollRange(scrollRange)) {
 963 if (layerImpl->scrollable()) {
 964 IntPoint scrollPosition(flooredIntPoint(layerImpl->scrollPosition() + layerImpl->scrollDelta()));
 965 expandScrollRange(scrollRange, m_pageScaleDelta, scrollPosition, layerImpl->maxScrollPosition());
 966 }
 967 }
 968 return scrollRange;
 969}
 970
927971void CCLayerTreeHostImpl::pinchGestureBegin()
928972{
929973 m_pinchGestureActive = true;
124857

Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h

2424#ifndef CCInputHandler_h
2525#define CCInputHandler_h
2626
 27#include "IntRect.h"
2728#include <wtf/Noncopyable.h>
2829#include <wtf/PassOwnPtr.h>
2930

6566 // called if scrollBegin() returned ScrollStarted.
6667 virtual void scrollEnd() = 0;
6768
 69 // Return the scroll range relative to the current position. top/left
 70 // value <= 0, and bottom/right value >= 0.
 71 virtual IntRect scrollRange() const = 0;
 72
6873 virtual void pinchGestureBegin() = 0;
6974 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) = 0;
7075 virtual void pinchGestureEnd() = 0;
124857

Source/WebCore/ChangeLog

 12012-08-07 Nate Chapin <japhet@chromium.org>
 2
 3 [chromium] Upstream android's FlingAnimator
 4 https://bugs.webkit.org/show_bug.cgi?id=92900
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Tests in chromium's WebCompositorInputHandlerImplTest.
 9
 10 * platform/graphics/chromium/cc/CCInputHandler.h:
 11 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
 12 (WebCore::isValidScrollRange):
 13 (WebCore):
 14 (WebCore::expandScrollRange):
 15 (WebCore::CCLayerTreeHostImpl::scrollRange):
 16 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
 17
1182012-08-07 Brian Anderson <brianderson@chromium.org>
219
320 Add CCDelayBasedTimeSource::setTimebaseAndInterval
124899

Source/Platform/chromium/public/Platform.h

5252class WebCookieJar;
5353class WebFileSystem;
5454class WebFileUtilities;
 55class WebFlingAnimator;
5556class WebMediaStreamCenter;
5657class WebMediaStreamCenterClient;
5758class WebMessagePortChannel;

410411 // This value must be checked again after a context loss event as the platform's capabilities may have changed.
411412 virtual bool canAccelerate2dCanvas() { return false; }
412413
 414 virtual WebFlingAnimator* createFlingAnimator() { return 0; }
413415
414416 // WebRTC ----------------------------------------------------------
415417
124857

Source/Platform/ChangeLog

 12012-08-07 Nate Chapin <japhet@chromium.org>
 2
 3 [chromium] Upstream android's FlingAnimator
 4 https://bugs.webkit.org/show_bug.cgi?id=92900
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Tests in chromium's WebCompositorInputHandlerImplTest.
 9
 10 * chromium/public/Platform.h:
 11 (WebKit):
 12 (WebKit::Platform::createFlingAnimator):
 13
1142012-08-06 James Robinson <jamesr@chromium.org>
215
316 [chromium] Remove lingering unwrap<>() calls in GraphicsLayerChromium.cpp
124899