Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
| index fd62be09bab88aaab1955bfea0dfb816db189378..8c704871799ff525d1a9b06474772b3cf37641b2 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -852,8 +852,12 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
| TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
| "x", mouse_event.x, "y", mouse_event.y); |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
| + coordinates.push_back(std::make_pair(mouse_event.x, mouse_event.y)); |
| + |
| ui::LatencyInfo latency_info = |
| - CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); |
| + CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type, |
| + coordinates); |
| for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
| if (mouse_event_callbacks_[i].Run(mouse_event)) |
| @@ -883,8 +887,12 @@ void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
| const ui::LatencyInfo& ui_latency) { |
| TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
| + coordinates.push_back(std::make_pair(wheel_event.x, wheel_event.y)); |
| + |
| ui::LatencyInfo latency_info = |
| - CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); |
| + CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type, |
| + coordinates); |
| if (IgnoreInputEvents()) |
| return; |
| @@ -912,8 +920,12 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| if (delegate_->PreHandleGestureEvent(gesture_event)) |
| return; |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
| + coordinates.push_back(std::make_pair(gesture_event.x, gesture_event.y)); |
| + |
| ui::LatencyInfo latency_info = |
| - CreateRWHLatencyInfoIfNotExist(&ui_latency, gesture_event.type); |
| + CreateRWHLatencyInfoIfNotExist(&ui_latency, gesture_event.type, |
| + coordinates); |
| if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate) { |
| latency_info.AddLatencyNumber( |
| @@ -944,8 +956,15 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
| const blink::WebTouchEvent& touch_event) { |
| TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); |
| + |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
| + for (size_t i = 0; i < touch_event.touches_length; i++) |
|
Sami
2014/09/04 19:10:43
Add {}
cvicentiu
2014/09/05 17:19:56
Done.
|
| + coordinates.push_back(std::make_pair( |
| + touch_event.touches[i].position.x, |
| + touch_event.touches[i].position.y)); |
| + |
| ui::LatencyInfo latency_info = |
| - CreateRWHLatencyInfoIfNotExist(NULL, touch_event.type); |
| + CreateRWHLatencyInfoIfNotExist(NULL, touch_event.type, coordinates); |
| TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); |
| input_router_->SendTouchEvent(touch_with_latency); |
| } |
| @@ -957,9 +976,16 @@ void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
| // Always forward TouchEvents for touch stream consistency. They will be |
| // ignored if appropriate in FilterInputEvent(). |
| + // |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
| + for (size_t i = 0; i < touch_event.touches_length; i++) |
|
Sami
2014/09/04 19:10:43
Add {}
cvicentiu
2014/09/05 17:19:56
Done.
|
| + coordinates.push_back(std::make_pair( |
| + touch_event.touches[i].position.x, |
| + touch_event.touches[i].position.y)); |
| ui::LatencyInfo latency_info = |
| - CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); |
| + CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type, |
| + coordinates); |
| TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); |
| if (touch_emulator_ && |
| @@ -1038,9 +1064,11 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent( |
| if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
| return; |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates; |
|
Sami
2014/09/04 19:10:43
Add a comment saying key events have no coordinate
cvicentiu
2014/09/05 17:19:56
Done.
|
| + |
| input_router_->SendKeyboardEvent( |
| key_event, |
| - CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), |
| + CreateRWHLatencyInfoIfNotExist(NULL, key_event.type, coordinates), |
| is_shortcut); |
| } |
| @@ -1083,10 +1111,16 @@ void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
| } |
| ui::LatencyInfo RenderWidgetHostImpl::CreateRWHLatencyInfoIfNotExist( |
| - const ui::LatencyInfo* original, WebInputEvent::Type type) { |
| + const ui::LatencyInfo* original, WebInputEvent::Type type, |
| + ui::LatencyInfo::LatencyScreenCoordinates coordinates) { |
|
Sami
2014/09/04 19:10:43
Make this parameter a const ref:
const ui::La
cvicentiu
2014/09/05 17:19:56
Done.
|
| +/* printf("["); |
| + for (size_t i = 0; i < coordinates.num_coordinates; i++) |
| + printf("(%d %d) ", coordinates.x[i], coordinates.y[i]); |
| + printf("]\n");*/ |
| ui::LatencyInfo info; |
| if (original) |
| info = *original; |
| + info.coordinates = coordinates; |
| // In Aura, gesture event will already carry its original touch event's |
| // INPUT_EVENT_LATENCY_RWH_COMPONENT. |
| if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |