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

Unified Diff: content/renderer/render_widget.cc

Issue 67383002: Initial browser-side implementation for touch-action (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak include for moved synthetic_web_input_event_builders.h Created 7 years 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 | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 4a3712332071f7c33a439938964a56bd7b87d7fc..ea6e622fa76f660f9b5202c5840161bf18f994c5 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -356,6 +356,7 @@ RenderWidget::RenderWidget(blink::WebPopupType popup_type,
has_focus_(false),
handling_input_event_(false),
handling_ime_event_(false),
+ handling_touchstart_event_(false),
closing_(false),
is_swapped_out_(swapped_out),
input_method_is_active_(false),
@@ -1105,6 +1106,9 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
input_event->type == WebInputEvent::GestureLongPress)
resetInputMethod();
+ if (input_event->type == WebInputEvent::TouchStart)
+ handling_touchstart_event_ = true;
+
bool processed = prevent_default;
if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) {
suppress_next_char_events_ = false;
@@ -1112,6 +1116,8 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
processed = webwidget_->handleInputEvent(*input_event);
}
+ handling_touchstart_event_ = false;
+
// If this RawKeyDown event corresponds to a browser keyboard shortcut and
// it's not processed by webkit, then we need to suppress the upcoming Char
// events.
@@ -2783,6 +2789,28 @@ void RenderWidget::hasTouchEventHandlers(bool has_handlers) {
Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers));
}
+void RenderWidget::setTouchAction(
+ blink::WebTouchAction web_touch_action) {
+
+ // Ignore setTouchAction calls that result from synthetic touch events (eg.
+ // when blink is emulating touch with mouse).
+ if (!handling_touchstart_event_)
+ return;
+
+ content::TouchAction content_touch_action;
+ switch(web_touch_action) {
+ case blink::WebTouchActionNone:
+ content_touch_action = content::TOUCH_ACTION_NONE;
+ break;
+ case blink::WebTouchActionAuto:
+ content_touch_action = content::TOUCH_ACTION_AUTO;
+ break;
+ default:
+ NOTREACHED();
+ }
+ Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action));
+}
+
bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const {
return true;
}
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698