| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/input/synthetic_gesture_target_base.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
| 10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { | 42 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( | 45 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( |
| 46 const WebInputEvent& event) { | 46 const WebInputEvent& event) { |
| 47 TRACE_EVENT1("input", "SyntheticGestureTarget::DispatchInputEventToPlatform", | 47 TRACE_EVENT1("input", "SyntheticGestureTarget::DispatchInputEventToPlatform", |
| 48 "type", WebInputEvent::GetName(event.GetType())); | 48 "type", WebInputEvent::GetName(event.GetType())); |
| 49 | 49 |
| 50 ui::LatencyInfo latency_info; | 50 ui::LatencyInfo latency_info; |
| 51 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 51 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 52 | 52 |
| 53 if (WebInputEvent::IsTouchEventType(event.GetType())) { | 53 if (WebInputEvent::IsTouchEventType(event.GetType())) { |
| 54 const WebTouchEvent& web_touch = | 54 const WebTouchEvent& web_touch = |
| 55 static_cast<const WebTouchEvent&>(event); | 55 static_cast<const WebTouchEvent&>(event); |
| 56 | 56 |
| 57 // Check that all touch pointers are within the content bounds. | 57 // Check that all touch pointers are within the content bounds. |
| 58 for (unsigned i = 0; i < web_touch.touches_length; i++) | 58 for (unsigned i = 0; i < web_touch.touches_length; i++) |
| 59 CHECK(web_touch.touches[i].state != WebTouchPoint::kStatePressed || | 59 CHECK(web_touch.touches[i].state != WebTouchPoint::kStatePressed || |
| 60 PointIsWithinContents(web_touch.touches[i].PositionInWidget().x, | 60 PointIsWithinContents(web_touch.touches[i].PositionInWidget().x, |
| 61 web_touch.touches[i].PositionInWidget().y)) | 61 web_touch.touches[i].PositionInWidget().y)) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return 0.0f; | 124 return 0.0f; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { | 127 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { |
| 128 gfx::Rect bounds = host_->GetView()->GetViewBounds(); | 128 gfx::Rect bounds = host_->GetView()->GetViewBounds(); |
| 129 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). | 129 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). |
| 130 return bounds.Contains(x, y); | 130 return bounds.Contains(x, y); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace content | 133 } // namespace content |
| OLD | NEW |