| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 671 |
| 671 observing_begin_frame_source_ = needs_begin_frames; | 672 observing_begin_frame_source_ = needs_begin_frames; |
| 672 if (begin_frame_source_) { | 673 if (begin_frame_source_) { |
| 673 if (observing_begin_frame_source_) | 674 if (observing_begin_frame_source_) |
| 674 begin_frame_source_->AddObserver(this); | 675 begin_frame_source_->AddObserver(this); |
| 675 else | 676 else |
| 676 begin_frame_source_->RemoveObserver(this); | 677 begin_frame_source_->RemoveObserver(this); |
| 677 } | 678 } |
| 678 } | 679 } |
| 679 | 680 |
| 681 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( |
| 682 const blink::WebInputEvent& input_event) { |
| 683 if (input_event.type == blink::WebInputEvent::GestureFlingStart) { |
| 684 const blink::WebGestureEvent& gesture_event = |
| 685 static_cast<const blink::WebGestureEvent&>(input_event); |
| 686 // Zero-velocity touchpad flings are an Aura-specific signal that the |
| 687 // touchpad scroll has ended, and should not be forwarded to the renderer. |
| 688 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && |
| 689 !gesture_event.data.flingStart.velocityX && |
| 690 !gesture_event.data.flingStart.velocityY) { |
| 691 // Here we indicate that there was no consumer for this event, as |
| 692 // otherwise the fling animation system will try to run an animation |
| 693 // and will also expect a notification when the fling ends. Since |
| 694 // CrOS just uses the GestureFlingStart with zero-velocity as a means |
| 695 // of indicating that touchpad scroll has ended, we don't actually want |
| 696 // a fling animation. |
| 697 // Note: this event handling is modeled on similar code in |
| 698 // TenderWidgetHostViewAura::FilterInputEvent(). |
| 699 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 700 } |
| 701 } |
| 702 |
| 703 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 704 } |
| 705 |
| 680 BrowserAccessibilityManager* | 706 BrowserAccessibilityManager* |
| 681 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 707 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
| 682 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { | 708 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { |
| 683 return BrowserAccessibilityManager::Create( | 709 return BrowserAccessibilityManager::Create( |
| 684 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 710 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
| 685 } | 711 } |
| 686 | 712 |
| 687 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 713 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
| 688 if (surface_factory_ && !surface_id_.is_null()) | 714 if (surface_factory_ && !surface_id_.is_null()) |
| 689 surface_factory_->Destroy(surface_id_); | 715 surface_factory_->Destroy(surface_id_); |
| 690 surface_id_ = cc::SurfaceId(); | 716 surface_id_ = cc::SurfaceId(); |
| 691 } | 717 } |
| 692 | 718 |
| 693 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 719 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 694 return true; | 720 return true; |
| 695 } | 721 } |
| 696 | 722 |
| 697 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 723 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 698 return surface_id_; | 724 return surface_id_; |
| 699 }; | 725 }; |
| 700 | 726 |
| 701 } // namespace content | 727 } // namespace content |
| OLD | NEW |