flutter_flutter/engine/core/frame/NewEventHandler.h
Adam Barth c3fc9e9663 Add wheel support to sky-scrollable
This CL plumbs wheel events through Sky again and uses them in sky-scrollable.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/876853005
2015-01-27 09:58:22 -08:00

60 lines
2.0 KiB
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_CORE_FRAME_NEWEVENTHANDLER_H_
#define SKY_ENGINE_CORE_FRAME_NEWEVENTHANDLER_H_
#include <map>
#include "sky/engine/core/dom/Node.h"
#include "sky/engine/core/rendering/HitTestRequest.h"
#include "sky/engine/core/rendering/HitTestResult.h"
#include "sky/engine/wtf/HashMap.h"
namespace blink {
class LocalFrame;
class WebGestureEvent;
class WebKeyboardEvent;
class WebPointerEvent;
class WebWheelEvent;
class NewEventHandler {
WTF_MAKE_NONCOPYABLE(NewEventHandler);
public:
explicit NewEventHandler(LocalFrame&);
~NewEventHandler();
bool handlePointerEvent(const WebPointerEvent&);
bool handleGestureEvent(const WebGestureEvent&);
bool handleKeyboardEvent(const WebKeyboardEvent&);
bool handleWheelEvent(const WebWheelEvent&);
private:
bool handlePointerDownEvent(const WebPointerEvent&);
bool handlePointerUpEvent(const WebPointerEvent&);
bool handlePointerMoveEvent(const WebPointerEvent&);
bool handlePointerCancelEvent(const WebPointerEvent&);
bool dispatchGestureEvent(Node& target, const WebGestureEvent& event);
bool dispatchPointerEvent(Node& target, const WebPointerEvent&);
bool dispatchClickEvent(Node& capturingTarget, const WebPointerEvent&);
bool dispatchKeyboardEvent(Node& target, const WebKeyboardEvent& event);
bool dispatchWheelEvent(Node& target, const WebWheelEvent& event);
Node* targetForKeyboardEvent() const;
Node* targetForHitTestResult(const HitTestResult& hitTestResult);
HitTestResult performHitTest(const LayoutPoint&);
void updateSelectionForPointerDown(const HitTestResult&, const WebPointerEvent&);
typedef std::map<int, RefPtr<Node>> PointerTargetMap;
LocalFrame& m_frame;
PointerTargetMap m_targetForPointer;
bool m_suppressNextCharEvent;
};
}
#endif // SKY_ENGINE_CORE_FRAME_NEWEVENTHANDLER_H_