| 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_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 const TouchEventWithLatencyInfo& touch, | 1015 const TouchEventWithLatencyInfo& touch, |
| 1016 InputEventAckState ack_result) { | 1016 InputEventAckState ack_result) { |
| 1017 ScopedVector<ui::TouchEvent> events; | 1017 ScopedVector<ui::TouchEvent> events; |
| 1018 aura::WindowTreeHost* host = window_->GetHost(); | 1018 aura::WindowTreeHost* host = window_->GetHost(); |
| 1019 // |host| is NULL during tests. | 1019 // |host| is NULL during tests. |
| 1020 if (!host) | 1020 if (!host) |
| 1021 return; | 1021 return; |
| 1022 | 1022 |
| 1023 // The TouchScrollStarted event is generated & consumed downstream from the | 1023 // The TouchScrollStarted event is generated & consumed downstream from the |
| 1024 // TouchEventQueue. So we don't expect an ACK up here. | 1024 // TouchEventQueue. So we don't expect an ACK up here. |
| 1025 DCHECK(touch.event.type != blink::WebInputEvent::TouchScrollStarted); | 1025 DCHECK(touch.event.type() != blink::WebInputEvent::TouchScrollStarted); |
| 1026 | 1026 |
| 1027 ui::EventResult result = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 1027 ui::EventResult result = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
| 1028 ? ui::ER_HANDLED | 1028 ? ui::ER_HANDLED |
| 1029 : ui::ER_UNHANDLED; | 1029 : ui::ER_UNHANDLED; |
| 1030 | 1030 |
| 1031 blink::WebTouchPoint::State required_state; | 1031 blink::WebTouchPoint::State required_state; |
| 1032 switch (touch.event.type) { | 1032 switch (touch.event.type()) { |
| 1033 case blink::WebInputEvent::TouchStart: | 1033 case blink::WebInputEvent::TouchStart: |
| 1034 required_state = blink::WebTouchPoint::StatePressed; | 1034 required_state = blink::WebTouchPoint::StatePressed; |
| 1035 break; | 1035 break; |
| 1036 case blink::WebInputEvent::TouchEnd: | 1036 case blink::WebInputEvent::TouchEnd: |
| 1037 required_state = blink::WebTouchPoint::StateReleased; | 1037 required_state = blink::WebTouchPoint::StateReleased; |
| 1038 break; | 1038 break; |
| 1039 case blink::WebInputEvent::TouchMove: | 1039 case blink::WebInputEvent::TouchMove: |
| 1040 required_state = blink::WebTouchPoint::StateMoved; | 1040 required_state = blink::WebTouchPoint::StateMoved; |
| 1041 break; | 1041 break; |
| 1042 case blink::WebInputEvent::TouchCancel: | 1042 case blink::WebInputEvent::TouchCancel: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1062 | 1062 |
| 1063 std::unique_ptr<SyntheticGestureTarget> | 1063 std::unique_ptr<SyntheticGestureTarget> |
| 1064 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { | 1064 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { |
| 1065 return std::unique_ptr<SyntheticGestureTarget>( | 1065 return std::unique_ptr<SyntheticGestureTarget>( |
| 1066 new SyntheticGestureTargetAura(host_)); | 1066 new SyntheticGestureTargetAura(host_)); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( | 1069 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( |
| 1070 const blink::WebInputEvent& input_event) { | 1070 const blink::WebInputEvent& input_event) { |
| 1071 bool consumed = false; | 1071 bool consumed = false; |
| 1072 if (input_event.type == WebInputEvent::GestureFlingStart) { | 1072 if (input_event.type() == WebInputEvent::GestureFlingStart) { |
| 1073 const WebGestureEvent& gesture_event = | 1073 const WebGestureEvent& gesture_event = |
| 1074 static_cast<const WebGestureEvent&>(input_event); | 1074 static_cast<const WebGestureEvent&>(input_event); |
| 1075 // Zero-velocity touchpad flings are an Aura-specific signal that the | 1075 // Zero-velocity touchpad flings are an Aura-specific signal that the |
| 1076 // touchpad scroll has ended, and should not be forwarded to the renderer. | 1076 // touchpad scroll has ended, and should not be forwarded to the renderer. |
| 1077 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && | 1077 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && |
| 1078 !gesture_event.data.flingStart.velocityX && | 1078 !gesture_event.data.flingStart.velocityX && |
| 1079 !gesture_event.data.flingStart.velocityY) { | 1079 !gesture_event.data.flingStart.velocityY) { |
| 1080 consumed = true; | 1080 consumed = true; |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 if (overscroll_controller_) | 1084 if (overscroll_controller_) |
| 1085 consumed |= overscroll_controller_->WillHandleEvent(input_event); | 1085 consumed |= overscroll_controller_->WillHandleEvent(input_event); |
| 1086 | 1086 |
| 1087 // Touch events should always propagate to the renderer. | 1087 // Touch events should always propagate to the renderer. |
| 1088 if (WebTouchEvent::isTouchEventType(input_event.type)) | 1088 if (WebTouchEvent::isTouchEventType(input_event.type())) |
| 1089 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1089 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 1090 | 1090 |
| 1091 if (consumed && input_event.type == blink::WebInputEvent::GestureFlingStart) { | 1091 if (consumed && |
| 1092 input_event.type() == blink::WebInputEvent::GestureFlingStart) { |
| 1092 // Here we indicate that there was no consumer for this event, as | 1093 // Here we indicate that there was no consumer for this event, as |
| 1093 // otherwise the fling animation system will try to run an animation | 1094 // otherwise the fling animation system will try to run an animation |
| 1094 // and will also expect a notification when the fling ends. Since | 1095 // and will also expect a notification when the fling ends. Since |
| 1095 // CrOS just uses the GestureFlingStart with zero-velocity as a means | 1096 // CrOS just uses the GestureFlingStart with zero-velocity as a means |
| 1096 // of indicating that touchpad scroll has ended, we don't actually want | 1097 // of indicating that touchpad scroll has ended, we don't actually want |
| 1097 // a fling animation. Note: Similar code exists in | 1098 // a fling animation. Note: Similar code exists in |
| 1098 // RenderWidgetHostViewChildFrame::FilterInputEvent() | 1099 // RenderWidgetHostViewChildFrame::FilterInputEvent() |
| 1099 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 1100 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 1100 } | 1101 } |
| 1101 | 1102 |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2381 |
| 2381 void RenderWidgetHostViewAura::SetPopupChild( | 2382 void RenderWidgetHostViewAura::SetPopupChild( |
| 2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2383 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2383 popup_child_host_view_ = popup_child_host_view; | 2384 popup_child_host_view_ = popup_child_host_view; |
| 2384 event_handler_->SetPopupChild( | 2385 event_handler_->SetPopupChild( |
| 2385 popup_child_host_view, | 2386 popup_child_host_view, |
| 2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2387 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2387 } | 2388 } |
| 2388 | 2389 |
| 2389 } // namespace content | 2390 } // namespace content |
| OLD | NEW |