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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 | 649 |
649 observing_begin_frame_source_ = needs_begin_frames; | 650 observing_begin_frame_source_ = needs_begin_frames; |
650 if (begin_frame_source_) { | 651 if (begin_frame_source_) { |
651 if (observing_begin_frame_source_) | 652 if (observing_begin_frame_source_) |
652 begin_frame_source_->AddObserver(this); | 653 begin_frame_source_->AddObserver(this); |
653 else | 654 else |
654 begin_frame_source_->RemoveObserver(this); | 655 begin_frame_source_->RemoveObserver(this); |
655 } | 656 } |
656 } | 657 } |
657 | 658 |
659 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( | |
660 const blink::WebInputEvent& input_event) { | |
661 if (input_event.type == blink::WebInputEvent::GestureFlingStart) { | |
662 const blink::WebGestureEvent& gesture_event = | |
663 static_cast<const blink::WebGestureEvent&>(input_event); | |
664 // Zero-velocity touchpad flings are an Aura-specific signal that the | |
665 // touchpad scroll has ended, and should not be forwarded to the renderer. | |
666 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && | |
667 !gesture_event.data.flingStart.velocityX && | |
668 !gesture_event.data.flingStart.velocityY) { | |
669 // Reporting consumed for a fling suggests that there's now an *active* | |
Charlie Reis
2016/07/22 17:25:55
nit: Can you rephrase? I'm not sure what "Reporti
| |
670 // fling that requires both animation and a fling-end notification. | |
671 // However, here we've just indicated touchpad scroll has ended, and | |
672 // we're not going to actually tick a fling animation. Report no consumer | |
Charlie Reis
2016/07/22 17:25:55
tick?
| |
673 // to convey this. | |
674 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | |
675 } | |
676 } | |
677 | |
678 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | |
679 } | |
680 | |
658 BrowserAccessibilityManager* | 681 BrowserAccessibilityManager* |
659 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 682 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
660 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { | 683 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { |
661 return BrowserAccessibilityManager::Create( | 684 return BrowserAccessibilityManager::Create( |
662 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 685 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
663 } | 686 } |
664 | 687 |
665 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 688 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
666 if (surface_factory_ && !surface_id_.is_null()) | 689 if (surface_factory_ && !surface_id_.is_null()) |
667 surface_factory_->Destroy(surface_id_); | 690 surface_factory_->Destroy(surface_id_); |
668 surface_id_ = cc::SurfaceId(); | 691 surface_id_ = cc::SurfaceId(); |
669 } | 692 } |
670 | 693 |
671 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 694 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
672 return true; | 695 return true; |
673 } | 696 } |
674 | 697 |
675 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 698 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
676 return surface_id_; | 699 return surface_id_; |
677 }; | 700 }; |
678 | 701 |
679 } // namespace content | 702 } // namespace content |
OLD | NEW |