OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include "content/browser/gpu/compositor_util.h" | 26 #include "content/browser/gpu/compositor_util.h" |
27 #include "content/browser/renderer_host/render_view_host_impl.h" | 27 #include "content/browser/renderer_host/render_view_host_impl.h" |
28 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 28 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
29 #include "content/browser/renderer_host/render_widget_host_impl.h" | 29 #include "content/browser/renderer_host/render_widget_host_impl.h" |
30 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 30 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
31 #include "content/common/text_input_state.h" | 31 #include "content/common/text_input_state.h" |
32 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/common/browser_plugin_guest_mode.h" | 34 #include "content/public/common/browser_plugin_guest_mode.h" |
35 #include "gpu/ipc/common/gpu_messages.h" | 35 #include "gpu/ipc/common/gpu_messages.h" |
36 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
36 #include "ui/gfx/geometry/size_conversions.h" | 37 #include "ui/gfx/geometry/size_conversions.h" |
37 #include "ui/gfx/geometry/size_f.h" | 38 #include "ui/gfx/geometry/size_f.h" |
38 | 39 |
39 namespace content { | 40 namespace content { |
40 | 41 |
41 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 42 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
42 RenderWidgetHost* widget_host) | 43 RenderWidgetHost* widget_host) |
43 : host_(RenderWidgetHostImpl::From(widget_host)), | 44 : host_(RenderWidgetHostImpl::From(widget_host)), |
44 next_surface_sequence_(1u), | 45 next_surface_sequence_(1u), |
45 last_output_surface_id_(0), | 46 last_output_surface_id_(0), |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 | 655 |
655 observing_begin_frame_source_ = needs_begin_frames; | 656 observing_begin_frame_source_ = needs_begin_frames; |
656 if (begin_frame_source_) { | 657 if (begin_frame_source_) { |
657 if (observing_begin_frame_source_) | 658 if (observing_begin_frame_source_) |
658 begin_frame_source_->AddObserver(this); | 659 begin_frame_source_->AddObserver(this); |
659 else | 660 else |
660 begin_frame_source_->RemoveObserver(this); | 661 begin_frame_source_->RemoveObserver(this); |
661 } | 662 } |
662 } | 663 } |
663 | 664 |
665 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( | |
666 const blink::WebInputEvent& input_event) { | |
667 if (input_event.type == blink::WebInputEvent::GestureFlingStart) { | |
668 const blink::WebGestureEvent& gesture_event = | |
669 static_cast<const blink::WebGestureEvent&>(input_event); | |
670 // Zero-velocity touchpad flings are an Aura-specific signal that the | |
671 // touchpad scroll has ended, and should not be forwarded to the renderer. | |
672 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && | |
673 !gesture_event.data.flingStart.velocityX && | |
674 !gesture_event.data.flingStart.velocityY) { | |
675 // Reporting consumed for a fling suggests that there's now an *active* | |
676 // fling that requires both animation and a fling-end notification. | |
677 // However, the here we've just indicated touchpad scroll has ended, and | |
wjmaclean
2016/07/22 00:42:01
I'll remove the redundant 'the' before landing.
| |
678 // we're not going to actually tick a fling animation. Report no consumer | |
679 // to convey this. | |
680 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | |
681 } | |
682 } | |
683 | |
684 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | |
685 } | |
686 | |
664 BrowserAccessibilityManager* | 687 BrowserAccessibilityManager* |
665 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 688 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
666 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { | 689 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { |
667 return BrowserAccessibilityManager::Create( | 690 return BrowserAccessibilityManager::Create( |
668 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 691 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
669 } | 692 } |
670 | 693 |
671 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 694 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
672 if (surface_factory_ && !surface_id_.is_null()) | 695 if (surface_factory_ && !surface_id_.is_null()) |
673 surface_factory_->Destroy(surface_id_); | 696 surface_factory_->Destroy(surface_id_); |
674 surface_id_ = cc::SurfaceId(); | 697 surface_id_ = cc::SurfaceId(); |
675 } | 698 } |
676 | 699 |
677 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 700 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
678 return true; | 701 return true; |
679 } | 702 } |
680 | 703 |
681 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 704 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
682 return surface_id_; | 705 return surface_id_; |
683 }; | 706 }; |
684 | 707 |
685 } // namespace content | 708 } // namespace content |
OLD | NEW |