[chromium] Add touch-event support for WebPluginContainerImpl
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 02:05:13 +0000 (02:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 02:05:13 +0000 (02:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89089

Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2012-06-21
Reviewed by Adam Barth.

* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::handleEvent):
* src/WebPluginContainerImpl.h:
(WebCore):
(WebPluginContainerImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120992 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.h

index fd85a1a..c2b564c 100644 (file)
@@ -1,3 +1,16 @@
+2012-06-21  Sadrul Habib Chowdhury  <sadrul@chromium.org>
+
+        [chromium] Add touch-event support for WebPluginContainerImpl
+        https://bugs.webkit.org/show_bug.cgi?id=89089
+
+        Reviewed by Adam Barth.
+
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::handleEvent):
+        * src/WebPluginContainerImpl.h:
+        (WebCore):
+        (WebPluginContainerImpl):
+
 2012-06-21  Oli Lan  <olilan@chromium.org>
 
         Add methods to select between offsets in an editable field.
index a262aa2..f4c43bc 100644 (file)
@@ -71,6 +71,7 @@
 #include "ScrollAnimator.h"
 #include "ScrollView.h"
 #include "ScrollbarTheme.h"
+#include "TouchEvent.h"
 #include "UserGestureIndicator.h"
 #include "WebPrintParams.h"
 #include "WheelEvent.h"
@@ -185,6 +186,8 @@ void WebPluginContainerImpl::handleEvent(Event* event)
         handleWheelEvent(static_cast<WheelEvent*>(event));
     else if (event->isKeyboardEvent())
         handleKeyboardEvent(static_cast<KeyboardEvent*>(event));
+    else if (eventNames().isTouchEventType(event->type()))
+        handleTouchEvent(static_cast<TouchEvent*>(event));
 
     // FIXME: it would be cleaner if Widget::handleEvent returned true/false and
     // HTMLPluginElement called setDefaultHandled or defaultEventHandler.
@@ -682,6 +685,17 @@ void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event)
         event->setDefaultHandled();
 }
 
+void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event)
+{
+    WebTouchEventBuilder webEvent(this, *event);
+    if (webEvent.type == WebInputEvent::Undefined)
+        return;
+    WebCursorInfo cursorInfo;
+    if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
+        event->setDefaultHandled();
+    // FIXME: Can a plugin change the cursor from a touch-event callback?
+}
+
 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect,
                                                IntRect& windowRect,
                                                IntRect& clipRect,
index 415cc54..772b223 100644 (file)
@@ -52,6 +52,7 @@ class LayerChromium;
 class MouseEvent;
 class ResourceError;
 class ResourceResponse;
+class TouchEvent;
 class WheelEvent;
 
 #if ENABLE(GESTURE_EVENTS)
@@ -160,6 +161,7 @@ private:
     void handleMouseEvent(WebCore::MouseEvent*);
     void handleWheelEvent(WebCore::WheelEvent*);
     void handleKeyboardEvent(WebCore::KeyboardEvent*);
+    void handleTouchEvent(WebCore::TouchEvent*);
 
     void calculateGeometry(const WebCore::IntRect& frameRect,
                            WebCore::IntRect& windowRect,