OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 } | 2329 } |
2330 | 2330 |
2331 void RenderWidget::setTouchAction( | 2331 void RenderWidget::setTouchAction( |
2332 blink::WebTouchAction web_touch_action) { | 2332 blink::WebTouchAction web_touch_action) { |
2333 | 2333 |
2334 // Ignore setTouchAction calls that result from synthetic touch events (eg. | 2334 // Ignore setTouchAction calls that result from synthetic touch events (eg. |
2335 // when blink is emulating touch with mouse). | 2335 // when blink is emulating touch with mouse). |
2336 if (handling_event_type_ != WebInputEvent::TouchStart) | 2336 if (handling_event_type_ != WebInputEvent::TouchStart) |
2337 return; | 2337 return; |
2338 | 2338 |
2339 // TODO(dtapuska): A dependant change needs to land in blink to change | |
2340 // the blink::WebTouchAction enum; in the meantime don't do | |
2341 // a static cast between the values. (http://crbug.com/476556) | |
2342 #if 0 | |
2343 // Verify the same values are used by the types so we can cast between them. | 2339 // Verify the same values are used by the types so we can cast between them. |
2344 STATIC_ASSERT_WTI_ENUM_MATCH(Auto, AUTO); | 2340 STATIC_ASSERT_WTI_ENUM_MATCH(Auto, AUTO); |
2345 STATIC_ASSERT_WTI_ENUM_MATCH(None, NONE); | 2341 STATIC_ASSERT_WTI_ENUM_MATCH(None, NONE); |
2346 STATIC_ASSERT_WTI_ENUM_MATCH(PanLeft, PAN_LEFT); | 2342 STATIC_ASSERT_WTI_ENUM_MATCH(PanLeft, PAN_LEFT); |
2347 STATIC_ASSERT_WTI_ENUM_MATCH(PanRight, PAN_RIGHT); | 2343 STATIC_ASSERT_WTI_ENUM_MATCH(PanRight, PAN_RIGHT); |
2348 STATIC_ASSERT_WTI_ENUM_MATCH(PanX, PAN_X); | 2344 STATIC_ASSERT_WTI_ENUM_MATCH(PanX, PAN_X); |
2349 STATIC_ASSERT_WTI_ENUM_MATCH(PanUp, PAN_UP); | 2345 STATIC_ASSERT_WTI_ENUM_MATCH(PanUp, PAN_UP); |
2350 STATIC_ASSERT_WTI_ENUM_MATCH(PanDown, PAN_DOWN); | 2346 STATIC_ASSERT_WTI_ENUM_MATCH(PanDown, PAN_DOWN); |
2351 STATIC_ASSERT_WTI_ENUM_MATCH(PanY, PAN_Y); | 2347 STATIC_ASSERT_WTI_ENUM_MATCH(PanY, PAN_Y); |
2352 STATIC_ASSERT_WTI_ENUM_MATCH(PinchZoom, PINCH_ZOOM); | 2348 STATIC_ASSERT_WTI_ENUM_MATCH(PinchZoom, PINCH_ZOOM); |
2353 | 2349 |
2354 content::TouchAction content_touch_action = | 2350 content::TouchAction content_touch_action = |
2355 static_cast<content::TouchAction>(web_touch_action); | 2351 static_cast<content::TouchAction>(web_touch_action); |
2356 #else | |
2357 content::TouchAction content_touch_action = TOUCH_ACTION_AUTO; | |
2358 if (web_touch_action & blink::WebTouchActionNone) | |
2359 content_touch_action |= TOUCH_ACTION_NONE; | |
2360 if (web_touch_action & blink::WebTouchActionPanX) | |
2361 content_touch_action |= TOUCH_ACTION_PAN_X; | |
2362 if (web_touch_action & blink::WebTouchActionPanY) | |
2363 content_touch_action |= TOUCH_ACTION_PAN_Y; | |
2364 if (web_touch_action & blink::WebTouchActionPinchZoom) | |
2365 content_touch_action |= TOUCH_ACTION_PINCH_ZOOM; | |
2366 | |
2367 #endif | |
2368 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2352 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
2369 } | 2353 } |
2370 | 2354 |
2371 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { | 2355 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { |
2372 #if defined(OS_ANDROID) | 2356 #if defined(OS_ANDROID) |
2373 text_field_is_dirty_ = true; | 2357 text_field_is_dirty_ = true; |
2374 #endif | 2358 #endif |
2375 } | 2359 } |
2376 | 2360 |
2377 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2361 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2450 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2467 video_hole_frames_.AddObserver(frame); | 2451 video_hole_frames_.AddObserver(frame); |
2468 } | 2452 } |
2469 | 2453 |
2470 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2454 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2471 video_hole_frames_.RemoveObserver(frame); | 2455 video_hole_frames_.RemoveObserver(frame); |
2472 } | 2456 } |
2473 #endif // defined(VIDEO_HOLE) | 2457 #endif // defined(VIDEO_HOLE) |
2474 | 2458 |
2475 } // namespace content | 2459 } // namespace content |
OLD | NEW |