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 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 if (render_widget_scheduling_state_) | 2255 if (render_widget_scheduling_state_) |
2256 render_widget_scheduling_state_->SetHasTouchHandler(has_handlers); | 2256 render_widget_scheduling_state_->SetHasTouchHandler(has_handlers); |
2257 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2257 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
2258 } | 2258 } |
2259 | 2259 |
2260 // Check blink::WebTouchAction and blink::WebTouchActionAuto is kept in sync | 2260 // Check blink::WebTouchAction and blink::WebTouchActionAuto is kept in sync |
2261 #define STATIC_ASSERT_WTI_ENUM_MATCH(a, b)
\ | 2261 #define STATIC_ASSERT_WTI_ENUM_MATCH(a, b)
\ |
2262 static_assert(int(blink::WebTouchAction##a) == int(TOUCH_ACTION_##b), \ | 2262 static_assert(int(blink::WebTouchAction##a) == int(TOUCH_ACTION_##b), \ |
2263 "mismatching enums: " #a) | 2263 "mismatching enums: " #a) |
2264 | 2264 |
2265 inline content::TouchAction& operator|=(content::TouchAction& a, | |
2266 content::TouchAction b) { | |
2267 a = static_cast<content::TouchAction>(static_cast<int>(a) | | |
2268 static_cast<int>(b)); | |
2269 return a; | |
2270 } | |
2271 | |
2272 void RenderWidget::setTouchAction( | 2265 void RenderWidget::setTouchAction( |
2273 blink::WebTouchAction web_touch_action) { | 2266 blink::WebTouchAction web_touch_action) { |
2274 | 2267 |
2275 // Ignore setTouchAction calls that result from synthetic touch events (eg. | 2268 // Ignore setTouchAction calls that result from synthetic touch events (eg. |
2276 // when blink is emulating touch with mouse). | 2269 // when blink is emulating touch with mouse). |
2277 if (handling_event_type_ != WebInputEvent::TouchStart) | 2270 if (handling_event_type_ != WebInputEvent::TouchStart) |
2278 return; | 2271 return; |
2279 | 2272 |
2280 // Verify the same values are used by the types so we can cast between them. | 2273 // Verify the same values are used by the types so we can cast between them. |
2281 STATIC_ASSERT_WTI_ENUM_MATCH(Auto, AUTO); | |
2282 STATIC_ASSERT_WTI_ENUM_MATCH(None, NONE); | 2274 STATIC_ASSERT_WTI_ENUM_MATCH(None, NONE); |
2283 STATIC_ASSERT_WTI_ENUM_MATCH(PanLeft, PAN_LEFT); | 2275 STATIC_ASSERT_WTI_ENUM_MATCH(PanLeft, PAN_LEFT); |
2284 STATIC_ASSERT_WTI_ENUM_MATCH(PanRight, PAN_RIGHT); | 2276 STATIC_ASSERT_WTI_ENUM_MATCH(PanRight, PAN_RIGHT); |
2285 STATIC_ASSERT_WTI_ENUM_MATCH(PanX, PAN_X); | 2277 STATIC_ASSERT_WTI_ENUM_MATCH(PanX, PAN_X); |
2286 STATIC_ASSERT_WTI_ENUM_MATCH(PanUp, PAN_UP); | 2278 STATIC_ASSERT_WTI_ENUM_MATCH(PanUp, PAN_UP); |
2287 STATIC_ASSERT_WTI_ENUM_MATCH(PanDown, PAN_DOWN); | 2279 STATIC_ASSERT_WTI_ENUM_MATCH(PanDown, PAN_DOWN); |
2288 STATIC_ASSERT_WTI_ENUM_MATCH(PanY, PAN_Y); | 2280 STATIC_ASSERT_WTI_ENUM_MATCH(PanY, PAN_Y); |
| 2281 STATIC_ASSERT_WTI_ENUM_MATCH(Pan, PAN); |
2289 STATIC_ASSERT_WTI_ENUM_MATCH(PinchZoom, PINCH_ZOOM); | 2282 STATIC_ASSERT_WTI_ENUM_MATCH(PinchZoom, PINCH_ZOOM); |
| 2283 STATIC_ASSERT_WTI_ENUM_MATCH(Manipulation, MANIPULATION); |
| 2284 STATIC_ASSERT_WTI_ENUM_MATCH(DoubleTapZoom, DOUBLE_TAP_ZOOM); |
| 2285 STATIC_ASSERT_WTI_ENUM_MATCH(Auto, AUTO); |
2290 | 2286 |
2291 content::TouchAction content_touch_action = | 2287 content::TouchAction content_touch_action = |
2292 static_cast<content::TouchAction>(web_touch_action); | 2288 static_cast<content::TouchAction>(web_touch_action); |
2293 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2289 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
2294 } | 2290 } |
2295 | 2291 |
2296 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { | 2292 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { |
2297 #if defined(OS_ANDROID) | 2293 #if defined(OS_ANDROID) |
2298 text_field_is_dirty_ = true; | 2294 text_field_is_dirty_ = true; |
2299 #endif | 2295 #endif |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2393 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2398 video_hole_frames_.AddObserver(frame); | 2394 video_hole_frames_.AddObserver(frame); |
2399 } | 2395 } |
2400 | 2396 |
2401 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2397 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2402 video_hole_frames_.RemoveObserver(frame); | 2398 video_hole_frames_.RemoveObserver(frame); |
2403 } | 2399 } |
2404 #endif // defined(VIDEO_HOLE) | 2400 #endif // defined(VIDEO_HOLE) |
2405 | 2401 |
2406 } // namespace content | 2402 } // namespace content |
OLD | NEW |