Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 94d484f72ed7a922a2fe850a9a5bd2611ff70e1c..851e28df68584e6c2ac3e7c1d46ff29baa335203 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 |
|
Rick Byers
2015/05/07 20:37:37
nit: reference your bug number so someone who sees
dtapuska
2015/05/07 21:03:07
Done.
|
| +// the blink::WebTouchAction enum; in the meantime don't do |
| +// a static cast between the values. |
| +#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)); |
| } |