Diff
Modified: trunk/LayoutTests/ChangeLog (110370 => 110371)
--- trunk/LayoutTests/ChangeLog 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/LayoutTests/ChangeLog 2012-03-10 05:45:25 UTC (rev 110371)
@@ -1,3 +1,16 @@
+2012-03-09 Robert Kroeger <[email protected]>
+
+ Handle more Gesture* events by performing scrolls on the correct target ScrollableArea
+ https://bugs.webkit.org/show_bug.cgi?id=80311
+
+ Rebaselined to reflect corrected behaviour of gesture events targeting a div removed
+ from the DOM during dispatch.
+
+ Reviewed by James Robinson.
+
+ * fast/events/touch/gesture/touch-gesture-scroll-shy-target.html:
+ * platform/chromium/fast/events/touch/gesture/touch-gesture-scroll-shy-target-expected.txt:
+
2012-03-09 Ojan Vafai <[email protected]>
Chromium-Lion rebaselines. Getting close to done. :(
Modified: trunk/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-shy-target.html (110370 => 110371)
--- trunk/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-shy-target.html 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-shy-target.html 2012-03-10 05:45:25 UTC (rev 110371)
@@ -76,7 +76,7 @@
var scrollAmountX = ['63', '0'];
var scrollAmountY = ['62', '0'];
var wheelEventsOccurred = 0;
-var expectedWheelEventsOccurred = ['3', '3'];
+var expectedWheelEventsOccurred = ['3', '2'];
var scrollEventsOccurred = 0;
var expectedScrollEventsOccurred = '1';
var scrolledElement = 'movingdiv'
Modified: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/touch-gesture-scroll-shy-target-expected.txt (110370 => 110371)
--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/touch-gesture-scroll-shy-target-expected.txt 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/touch-gesture-scroll-shy-target-expected.txt 2012-03-10 05:45:25 UTC (rev 110371)
@@ -14,10 +14,9 @@
wheel event 0+> [object HTMLDivElement]
wheel event 1+> [object HTMLDivElement]
received element removing keypress
-wheel event 2+> [object HTMLDivElement]
PASS movingdiv.scrollTop is 0
PASS movingdiv.scrollLeft is 0
-PASS wheelEventsOccurred is 3
+PASS wheelEventsOccurred is 2
scroll event 0+> [object HTMLDivElement]
PASS scrollEventsOccurred is 1
PASS successfullyParsed is true
Modified: trunk/Source/WebCore/ChangeLog (110370 => 110371)
--- trunk/Source/WebCore/ChangeLog 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/ChangeLog 2012-03-10 05:45:25 UTC (rev 110371)
@@ -1,3 +1,45 @@
+2012-03-09 Robert Kroeger <[email protected]>
+
+ Handle more Gesture* events by performing scrolls on the correct target ScrollableArea
+ https://bugs.webkit.org/show_bug.cgi?id=80311
+
+ Implement GestureScroll* events via re-use of WheelEvent dispatch.
+
+ Reviewed by James Robinson.
+
+ Layout tests previously submited as https://bugs.webkit.org/show_bug.cgi?id=80201 and unit
+ test added as part of this patch.
+
+ * page/EventHandler.cpp:
+ (WebCore::wheelGranularityToScrollGranularity): Refactoring.
+ (WebCore):
+ (WebCore::scrollNode):
+ (WebCore::EventHandler::EventHandler):
+ (WebCore::EventHandler::clear):
+ (WebCore::EventHandler::handleWheelEvent):
+ (WebCore::EventHandler::defaultWheelEventHandler):
+ (WebCore::EventHandler::handleGestureEvent): Added GestureScrollBegin & End.
+ (WebCore::EventHandler::handleGestureTap):
+ (WebCore::EventHandler::handleGestureScrollUpdate):
+ (WebCore::EventHandler::handleGestureScrollCore): Refactoring.
+ * page/EventHandler.h:
+ (EventHandler):
+ * platform/PlatformWheelEvent.h: Added additional scroll type.
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::handleWheelEvent): Forward additional scroll type.
+ * platform/ScrollAnimator.h:
+ (WebCore):
+ * platform/ScrollAnimatorNone.cpp:
+ (WebCore::ScrollAnimatorNone::ScrollAnimatorNone): Handle additional scroll type.
+ (WebCore::ScrollAnimatorNone::fireUpAnAnimation):
+ (WebCore):
+ (WebCore::ScrollAnimatorNone::scroll):
+ * platform/ScrollAnimatorNone.h:
+ (ScrollAnimatorNone):
+ * platform/ScrollTypes.h: Added an additional scroll type.
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::scroll):
+
2012-03-09 Erik Arvidsson <[email protected]>
[V8] Fix a fixme in v8 bindings
Modified: trunk/Source/WebCore/page/EventHandler.cpp (110370 => 110371)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-03-10 05:45:25 UTC (rev 110371)
@@ -83,6 +83,7 @@
#include <wtf/Assertions.h>
#include <wtf/CurrentTime.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/TemporaryChange.h>
#if ENABLE(GESTURE_EVENTS)
#include "PlatformGestureEvent.h"
@@ -232,29 +233,28 @@
};
#endif
-static inline bool scrollNode(float delta, WheelEvent::Granularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Node** stopNode)
+static inline ScrollGranularity wheelGranularityToScrollGranularity(WheelEvent::Granularity granularity)
{
+ switch (granularity) {
+ case WheelEvent::Page:
+ return ScrollByPage;
+ case WheelEvent::Line:
+ return ScrollByLine;
+ case WheelEvent::Pixel:
+ return ScrollByPixel;
+ }
+ return ScrollByPixel;
+}
+
+static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Node** stopNode)
+{
if (!delta)
return false;
-
if (!node->renderer())
return false;
-
- // Find the nearest enclosing box.
RenderBox* enclosingBox = node->renderer()->enclosingBox();
-
float absDelta = delta > 0 ? delta : -delta;
-
- if (granularity == WheelEvent::Page)
- return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPage, absDelta, stopNode);
-
- if (granularity == WheelEvent::Line)
- return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByLine, absDelta, stopNode);
-
- if (granularity == WheelEvent::Pixel)
- return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPixel, absDelta, stopNode);
-
- return false;
+ return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopNode);
}
#if !PLATFORM(MAC)
@@ -312,6 +312,7 @@
, m_touchPressed(false)
#endif
, m_maxMouseMovedDuration(0)
+ , m_baseEventType(PlatformEvent::NoType)
{
}
@@ -359,6 +360,9 @@
m_originatingTouchPointTargets.clear();
#endif
m_maxMouseMovedDuration = 0;
+#if ENABLE(GESTURE_EVENTS)
+ m_baseEventType = PlatformEvent::NoType;
+#endif
}
void EventHandler::nodeWillBeRemoved(Node* nodeToBeRemoved)
@@ -2313,7 +2317,7 @@
// Instead, the handlers should know convert vertical scrolls
// appropriately.
PlatformWheelEvent event = e;
- if (shouldTurnVerticalTicksIntoHorizontal(result))
+ if (m_baseEventType != PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result))
event = event.copyTurningVerticalTicksIntoHorizontalTicks();
if (node) {
@@ -2339,20 +2343,21 @@
return view->wheelEvent(event);
}
-
+
void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEvent)
{
if (!startNode || !wheelEvent)
return;
Node* stopNode = m_previousWheelScrolledNode.get();
+ ScrollGranularity granularity = m_baseEventType == PlatformEvent::GestureScrollEnd ? ScrollByPixelVelocity : wheelGranularityToScrollGranularity(wheelEvent->granularity());
// Break up into two scrolls if we need to. Diagonal movement on
// a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set).
- if (scrollNode(wheelEvent->rawDeltaX(), wheelEvent->granularity(), ScrollLeft, ScrollRight, startNode, &stopNode))
+ if (scrollNode(wheelEvent->rawDeltaX(), granularity, ScrollLeft, ScrollRight, startNode, &stopNode))
wheelEvent->setDefaultHandled();
- if (scrollNode(wheelEvent->rawDeltaY(), wheelEvent->granularity(), ScrollUp, ScrollDown, startNode, &stopNode))
+ if (scrollNode(wheelEvent->rawDeltaY(), granularity, ScrollUp, ScrollDown, startNode, &stopNode))
wheelEvent->setDefaultHandled();
if (!m_useLatchedWheelEventNode)
@@ -2362,32 +2367,34 @@
#if ENABLE(GESTURE_EVENTS)
bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
{
- // FIXME: This should hit test and go to the correct subframe rather than
- // always sending gestures to the main frame only. We should also ensure
- // that if a frame gets a gesture begin gesture, it gets the corresponding
- // end gesture as well.
+ // FIXME: A more general scroll system (https://bugs.webkit.org/show_bug.cgi?id=80596) will
+ // eliminate the need for this.
+ TemporaryChange<PlatformEvent::Type> baseEventType(m_baseEventType, gestureEvent.type());
switch (gestureEvent.type()) {
case PlatformEvent::GestureTapDown:
+ // FIXME: Stop animation here.
break;
case PlatformEvent::GestureTap:
return handleGestureTap(gestureEvent);
case PlatformEvent::GestureScrollUpdate:
return handleGestureScrollUpdate(gestureEvent);
case PlatformEvent::GestureDoubleTap:
+ break;
case PlatformEvent::GestureScrollBegin:
+ return handleGestureScrollCore(gestureEvent, ScrollByPixelWheelEvent, false);
case PlatformEvent::GestureScrollEnd:
- break;
+ return handleGestureScrollCore(gestureEvent, ScrollByPixelVelocityWheelEvent, true);
default:
ASSERT_NOT_REACHED();
}
- return true;
+
+ return false;
}
bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent)
{
- // FIXME: Refactor this code to not hit test multiple times once hit testing
- // has been corrected as suggested above in handleGestureEvent().
+ // FIXME: Refactor this code to not hit test multiple times.
bool defaultPrevented = false;
PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globalPosition(), NoButton, PlatformEvent::MouseMoved, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globalPosition(), LeftButton, PlatformEvent::MousePressed, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
@@ -2400,14 +2407,20 @@
bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gestureEvent)
{
+ return handleGestureScrollCore(gestureEvent, ScrollByPixelWheelEvent, true);
+}
+
+bool EventHandler::handleGestureScrollCore(const PlatformGestureEvent& gestureEvent, PlatformWheelEventGranularity granularity, bool latchedWheel)
+{
+ TemporaryChange<bool> latched(m_useLatchedWheelEventNode, latchedWheel);
const float tickDivisor = (float)WheelEvent::tickMultiplier;
- // FIXME: Replace this interim implementation once the above fixme in handleGestureEvent() has been addressed.
- bool defaultPrevented = false;
IntPoint point(gestureEvent.position().x(), gestureEvent.position().y());
IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalPosition().y());
- PlatformWheelEvent syntheticWheelEvent(point, globalPoint, gestureEvent.deltaX(), gestureEvent.deltaY(), gestureEvent.deltaX() / tickDivisor, gestureEvent.deltaY() / tickDivisor, ScrollByPixelWheelEvent, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey());
- defaultPrevented |= handleWheelEvent(syntheticWheelEvent);
- return defaultPrevented;
+ PlatformWheelEvent syntheticWheelEvent(point, globalPoint,
+ gestureEvent.deltaX(), gestureEvent.deltaY(), gestureEvent.deltaX() / tickDivisor, gestureEvent.deltaY() / tickDivisor,
+ granularity,
+ gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey());
+ return handleWheelEvent(syntheticWheelEvent);
}
#endif
Modified: trunk/Source/WebCore/page/EventHandler.h (110370 => 110371)
--- trunk/Source/WebCore/page/EventHandler.h 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/page/EventHandler.h 2012-03-10 05:45:25 UTC (rev 110371)
@@ -31,6 +31,7 @@
#include "FocusDirection.h"
#include "HitTestRequest.h"
#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
#include "ScrollTypes.h"
#include "TextEventInputType.h"
#include "TextGranularity.h"
@@ -347,6 +348,10 @@
bool isKeyEventAllowedInFullScreen(const PlatformKeyboardEvent&) const;
#endif
+#if ENABLE(GESTURE_EVENTS)
+ bool handleGestureScrollCore(const PlatformGestureEvent&, PlatformWheelEventGranularity, bool latchedWheel);
+#endif
+
Frame* m_frame;
bool m_mousePressed;
@@ -432,6 +437,7 @@
bool m_touchPressed;
#endif
double m_maxMouseMovedDuration;
+ PlatformEvent::Type m_baseEventType;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/PlatformWheelEvent.h (110370 => 110371)
--- trunk/Source/WebCore/platform/PlatformWheelEvent.h 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/PlatformWheelEvent.h 2012-03-10 05:45:25 UTC (rev 110371)
@@ -64,7 +64,8 @@
// up and down (you get the same behavior as if the user was clicking in a scrollbar track to page up or page down).
enum PlatformWheelEventGranularity {
ScrollByPageWheelEvent,
- ScrollByPixelWheelEvent
+ ScrollByPixelWheelEvent,
+ ScrollByPixelVelocityWheelEvent
};
#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp 2012-03-10 05:45:25 UTC (rev 110371)
@@ -98,6 +98,12 @@
|| (deltaY < 0 && maxForwardScrollDelta.height() > 0)
|| (deltaY > 0 && maxBackwardScrollDelta.height() > 0)) {
handled = true;
+ if (e.granularity() == ScrollByPixelVelocityWheelEvent) {
+ scroll(VerticalScrollbar, ScrollByPixelVelocity, 0, -deltaY);
+ scroll(HorizontalScrollbar, ScrollByPixelVelocity, 0, -deltaX);
+ return handled;
+ }
+
if (deltaY) {
if (e.granularity() == ScrollByPageWheelEvent) {
bool negative = deltaY < 0;
@@ -118,7 +124,6 @@
scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX);
}
}
-
return handled;
}
Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollAnimator.h 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h 2012-03-10 05:45:25 UTC (rev 110371)
@@ -41,10 +41,6 @@
class ScrollableArea;
class Scrollbar;
-#if ENABLE(GESTURE_EVENTS)
-class PlatformGestureEvent;
-#endif
-
class ScrollAnimator {
public:
static PassOwnPtr<ScrollAnimator> create(ScrollableArea*);
Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp 2012-03-10 05:45:25 UTC (rev 110371)
@@ -379,6 +379,9 @@
, m_horizontalData(this, &m_currentPosX, scrollableArea->visibleWidth())
, m_verticalData(this, &m_currentPosY, scrollableArea->visibleHeight())
, m_animationActive(false)
+ , m_firstVelocity(0)
+ , m_firstVelocitySet(false)
+ , m_firstVelocityIsVertical(false)
{
}
@@ -387,6 +390,11 @@
stopAnimationTimerIfNeeded();
}
+void ScrollAnimatorNone::fireUpAnAnimation(FloatPoint fp)
+{
+ UNUSED_PARAM(fp);
+}
+
bool ScrollAnimatorNone::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier)
{
if (!m_scrollableArea->scrollAnimatorEnabled())
@@ -412,8 +420,21 @@
case ScrollByPixel:
parameters = Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickTime, Cubic, 3 * kTickTime, Quadratic, 1.25);
break;
- default:
- break;
+ case ScrollByPixelVelocity:
+ // FIXME: Generalize the scroll interface to support a richer set of parameters.
+ if (m_firstVelocitySet) {
+ float x = m_firstVelocityIsVertical ? multiplier : m_firstVelocity;
+ float y = m_firstVelocityIsVertical ? m_firstVelocity : multiplier;
+ FloatPoint fp(x, y);
+ fireUpAnAnimation(fp);
+ m_firstVelocitySet = false;
+ m_firstVelocityIsVertical = false;
+ } else {
+ m_firstVelocitySet = true;
+ m_firstVelocityIsVertical = orientation == VerticalScrollbar;
+ m_firstVelocity = multiplier;
+ }
+ return true;
}
// If the individual input setting is disabled, bail.
Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.h (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollAnimatorNone.h 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.h 2012-03-10 05:45:25 UTC (rev 110371)
@@ -37,6 +37,7 @@
#error "SMOOTH_SCROLLING requires REQUEST_ANIMATION_FRAME to be enabled."
#endif
+#include "FloatPoint.h"
#include "ScrollAnimator.h"
#include "Timer.h"
@@ -139,12 +140,17 @@
void stopAnimationTimerIfNeeded();
bool animationTimerActive();
void updateVisibleLengths();
+ virtual void fireUpAnAnimation(FloatPoint);
PerAxisData m_horizontalData;
PerAxisData m_verticalData;
double m_startTime;
bool m_animationActive;
+
+ float m_firstVelocity;
+ bool m_firstVelocitySet;
+ bool m_firstVelocityIsVertical;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollTypes.h (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollTypes.h 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollTypes.h 2012-03-10 05:45:25 UTC (rev 110371)
@@ -105,7 +105,8 @@
ScrollByLine,
ScrollByPage,
ScrollByDocument,
- ScrollByPixel
+ ScrollByPixel,
+ ScrollByPixelVelocity
};
enum ScrollElasticity {
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (110370 => 110371)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2012-03-10 05:45:25 UTC (rev 110371)
@@ -101,9 +101,11 @@
case ScrollByPixel:
step = scrollbar->pixelStep();
break;
+ case ScrollByPixelVelocity:
+ break;
}
- if (direction == ScrollUp || direction == ScrollLeft)
+ if (granularity != ScrollByPixelVelocity && (direction == ScrollUp || direction == ScrollLeft))
multiplier = -multiplier;
return scrollAnimator()->scroll(orientation, granularity, step, multiplier);
Modified: trunk/Source/WebKit/chromium/ChangeLog (110370 => 110371)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-10 05:45:25 UTC (rev 110371)
@@ -1,3 +1,19 @@
+2012-03-09 Robert Kroeger <[email protected]>
+
+ Handle more Gesture* events by performing scrolls on the correct target ScrollableArea
+ https://bugs.webkit.org/show_bug.cgi?id=80311
+
+ Added a unit test for the changes to ScrollAnimatorNone to make sure that the two-call
+ transport of fling parameters is correctly delivered.
+
+ Reviewed by James Robinson.
+
+ * tests/ScrollAnimatorNoneTest.cpp:
+ (MockScrollAnimatorNone):
+ (MockScrollAnimatorNone::reset):
+ (MockScrollAnimatorNone::fireUpAnAnimation):
+ (TEST):
+
2012-03-07 James Robinson <[email protected]>
[chromium] Deprecate renderDirectlyToWebView parameter of WebViewClient::createGraphicsContext3D()
Modified: trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp (110370 => 110371)
--- trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp 2012-03-10 05:40:15 UTC (rev 110370)
+++ trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp 2012-03-10 05:45:25 UTC (rev 110371)
@@ -81,6 +81,9 @@
float currentX() { return m_currentPosX; }
float currentY() { return m_currentPosY; }
+ FloatPoint m_fp;
+ int m_count;
+
void reset()
{
stopAnimationTimerIfNeeded();
@@ -88,8 +91,16 @@
m_currentPosY = 0;
m_horizontalData.reset();
m_verticalData.reset();
+ m_fp = FloatPoint::zero();
+ m_count = 0;
}
+ virtual void fireUpAnAnimation(FloatPoint fp)
+ {
+ m_fp = fp;
+ m_count++;
+ }
+
MOCK_METHOD1(scrollToOffsetWithoutAnimation, void(const FloatPoint&));
};
@@ -120,6 +131,30 @@
scrollAnimatorNone.reset();
}
+TEST(ScrollAnimatorEnabled, flingScrollEncoding)
+{
+ MockScrollableArea scrollableArea(true);
+ MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
+
+ scrollAnimatorNone.reset();
+
+ scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixelVelocity, 111, -42);
+ scrollAnimatorNone.scroll(VerticalScrollbar, ScrollByPixelVelocity, 222, 42);
+ EXPECT_EQ(-42, scrollAnimatorNone.m_fp.x());
+ EXPECT_EQ(42, scrollAnimatorNone.m_fp.y());
+ EXPECT_EQ(1, scrollAnimatorNone.m_count);
+ scrollAnimatorNone.reset();
+
+ scrollAnimatorNone.scroll(VerticalScrollbar, ScrollByPixelVelocity, 222, 42);
+ scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixelVelocity, 111, -42);
+ EXPECT_EQ(-42, scrollAnimatorNone.m_fp.x());
+ EXPECT_EQ(42, scrollAnimatorNone.m_fp.y());
+ EXPECT_EQ(1, scrollAnimatorNone.m_count);
+ scrollAnimatorNone.reset();
+}
+
+
+
TEST(ScrollAnimatorEnabled, Disabled)
{
MockScrollableArea scrollableArea(false);