Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2173603002: Filter GestureFlingStarts with Vx=Vy=0 in RenderWidgetHostViewChildFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify comments, and include reference to RWHVA::FilterInputEvent(). Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // Here we indicate that there was no consumer for this event, as
670 // otherwise the fling animation system will try to run an animation
671 // and will also expect a notification when the fling ends. Since
672 // CrOS just uses the GestureFlingStart with zero-velocity as a means
673 // of indicating that touchpad scroll has ended, we don't actually want
674 // a fling animation.
675 // Note: this event handling is modeled on similar code in
676 // TenderWidgetHostViewAura::FilterInputEvent().
677 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
678 }
679 }
680
681 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
682 }
683
658 BrowserAccessibilityManager* 684 BrowserAccessibilityManager*
659 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( 685 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
660 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { 686 BrowserAccessibilityDelegate* delegate, bool for_root_frame) {
661 return BrowserAccessibilityManager::Create( 687 return BrowserAccessibilityManager::Create(
662 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 688 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
663 } 689 }
664 690
665 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 691 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
666 if (surface_factory_ && !surface_id_.is_null()) 692 if (surface_factory_ && !surface_id_.is_null())
667 surface_factory_->Destroy(surface_id_); 693 surface_factory_->Destroy(surface_id_);
668 surface_id_ = cc::SurfaceId(); 694 surface_id_ = cc::SurfaceId();
669 } 695 }
670 696
671 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { 697 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const {
672 return true; 698 return true;
673 } 699 }
674 700
675 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 701 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
676 return surface_id_; 702 return surface_id_;
677 }; 703 };
678 704
679 } // namespace content 705 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698