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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2006 | 2006 |
2007 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { | 2007 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
2008 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); | 2008 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); |
2009 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2009 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
2010 return; | 2010 return; |
2011 | 2011 |
2012 // Update the touch event first. | 2012 // Update the touch event first. |
2013 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, | 2013 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, |
2014 &touch_event_); | 2014 &touch_event_); |
2015 | 2015 |
2016 // Forward the touch event only if a touch point was updated, and there's a | 2016 // Forward the touch event only if a touch point was updated, and |
jdduke (slow)
2014/11/17 16:57:13
Would it make any sense to split out the point is
tdresser
2014/11/17 22:00:36
Done.
Feels about 1% worse this way to me - what d
jdduke (slow)
2014/11/17 22:23:15
I was hoping we could get rid of the |DisableSynch
| |
2017 // touch-event handler in the page, and no other touch-event is in the queue. | 2017 // there's a touch-event handler in the page, and no other |
2018 // It is important to always consume the event if there is a touch-event | 2018 // touch-event is in the queue. It is important to always mark |
2019 // handler in the page, or some touch-event is already in the queue, even if | 2019 // events as being handled asynchronously if there is a touch-event |
2020 // no point has been updated, to make sure that this event does not get | 2020 // handler in the page, or some touch-event is already in the queue, |
2021 // processed by the gesture recognizer before the events in the queue. | 2021 // even if no point has been updated. This ensures that this event |
2022 if (host_->ShouldForwardTouchEvent()) | 2022 // does not get processed by the gesture recognizer before events |
2023 event->StopPropagation(); | 2023 // currently awaiting dispatch in the touch queue. |
2024 if (host_->ShouldForwardTouchEvent()) { | |
2025 event->DisableSynchronousHandling(); | |
2026 if (point) { | |
2027 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); | |
2028 } else { | |
2029 // Fake an ack for the invalid touch event. | |
2030 DCHECK(window_->GetHost()); | |
2031 window_->GetHost()->dispatcher()->ProcessedTouchEvent(event, window_, | |
jdduke (slow)
2014/11/17 16:57:13
It seems like this could cause us to get some out-
tdresser
2014/11/17 22:00:36
Gah, you're right, that could potentially break th
jdduke (slow)
2014/11/17 22:23:15
Well, ideally this method would be: |OnTouchEvent(
| |
2032 ui::ER_HANDLED); | |
2033 } | |
2034 } | |
2024 | 2035 |
2025 if (point) { | 2036 if (point) |
2026 if (host_->ShouldForwardTouchEvent()) | |
2027 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); | |
2028 UpdateWebTouchEventAfterDispatch(&touch_event_, point); | 2037 UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
2029 } | |
2030 } | 2038 } |
2031 | 2039 |
2032 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { | 2040 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |
2033 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); | 2041 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); |
2034 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 2042 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
2035 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 2043 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
2036 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { | 2044 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { |
2037 event->SetHandled(); | 2045 event->SetHandled(); |
2038 return; | 2046 return; |
2039 } | 2047 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2551 | 2559 |
2552 //////////////////////////////////////////////////////////////////////////////// | 2560 //////////////////////////////////////////////////////////////////////////////// |
2553 // RenderWidgetHostViewBase, public: | 2561 // RenderWidgetHostViewBase, public: |
2554 | 2562 |
2555 // static | 2563 // static |
2556 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2564 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2557 GetScreenInfoForWindow(results, NULL); | 2565 GetScreenInfoForWindow(results, NULL); |
2558 } | 2566 } |
2559 | 2567 |
2560 } // namespace content | 2568 } // namespace content |
OLD | NEW |