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

Unified Diff: content/renderer/render_widget.cc

Issue 93733005: Implement support for touch-action: pan-x/pan-y in chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Apply jdduke CR feedback 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
« content/common/input/touch_action.h ('K') | « content/common/input/touch_action.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 852e94e1c8b4f396f31692c1ee66f72f20195141..2b58b7e0f225de65f95d09c0f7e228add641ac22 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2798,17 +2798,22 @@ void RenderWidget::setTouchAction(
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();
- }
+ // Verify the same values are used by the types so we can cast between them.
+ COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_AUTO) ==
+ blink::WebTouchActionAuto,
+ enum_values_must_match_for_touch_action);
+ COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_NONE) ==
+ blink::WebTouchActionNone,
+ enum_values_must_match_for_touch_action);
+ COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_PAN_X) ==
+ blink::WebTouchActionPanX,
+ enum_values_must_match_for_touch_action);
+ COMPILE_ASSERT(static_cast<blink::WebTouchAction>(TOUCH_ACTION_PAN_Y) ==
+ blink::WebTouchActionPanY,
+ enum_values_must_match_for_touch_action);
+
+ content::TouchAction content_touch_action =
+ static_cast<content::TouchAction>(web_touch_action);
Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action));
}
« content/common/input/touch_action.h ('K') | « content/common/input/touch_action.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698