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

Unified Diff: ui/views/widget/root_view.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index b103943cd13e3bd81f2f5af4ac652c1a13e47c4e..07afc32ee5dbfccb883270d6819f040ddceb98ac 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -276,7 +276,8 @@ bool RootView::OnMousePressed(const ui::MouseEvent& event) {
bool hit_disabled_view = false;
// Walk up the tree until we find a view that wants the mouse event.
- for (mouse_pressed_handler_ = GetEventHandlerForPoint(event.location());
+ for (mouse_pressed_handler_ =
+ GetEventHandlerForPoint(gfx::ToFlooredPoint(event.location()));
mouse_pressed_handler_ && (mouse_pressed_handler_ != this);
mouse_pressed_handler_ = mouse_pressed_handler_->parent()) {
DVLOG(1) << "OnMousePressed testing "
@@ -395,7 +396,7 @@ void RootView::OnMouseCaptureLost() {
}
void RootView::OnMouseMoved(const ui::MouseEvent& event) {
- View* v = GetEventHandlerForPoint(event.location());
+ View* v = GetEventHandlerForPoint(gfx::ToFlooredPoint(event.location()));
// Find the first enabled view, or the existing move handler, whichever comes
// first. The check for the existing handler is because if a view becomes
// disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED
@@ -471,8 +472,9 @@ void RootView::OnMouseExited(const ui::MouseEvent& event) {
}
bool RootView::OnMouseWheel(const ui::MouseWheelEvent& event) {
- for (View* v = GetEventHandlerForPoint(event.location());
- v && v != this && !event.handled(); v = v->parent()) {
+ for (View* v = GetEventHandlerForPoint(gfx::ToFlooredPoint(event.location()));
+ v && v != this && !event.handled();
+ v = v->parent()) {
ui::EventDispatchDetails dispatch_details =
DispatchEvent(v, const_cast<ui::MouseWheelEvent*>(&event));
if (dispatch_details.dispatcher_destroyed ||
@@ -589,11 +591,12 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
// TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect()
// once crbug.com/313392 is resolved.
gfx::Rect touch_rect(event->details().bounding_box());
- touch_rect.set_origin(event->location());
+ touch_rect.set_origin(gfx::ToFlooredPoint(event->location()));
touch_rect.Offset(-touch_rect.width() / 2, -touch_rect.height() / 2);
gesture_handler = GetEventHandlerForRect(touch_rect);
} else {
- gesture_handler = GetEventHandlerForPoint(event->location());
+ gesture_handler =
+ GetEventHandlerForPoint(gfx::ToFlooredPoint(event->location()));
}
// Walk up the tree until we find a view that wants the gesture event.
@@ -701,8 +704,10 @@ View::DragInfo* RootView::GetDragInfo() {
// Input -----------------------------------------------------------------------
void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
- for (View* v = GetEventHandlerForPoint(event->location());
- v && v != this && !event->stopped_propagation(); v = v->parent()) {
+ for (View* v =
+ GetEventHandlerForPoint(gfx::ToFlooredPoint(event->location()));
+ v && v != this && !event->stopped_propagation();
+ v = v->parent()) {
ui::EventDispatchDetails dispatch_details = DispatchEvent(v, event);
if (dispatch_details.dispatcher_destroyed ||
dispatch_details.target_destroyed) {
@@ -721,7 +726,7 @@ void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
void RootView::UpdateCursor(const ui::MouseEvent& event) {
if (!(event.flags() & ui::EF_IS_NON_CLIENT)) {
- View* v = GetEventHandlerForPoint(event.location());
+ View* v = GetEventHandlerForPoint(gfx::ToFlooredPoint(event.location()));
ui::MouseEvent me(event, static_cast<View*>(this), v);
widget_->SetCursor(v->GetCursor(me));
}

Powered by Google App Engine
This is Rietveld 408576698