diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 09:02:24 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 09:02:24 +0000 |
commit | 2d0f2e95d4a44967424a7bb735d5263da3dea581 (patch) | |
tree | 9b2868014f1f58f4d369e73b162c75ccecabda0f /content/renderer | |
parent | 219e07987f9ec4e40418b251b4960681af726d53 (diff) | |
download | chromium_src-2d0f2e95d4a44967424a7bb735d5263da3dea581.zip chromium_src-2d0f2e95d4a44967424a7bb735d5263da3dea581.tar.gz chromium_src-2d0f2e95d4a44967424a7bb735d5263da3dea581.tar.bz2 |
Show keyboard when the focused editable field is touched inside the web content area.
When an editable fieled is touched and the focus is moved to the element, NOTIFICATION_FOCUS_CHANGED_IN_PAGE is sent. However, if the field is already focused, no notification is sent. But keyboard should be shown in such a case.
This CL
- Adds NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED notification, which is sent when the focused editable field is touched,
- Adds ChromeViewHostMsg_FocusedEditableNodeTouched IPC message, which is sent from renderer to browser when a touch released on the focused editable field,
- Changes RenderWidget to handle touch events in OnHandleInputEvent, and
- Handles NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED in KeyboardWidget to show keyboard.
BUG=none
TEST=Manual
Review URL: http://codereview.chromium.org/7923005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/render_view.cc | 5 | ||||
-rw-r--r-- | content/renderer/render_view.h | 2 | ||||
-rw-r--r-- | content/renderer/render_view_observer.h | 2 | ||||
-rw-r--r-- | content/renderer/render_widget.cc | 3 | ||||
-rw-r--r-- | content/renderer/render_widget.h | 5 |
5 files changed, 17 insertions, 0 deletions
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 8d08fab..91d9c2d 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -223,6 +223,7 @@ using WebKit::WebStorageQuotaType; using WebKit::WebString; using WebKit::WebTextAffinity; using WebKit::WebTextDirection; +using WebKit::WebTouchEvent; using WebKit::WebURL; using WebKit::WebURLError; using WebKit::WebURLRequest; @@ -3948,6 +3949,10 @@ void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); } +void RenderView::DidHandleTouchEvent(const WebTouchEvent& event) { + FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleTouchEvent(event)); +} + void RenderView::OnWasHidden() { RenderWidget::OnWasHidden(); diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index 245e196..31a3141 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -134,6 +134,7 @@ class WebPlugin; class WebSpeechInputController; class WebSpeechInputListener; class WebStorageNamespace; +class WebTouchEvent; class WebURLLoader; class WebURLRequest; class WebView; @@ -649,6 +650,7 @@ class RenderView : public RenderWidget, virtual bool WillHandleMouseEvent( const WebKit::WebMouseEvent& event) OVERRIDE; virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event); + virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event); virtual void OnSetFocus(bool enable); virtual void OnWasHidden(); virtual void OnWasRestored(bool needs_repainting); diff --git a/content/renderer/render_view_observer.h b/content/renderer/render_view_observer.h index de5dda5..6f42f86 100644 --- a/content/renderer/render_view_observer.h +++ b/content/renderer/render_view_observer.h @@ -21,6 +21,7 @@ class WebMediaPlayerClient; class WebMouseEvent; class WebNode; class WebString; +class WebTouchEvent; class WebURL; struct WebURLError; } @@ -67,6 +68,7 @@ class CONTENT_EXPORT RenderViewObserver : public IPC::Channel::Listener, // These match the RenderView methods. virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} + virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} virtual void WillCreateMediaPlayer(WebKit::WebFrame* frame, WebKit::WebMediaPlayerClient* client) {} diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 2f0dfc2..b57c11c 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -58,6 +58,7 @@ using WebKit::WebRect; using WebKit::WebScreenInfo; using WebKit::WebSize; using WebKit::WebTextDirection; +using WebKit::WebTouchEvent; using WebKit::WebVector; using WebKit::WebWidget; @@ -493,6 +494,8 @@ void RenderWidget::OnHandleInputEvent(const IPC::Message& message) { DidHandleKeyEvent(); if (WebInputEvent::isMouseEventType(input_event->type)) DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); + if (WebInputEvent::isTouchEventType(input_event->type)) + DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); } } diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index f44f289..624888b 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -46,6 +46,7 @@ class PlatformCanvas; namespace WebKit { class WebInputEvent; class WebMouseEvent; +class WebTouchEvent; class WebWidget; struct WebPopupMenuInfo; } @@ -314,6 +315,10 @@ class CONTENT_EXPORT RenderWidget // just handled. virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} + // Called by OnHandleInputEvent() to notify subclasses that a touch event was + // just handled. + virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} + // Routing ID that allows us to communicate to the parent browser process // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. int32 routing_id_; |