diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 21:43:40 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 21:43:40 +0000 |
commit | c8ac905312f63f24f849de5d8e85bd603f17a5e7 (patch) | |
tree | e09e42704e86be0faf790bdd26f718c04d725cf1 /content | |
parent | c1cfd8e2c81f68b0e8deb997ab289f1d28b387f6 (diff) | |
download | chromium_src-c8ac905312f63f24f849de5d8e85bd603f17a5e7.zip chromium_src-c8ac905312f63f24f849de5d8e85bd603f17a5e7.tar.gz chromium_src-c8ac905312f63f24f849de5d8e85bd603f17a5e7.tar.bz2 |
content: Make sure the renderer notifies the browser about touch-event handlers properly.
WebKit will soon stop sending the number of touch-event handlers, and instead
just send whether there are any touch-event hanlders on the page or not.
https://bugs.webkit.org/show_bug.cgi?id=91006
Once the change lands in WebKit and is gardened in, I will submit another
cleanup patch to remove the old numberOfTouchEventHandlersChanged and related
messages.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10797043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_impl.cc | 6 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_impl.h | 1 | ||||
-rw-r--r-- | content/common/view_messages.h | 4 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 1 |
5 files changed, 16 insertions, 0 deletions
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 5ddb42d..038cfc5 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -289,6 +289,8 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeNumTouchEvents, OnMsgDidChangeNumTouchEvents) + IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, + OnMsgHasTouchEventHandlers) IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, OnMsgTextInputStateChanged) @@ -1560,6 +1562,10 @@ void RenderWidgetHostImpl::OnMsgDidChangeNumTouchEvents(int count) { has_touch_handler_ = count > 0; } +void RenderWidgetHostImpl::OnMsgHasTouchEventHandlers(bool has_handlers) { + has_touch_handler_ = has_handlers; +} + void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { if (!view_) { return; diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index dd43f37..17593ff 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -498,6 +498,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, virtual void OnMsgFocus(); virtual void OnMsgBlur(); void OnMsgDidChangeNumTouchEvents(int count); + void OnMsgHasTouchEventHandlers(bool has_handlers); void OnMsgSetCursor(const WebCursor& cursor); void OnMsgTextInputStateChanged(ui::TextInputType type, diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 32cdf70..0fca6ef 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1768,6 +1768,10 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_DidChangeNumWheelEvents, IPC_MESSAGE_ROUTED1(ViewHostMsg_DidChangeNumTouchEvents, int /* count */) +// Notifies whether there are JavaScript touche event handlers or not. +IPC_MESSAGE_ROUTED1(ViewHostMsg_HasTouchEventHandlers, + bool /* has_handlers */) + // A message from HTML-based UI. When (trusted) Javascript calls // send(message, args), this message is sent to the browser. IPC_MESSAGE_ROUTED3(ViewHostMsg_WebUISend, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index bcd537d..a19474c 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -3600,6 +3600,10 @@ void RenderViewImpl::numberOfTouchEventHandlersChanged(unsigned num_handlers) { Send(new ViewHostMsg_DidChangeNumTouchEvents(routing_id_, num_handlers)); } +void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { + Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); +} + void RenderViewImpl::reportFindInPageMatchCount(int request_id, int count, bool final_update) { int active_match_ordinal = -1; // -1 = don't update active match ordinal diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 4ebb5d5..c561de8 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -621,6 +621,7 @@ class RenderViewImpl : public RenderWidget, virtual void didChangeScrollOffset(WebKit::WebFrame* frame); virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers); virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers); + virtual void hasTouchEventHandlers(bool has_handlers); virtual void didChangeContentsSize(WebKit::WebFrame* frame, const WebKit::WebSize& size); virtual void reportFindInPageMatchCount(int request_id, |