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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 MouseWheelEventWithLatencyInfo(wheel_event, | 981 MouseWheelEventWithLatencyInfo(wheel_event, |
982 CreateRWHLatencyInfoIfNotExist(NULL))); | 982 CreateRWHLatencyInfoIfNotExist(NULL))); |
983 } | 983 } |
984 | 984 |
985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
986 const MouseWheelEventWithLatencyInfo& wheel_event) { | 986 const MouseWheelEventWithLatencyInfo& wheel_event) { |
987 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 987 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
988 if (IgnoreInputEvents()) | 988 if (IgnoreInputEvents()) |
989 return; | 989 return; |
990 | 990 |
991 if (delegate_->PreHandleWheelEvent(wheel_event.event)) | |
992 return; | |
993 | 991 |
994 input_router_->SendWheelEvent(wheel_event); | 992 input_router_->SendWheelEvent(wheel_event); |
995 } | 993 } |
996 | 994 |
997 void RenderWidgetHostImpl::ForwardGestureEvent( | 995 void RenderWidgetHostImpl::ForwardGestureEvent( |
998 const blink::WebGestureEvent& gesture_event) { | 996 const blink::WebGestureEvent& gesture_event) { |
999 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 997 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
1000 } | 998 } |
1001 | 999 |
1002 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 1000 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 if (!wheel_event.latency.FindLatency( | 2034 if (!wheel_event.latency.FindLatency( |
2037 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2035 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
2038 // MouseWheelEvent latency ends when it is acked but does not cause any | 2036 // MouseWheelEvent latency ends when it is acked but does not cause any |
2039 // rendering scheduled. | 2037 // rendering scheduled. |
2040 ui::LatencyInfo latency = wheel_event.latency; | 2038 ui::LatencyInfo latency = wheel_event.latency; |
2041 latency.AddLatencyNumber( | 2039 latency.AddLatencyNumber( |
2042 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); | 2040 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); |
2043 } | 2041 } |
2044 | 2042 |
2045 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); | 2043 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); |
| 2044 if (!processed) { |
| 2045 if (delegate_->PreHandleWheelEvent(wheel_event.event)) |
| 2046 return; |
| 2047 } |
2046 if (!processed && !is_hidden() && view_) | 2048 if (!processed && !is_hidden() && view_) |
2047 view_->UnhandledWheelEvent(wheel_event.event); | 2049 view_->UnhandledWheelEvent(wheel_event.event); |
2048 } | 2050 } |
2049 | 2051 |
2050 void RenderWidgetHostImpl::OnGestureEventAck( | 2052 void RenderWidgetHostImpl::OnGestureEventAck( |
2051 const GestureEventWithLatencyInfo& event, | 2053 const GestureEventWithLatencyInfo& event, |
2052 InputEventAckState ack_result) { | 2054 InputEventAckState ack_result) { |
2053 if (!event.latency.FindLatency( | 2055 if (!event.latency.FindLatency( |
2054 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2056 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
2055 // GestureEvent latency ends when it is acked but does not cause any | 2057 // GestureEvent latency ends when it is acked but does not cause any |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 continue; | 2486 continue; |
2485 } | 2487 } |
2486 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | 2488 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); |
2487 if (rwhi_set.insert(rwhi).second) | 2489 if (rwhi_set.insert(rwhi).second) |
2488 rwhi->FrameSwapped(latency_info); | 2490 rwhi->FrameSwapped(latency_info); |
2489 } | 2491 } |
2490 } | 2492 } |
2491 } | 2493 } |
2492 | 2494 |
2493 } // namespace content | 2495 } // namespace content |
OLD | NEW |