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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 const blink::WebMouseWheelEvent& wheel_event, | 965 const blink::WebMouseWheelEvent& wheel_event, |
966 const ui::LatencyInfo& ui_latency) { | 966 const ui::LatencyInfo& ui_latency) { |
967 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 967 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
968 | 968 |
969 ui::LatencyInfo latency_info = | 969 ui::LatencyInfo latency_info = |
970 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); | 970 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); |
971 | 971 |
972 if (IgnoreInputEvents()) | 972 if (IgnoreInputEvents()) |
973 return; | 973 return; |
974 | 974 |
975 if (delegate_->PreHandleWheelEvent(wheel_event)) | |
976 return; | |
977 | |
978 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, | 975 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, |
979 latency_info)); | 976 latency_info)); |
980 } | 977 } |
981 | 978 |
982 void RenderWidgetHostImpl::ForwardGestureEvent( | 979 void RenderWidgetHostImpl::ForwardGestureEvent( |
983 const blink::WebGestureEvent& gesture_event) { | 980 const blink::WebGestureEvent& gesture_event) { |
984 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 981 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
985 } | 982 } |
986 | 983 |
987 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 984 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 if (!wheel_event.latency.FindLatency( | 2043 if (!wheel_event.latency.FindLatency( |
2047 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2044 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
2048 // MouseWheelEvent latency ends when it is acked but does not cause any | 2045 // MouseWheelEvent latency ends when it is acked but does not cause any |
2049 // rendering scheduled. | 2046 // rendering scheduled. |
2050 ui::LatencyInfo latency = wheel_event.latency; | 2047 ui::LatencyInfo latency = wheel_event.latency; |
2051 latency.AddLatencyNumber( | 2048 latency.AddLatencyNumber( |
2052 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); | 2049 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); |
2053 } | 2050 } |
2054 | 2051 |
2055 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); | 2052 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); |
2056 if (!processed && !is_hidden() && view_) | 2053 if (!processed && !is_hidden()) { |
2057 view_->UnhandledWheelEvent(wheel_event.event); | 2054 if (delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) |
| 2055 return; |
| 2056 if (view_) |
| 2057 view_->UnhandledWheelEvent(wheel_event.event); |
| 2058 } |
2058 } | 2059 } |
2059 | 2060 |
2060 void RenderWidgetHostImpl::OnGestureEventAck( | 2061 void RenderWidgetHostImpl::OnGestureEventAck( |
2061 const GestureEventWithLatencyInfo& event, | 2062 const GestureEventWithLatencyInfo& event, |
2062 InputEventAckState ack_result) { | 2063 InputEventAckState ack_result) { |
2063 if (!event.latency.FindLatency( | 2064 if (!event.latency.FindLatency( |
2064 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2065 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
2065 // GestureEvent latency ends when it is acked but does not cause any | 2066 // GestureEvent latency ends when it is acked but does not cause any |
2066 // rendering scheduled. | 2067 // rendering scheduled. |
2067 ui::LatencyInfo latency = event.latency; | 2068 ui::LatencyInfo latency = event.latency; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 } | 2529 } |
2529 } | 2530 } |
2530 | 2531 |
2531 // Add newly generated components into the latency info | 2532 // Add newly generated components into the latency info |
2532 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2533 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2533 latency_info->latency_components[lc->first] = lc->second; | 2534 latency_info->latency_components[lc->first] = lc->second; |
2534 } | 2535 } |
2535 } | 2536 } |
2536 | 2537 |
2537 } // namespace content | 2538 } // namespace content |
OLD | NEW |