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

Unified Diff: content/renderer/render_widget.cc

Issue 1131093002: Implement direction-specific touch-action values (chromium side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify the axis clearing code Created 5 years, 7 months 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/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 94d484f72ed7a922a2fe850a9a5bd2611ff70e1c..6d34a517df6577df9bc10e39844eb57ba30f0895 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2322,6 +2322,13 @@ void RenderWidget::hasTouchEventHandlers(bool has_handlers) {
static_assert(int(blink::WebTouchAction##a) == int(TOUCH_ACTION_##b), \
"mismatching enums: " #a)
+inline content::TouchAction& operator|=(content::TouchAction& a,
+ content::TouchAction b) {
+ a = static_cast<content::TouchAction>(static_cast<int>(a) |
+ static_cast<int>(b));
+ return a;
+}
+
void RenderWidget::setTouchAction(
blink::WebTouchAction web_touch_action) {
@@ -2330,15 +2337,35 @@ void RenderWidget::setTouchAction(
if (handling_event_type_ != WebInputEvent::TouchStart)
return;
- // Verify the same values are used by the types so we can cast between them.
+// TODO(dtapuska): A dependant change needs to land in blink to change
+// the blink::WebTouchAction enum; in the meantime don't do
+// a static cast between the values. (http://crbug.com/476556)
+#if 0
+ // Verify the same values are used by the types so we can cast between them.
STATIC_ASSERT_WTI_ENUM_MATCH(Auto, AUTO);
STATIC_ASSERT_WTI_ENUM_MATCH(None, NONE);
+ STATIC_ASSERT_WTI_ENUM_MATCH(PanLeft, PAN_LEFT);
+ STATIC_ASSERT_WTI_ENUM_MATCH(PanRight, PAN_RIGHT);
STATIC_ASSERT_WTI_ENUM_MATCH(PanX, PAN_X);
+ STATIC_ASSERT_WTI_ENUM_MATCH(PanUp, PAN_UP);
+ STATIC_ASSERT_WTI_ENUM_MATCH(PanDown, PAN_DOWN);
STATIC_ASSERT_WTI_ENUM_MATCH(PanY, PAN_Y);
STATIC_ASSERT_WTI_ENUM_MATCH(PinchZoom, PINCH_ZOOM);
content::TouchAction content_touch_action =
static_cast<content::TouchAction>(web_touch_action);
+#else
+ content::TouchAction content_touch_action = TOUCH_ACTION_AUTO;
+ if (web_touch_action & blink::WebTouchActionNone)
+ content_touch_action |= TOUCH_ACTION_NONE;
+ if (web_touch_action & blink::WebTouchActionPanX)
+ content_touch_action |= TOUCH_ACTION_PAN_X;
+ if (web_touch_action & blink::WebTouchActionPanY)
+ content_touch_action |= TOUCH_ACTION_PAN_Y;
+ if (web_touch_action & blink::WebTouchActionPinchZoom)
+ content_touch_action |= TOUCH_ACTION_PINCH_ZOOM;
+
+#endif
Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action));
}
« no previous file with comments | « content/common/input/touch_action.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698