Title: [121070] trunk/Source/WebKit/chromium
Revision
121070
Author
[email protected]
Date
2012-06-22 16:24:56 -0700 (Fri, 22 Jun 2012)

Log Message

[chromium] Notify the document if a plugin accepts touch input events
https://bugs.webkit.org/show_bug.cgi?id=89769

Patch by Sadrul Habib Chowdhury <[email protected]> on 2012-06-22
Reviewed by Adam Barth.

The browser sends touch events to webkit only if webkit has any touch-event handlers. So it is
necessary to notify the document when a plugin starts accepting touch-events so that it can in
turn tell the browser to send it touch events.

* public/WebPluginContainer.h:
(WebPluginContainer):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::setIsAcceptingTouchEvents):
(WebKit):
(WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
(WebKit::WebPluginContainerImpl::~WebPluginContainerImpl):
* src/WebPluginContainerImpl.h:
(WebPluginContainerImpl):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (121069 => 121070)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-22 23:16:51 UTC (rev 121069)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-22 23:24:56 UTC (rev 121070)
@@ -1,3 +1,24 @@
+2012-06-22  Sadrul Habib Chowdhury  <[email protected]>
+
+        [chromium] Notify the document if a plugin accepts touch input events
+        https://bugs.webkit.org/show_bug.cgi?id=89769
+
+        Reviewed by Adam Barth.
+
+        The browser sends touch events to webkit only if webkit has any touch-event handlers. So it is
+        necessary to notify the document when a plugin starts accepting touch-events so that it can in
+        turn tell the browser to send it touch events.
+
+        * public/WebPluginContainer.h:
+        (WebPluginContainer):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::setIsAcceptingTouchEvents):
+        (WebKit):
+        (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
+        (WebKit::WebPluginContainerImpl::~WebPluginContainerImpl):
+        * src/WebPluginContainerImpl.h:
+        (WebPluginContainerImpl):
+
 2012-06-22  Kenneth Russell  <[email protected]>
 
         Unreviewed, rolling out r121064.

Modified: trunk/Source/WebKit/chromium/public/WebPluginContainer.h (121069 => 121070)


--- trunk/Source/WebKit/chromium/public/WebPluginContainer.h	2012-06-22 23:16:51 UTC (rev 121069)
+++ trunk/Source/WebKit/chromium/public/WebPluginContainer.h	2012-06-22 23:24:56 UTC (rev 121070)
@@ -107,6 +107,9 @@
     // content. The rectangle is in the plugin's coordinate system.
     virtual bool isRectTopmost(const WebRect&) = 0;
 
+    // Notifies when the plugin starts/stops accepting touch events.
+    virtual void setIsAcceptingTouchEvents(bool) = 0;
+
     virtual WebPlugin* plugin() = 0;
     virtual void setPlugin(WebPlugin*) = 0;
 

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (121069 => 121070)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-06-22 23:16:51 UTC (rev 121069)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-06-22 23:24:56 UTC (rev 121070)
@@ -481,6 +481,18 @@
     return (nodes.first().get() == m_element);
 }
 
+void WebPluginContainerImpl::setIsAcceptingTouchEvents(bool acceptingTouchEvents)
+{
+    if (m_isAcceptingTouchEvents == acceptingTouchEvents)
+        return;
+    m_isAcceptingTouchEvents = acceptingTouchEvents;
+    if (m_isAcceptingTouchEvents) {
+        m_element->document()->didAddTouchEventHandler();
+        m_element->document()->addListenerType(Document::TOUCH_LISTENER);
+    } else
+        m_element->document()->didRemoveTouchEventHandler();
+}
+
 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response)
 {
     // Make sure that the plugin receives window geometry before data, or else
@@ -579,11 +591,15 @@
     , m_textureId(0)
     , m_ioSurfaceId(0)
 #endif
+    , m_isAcceptingTouchEvents(false)
 {
 }
 
 WebPluginContainerImpl::~WebPluginContainerImpl()
 {
+    if (m_isAcceptingTouchEvents)
+        m_element->document()->didRemoveTouchEventHandler();
+
     for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
         m_pluginLoadObservers[i]->clearPluginContainer();
     m_webPlugin->destroy();

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h (121069 => 121070)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2012-06-22 23:16:51 UTC (rev 121069)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2012-06-22 23:24:56 UTC (rev 121070)
@@ -110,6 +110,7 @@
     virtual void zoomLevelChanged(double zoomLevel);    
     virtual void setOpaque(bool);
     virtual bool isRectTopmost(const WebRect&);
+    virtual void setIsAcceptingTouchEvents(bool);
 
     // This cannot be null.
     WebPlugin* plugin() { return m_webPlugin; }
@@ -188,6 +189,8 @@
     // The associated scrollbar group object, created lazily. Used for Pepper
     // scrollbars.
     OwnPtr<ScrollbarGroup> m_scrollbarGroup;
+
+    bool m_isAcceptingTouchEvents;
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to