Index: ui/views/widget/root_view.cc |
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc |
index 5d2aba391f4175d6996069e636251b761d12236e..9ffdc3f3710c12a14ce89d616664fc1d5c6b77ee 100644 |
--- a/ui/views/widget/root_view.cc |
+++ b/ui/views/widget/root_view.cc |
@@ -454,7 +454,27 @@ ui::GestureStatus RootView::OnGestureEvent(const GestureEvent& event) { |
GestureEvent e(event, this); |
ui::GestureStatus status = ui::GESTURE_STATUS_UNKNOWN; |
- if (gesture_handler_) { |
+ // TODO(tdanderson): Store radius values for a ui::ET_GESTURE_LONG_PRESS |
+ // event so that fuzzing may also be used for a long press. |
+ bool useFuzzing = event.type() == ui::ET_GESTURE_TAP; |
sky
2012/07/17 19:54:32
Why do this here? Shouldn't we fuzz only if there
tdanderson
2012/07/18 22:35:42
There could be a |gesture_handler_| from either GE
sky
2012/07/19 00:06:38
Why? It seems wrong to me to change the target vie
|
+ |
+ if (useFuzzing) { |
+ float radius = event.details().radius_x(); |
+ gfx::Point adjustedLoc(event.x() - radius, event.y() - radius); |
+ ConvertPointToScreen(this, &adjustedLoc); |
sadrul
2012/07/16 22:16:14
Why is it necessary to convert to screen coordinat
rjkroege
2012/07/16 23:35:48
Aside: are screen coords in DIP or physical?
tdanderson
2012/07/17 19:07:07
Please see my reply in view.cc and let me know if
tdanderson
2012/07/18 22:35:42
Done.
|
+ gfx::Rect touchRect(adjustedLoc.x(), adjustedLoc.y(), radius*2, radius*2); |
+ |
+ gfx::Rect closestOverlappedRect; |
+ FindClosestOverlappedRect(touchRect, closestOverlappedRect); |
+ |
+ if (!closestOverlappedRect.IsEmpty()) { |
+ gfx::Point newLoc(closestOverlappedRect.CenterPoint()); |
+ ConvertPointFromScreen(this, &newLoc); |
+ e.location_ = newLoc; |
sky
2012/07/17 19:54:32
What is |e|?
tdanderson
2012/07/18 22:35:42
This was present before I touched the code. It is
|
+ } |
+ } |
+ |
+ if (gesture_handler_ && !useFuzzing) { |
sadrul
2012/07/16 22:16:14
Hm...
I think with this change here, we can end u
tdanderson
2012/07/17 19:07:07
Yes, I see the problem here. But if the fuzzing lo
sadrul
2012/07/17 19:26:45
Yes. But I do not think we can avoid this (apart f
tdanderson
2012/07/18 22:35:42
This is the approach I have taken in my latest CL.
|
// Allow |gesture_handler_| to delete this during processing. |
View* handler = gesture_handler_; |
GestureEvent handler_event(event, this, gesture_handler_); |
@@ -468,6 +488,7 @@ ui::GestureStatus RootView::OnGestureEvent(const GestureEvent& event) { |
for (gesture_handler_ = GetEventHandlerForPoint(e.location()); |
gesture_handler_ && (gesture_handler_ != this); |
gesture_handler_ = gesture_handler_->parent()) { |
+ |
if (!gesture_handler_->enabled()) { |
// Disabled views eat events but are treated as not handled. |
return ui::GESTURE_STATUS_UNKNOWN; |