Commit 757a4800 authored by costan@gmail.com's avatar costan@gmail.com

Minor cleanup in EventHandler::dragHysteresisExceeded.

The IntPoint version of EventHandler::dragHysteresisExceeded converts
its parameter to a FloatPoint and calls the FloatPoint version. In turn,
that converts the parameter back to an IntPoint, and then does the real
work. Last, the IntPoint version's parameter is called
floatDragViewportLocation, whereas the FloatPoint version's parameter is
called dragViewportLocation.

This change moves the real work in the IntPoint version, and uses the
FloatPoint->IntPoint conversion code inside the old FloatPoint version
to delegate from the FloatPoint version to the IntPoint version. The
main goal is to reduce cognitive overhead on readers.

The change also removes an obsolete comment in DragActions. The comment
refers to WebDragDestinationAction, which does not currently exist in
blink.

BUG=

Review URL: https://codereview.chromium.org/339123003

git-svn-id: svn://svn.chromium.org/blink/trunk@176354 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e4e9a118
......@@ -30,7 +30,6 @@
namespace WebCore {
// WebCoreDragDestinationAction should be kept in sync with WebDragDestinationAction
typedef enum {
DragDestinationActionNone = 0,
DragDestinationActionDHTML = 1,
......
......@@ -3009,18 +3009,17 @@ void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
}
}
bool EventHandler::dragHysteresisExceeded(const IntPoint& floatDragViewportLocation) const
bool EventHandler::dragHysteresisExceeded(const FloatPoint& floatDragViewportLocation) const
{
FloatPoint dragViewportLocation(floatDragViewportLocation.x(), floatDragViewportLocation.y());
return dragHysteresisExceeded(dragViewportLocation);
return dragHysteresisExceeded(flooredIntPoint(floatDragViewportLocation));
}
bool EventHandler::dragHysteresisExceeded(const FloatPoint& dragViewportLocation) const
bool EventHandler::dragHysteresisExceeded(const IntPoint& dragViewportLocation) const
{
FrameView* view = m_frame->view();
if (!view)
return false;
IntPoint dragLocation = view->windowToContents(flooredIntPoint(dragViewportLocation));
IntPoint dragLocation = view->windowToContents(dragViewportLocation);
IntSize delta = dragLocation - m_mouseDownPos;
int threshold = GeneralDragHysteresis;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment