Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: sky/engine/web/WebViewImpl.cpp

Issue 874823002: Move GestureEvent to NewEventDispatcher (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Build fixes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/web/WebViewImpl.cpp
diff --git a/sky/engine/web/WebViewImpl.cpp b/sky/engine/web/WebViewImpl.cpp
index a345085b8d21764424bc062b6df6c6ba6f815f48..9f869e191650f26f831d11807e23478f8c440990 100644
--- a/sky/engine/web/WebViewImpl.cpp
+++ b/sky/engine/web/WebViewImpl.cpp
@@ -64,7 +64,6 @@
#include "sky/engine/platform/KeyboardCodes.h"
#include "sky/engine/platform/Logging.h"
#include "sky/engine/platform/NotImplemented.h"
-#include "sky/engine/platform/PlatformGestureEvent.h"
#include "sky/engine/platform/PlatformKeyboardEvent.h"
#include "sky/engine/platform/TraceEvent.h"
#include "sky/engine/platform/fonts/FontCache.h"
@@ -169,59 +168,6 @@ WebLocalFrameImpl* WebViewImpl::mainFrameImpl()
return m_page ? WebLocalFrameImpl::fromFrame(m_page->mainFrame()) : 0;
}
-bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
-{
- bool eventSwallowed = false;
- bool eventCancelled = false; // for disambiguation
-
- PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
-
- // FIXME: Remove redundant hit tests by pushing the call to EventHandler::targetGestureEvent
- // up to this point and pass GestureEventWithHitTestResults around.
-
- switch (event.type) {
- case WebInputEvent::GestureTap: {
- eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
- break;
- }
- case WebInputEvent::GestureTwoFingerTap:
- case WebInputEvent::GestureLongPress:
- case WebInputEvent::GestureLongTap: {
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- break;
- eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
- break;
- }
- case WebInputEvent::GestureShowPress: {
- eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
- break;
- }
- case WebInputEvent::GestureDoubleTap:
- // GestureDoubleTap is currently only used by Android for zooming. For WebCore,
- // GestureTap with tap count = 2 is used instead. So we drop GestureDoubleTap here.
- eventSwallowed = true;
- break;
- case WebInputEvent::GestureScrollBegin:
- case WebInputEvent::GesturePinchBegin:
- case WebInputEvent::GestureTapDown:
- case WebInputEvent::GestureScrollEnd:
- case WebInputEvent::GestureScrollUpdate:
- case WebInputEvent::GestureScrollUpdateWithoutPropagation:
- case WebInputEvent::GestureTapCancel:
- case WebInputEvent::GestureTapUnconfirmed:
- case WebInputEvent::GesturePinchEnd:
- case WebInputEvent::GesturePinchUpdate:
- case WebInputEvent::GestureFlingStart: {
- eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
- break;
- }
- default:
- ASSERT_NOT_REACHED();
- }
- m_client->didHandleGestureEvent(event, eventCancelled);
- return eventSwallowed;
-}
-
void WebViewImpl::setShowPaintRects(bool show)
{
m_showPaintRects = show;
@@ -513,8 +459,6 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
gc.restore();
}
-const WebInputEvent* WebViewImpl::m_currentInputEvent = 0;
-
// FIXME: autogenerate this kind of code, and use it throughout Blink rather than
// the one-offs for subsets of these values.
static String inputTypeToName(WebInputEvent::Type type)
@@ -547,46 +491,23 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
{
TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToName(inputEvent.type).ascii().data());
- TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent, &inputEvent);
-
if (WebInputEvent::isPointerEventType(inputEvent.type)) {
const WebPointerEvent& event = static_cast<const WebPointerEvent&>(inputEvent);
return m_page->mainFrame()->newEventHandler().handlePointerEvent(event);
}
+ if (WebInputEvent::isGestureEventType(inputEvent.type)) {
+ const WebGestureEvent& event = static_cast<const WebGestureEvent&>(inputEvent);
+ return m_page->mainFrame()->newEventHandler().handleGestureEvent(event);
+ }
+
switch (inputEvent.type) {
case WebInputEvent::RawKeyDown:
case WebInputEvent::KeyDown:
case WebInputEvent::KeyUp:
return handleKeyEvent(static_cast<const WebKeyboardEvent&>(inputEvent));
-
case WebInputEvent::Char:
return handleCharEvent(static_cast<const WebKeyboardEvent&>(inputEvent));
- case WebInputEvent::GestureScrollBegin:
- case WebInputEvent::GestureScrollEnd:
- case WebInputEvent::GestureScrollUpdate:
- case WebInputEvent::GestureScrollUpdateWithoutPropagation:
- case WebInputEvent::GestureFlingStart:
- case WebInputEvent::GestureFlingCancel:
- case WebInputEvent::GestureTap:
- case WebInputEvent::GestureTapUnconfirmed:
- case WebInputEvent::GestureTapDown:
- case WebInputEvent::GestureShowPress:
- case WebInputEvent::GestureTapCancel:
- case WebInputEvent::GestureDoubleTap:
- case WebInputEvent::GestureTwoFingerTap:
- case WebInputEvent::GestureLongPress:
- case WebInputEvent::GestureLongTap:
- return handleGestureEvent(static_cast<const WebGestureEvent&>(inputEvent));
-
- case WebInputEvent::GesturePinchBegin:
- case WebInputEvent::GesturePinchEnd:
- case WebInputEvent::GesturePinchUpdate:
- // FIXME: Once PlatformGestureEvent is updated to support pinch, this
- // should call handleGestureEvent, just like it currently does for
- // gesture scroll.
- return false;
-
default:
return false;
}
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698