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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_base.cc

Issue 2664013002: input: Restrict synthetic touch gesture to view bounds.
Patch Set: Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/synthetic_gesture_target_base.h" 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
6 6
7 #include "content/browser/renderer_host/render_widget_host_impl.h" 7 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/browser/renderer_host/render_widget_host_view_base.h" 8 #include "content/browser/renderer_host/render_widget_host_view_base.h"
9 #include "content/browser/renderer_host/ui_events_helper.h" 9 #include "content/browser/renderer_host/ui_events_helper.h"
10 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return kTouchSlopInDips; 119 return kTouchSlopInDips;
120 } 120 }
121 121
122 float SyntheticGestureTargetBase::GetMinScalingSpanInDips() const { 122 float SyntheticGestureTargetBase::GetMinScalingSpanInDips() const {
123 // The minimum scaling distance is only relevant for touch gestures and the 123 // The minimum scaling distance is only relevant for touch gestures and the
124 // base target doesn't support touch. 124 // base target doesn't support touch.
125 NOTREACHED(); 125 NOTREACHED();
126 return 0.0f; 126 return 0.0f;
127 } 127 }
128 128
129 gfx::Size SyntheticGestureTargetBase::GetViewSize() const {
130 return host_->GetView()->GetViewBounds().size();
131 }
132
129 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { 133 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const {
130 gfx::Rect bounds = host_->GetView()->GetViewBounds(); 134 gfx::Rect bounds = host_->GetView()->GetViewBounds();
131 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). 135 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0).
132 return bounds.Contains(x, y); 136 return bounds.Contains(x, y);
133 } 137 }
134 138
135 } // namespace content 139 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698