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

Side by Side Diff: ui/aura/window_event_dispatcher.cc

Issue 1421713002: Explicitly convert Point to PointF for event code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip
Patch Set: pointfconvert-prod: . Created 5 years, 1 month 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 "ui/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 event->ConvertLocationToTarget(window(), target); 146 event->ConvertLocationToTarget(window(), target);
147 DispatchDetails details = DispatchEvent(target, event); 147 DispatchDetails details = DispatchEvent(target, event);
148 if (details.dispatcher_destroyed) 148 if (details.dispatcher_destroyed)
149 return; 149 return;
150 } 150 }
151 } 151 }
152 152
153 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( 153 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint(
154 Window* window, 154 Window* window,
155 const gfx::Point& point) { 155 const gfx::Point& point) {
156 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EventTimeForNow(), 156 ui::MouseEvent event(ui::ET_MOUSE_EXITED, gfx::PointF(point),
157 ui::EF_NONE, ui::EF_NONE); 157 gfx::PointF(point), ui::EventTimeForNow(), ui::EF_NONE,
158 ui::EF_NONE);
158 return DispatchMouseEnterOrExit(window, event, ui::ET_MOUSE_EXITED); 159 return DispatchMouseEnterOrExit(window, event, ui::ET_MOUSE_EXITED);
159 } 160 }
160 161
161 void WindowEventDispatcher::ProcessedTouchEvent(uint32 unique_event_id, 162 void WindowEventDispatcher::ProcessedTouchEvent(uint32 unique_event_id,
162 Window* window, 163 Window* window,
163 ui::EventResult result) { 164 ui::EventResult result) {
164 scoped_ptr<ui::GestureRecognizer::Gestures> gestures( 165 scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
165 ui::GestureRecognizer::Get()->AckTouchEvent(unique_event_id, result, 166 ui::GestureRecognizer::Get()->AckTouchEvent(unique_event_id, result,
166 window)); 167 window));
167 DispatchDetails details = ProcessGestures(gestures.get()); 168 DispatchDetails details = ProcessGestures(gestures.get());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 Window* new_capture) { 362 Window* new_capture) {
362 // |mouse_moved_handler_| may have been set to a Window in a different root 363 // |mouse_moved_handler_| may have been set to a Window in a different root
363 // (see below). Clear it here to ensure we don't end up referencing a stale 364 // (see below). Clear it here to ensure we don't end up referencing a stale
364 // Window. 365 // Window.
365 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_)) 366 if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_))
366 mouse_moved_handler_ = NULL; 367 mouse_moved_handler_ = NULL;
367 368
368 if (old_capture && old_capture->GetRootWindow() == window() && 369 if (old_capture && old_capture->GetRootWindow() == window() &&
369 old_capture->delegate()) { 370 old_capture->delegate()) {
370 // Send a capture changed event with bogus location data. 371 // Send a capture changed event with bogus location data.
371 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), 372 ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::PointF(),
372 gfx::Point(), ui::EventTimeForNow(), 0, 0); 373 gfx::PointF(), ui::EventTimeForNow(), 0, 0);
373 374
374 DispatchDetails details = DispatchEvent(old_capture, &event); 375 DispatchDetails details = DispatchEvent(old_capture, &event);
375 if (details.dispatcher_destroyed) 376 if (details.dispatcher_destroyed)
376 return; 377 return;
377 378
378 if (!details.target_destroyed) 379 if (!details.target_destroyed)
379 old_capture->delegate()->OnCaptureLost(); 380 old_capture->delegate()->OnCaptureLost();
380 } 381 }
381 382
382 if (new_capture) { 383 if (new_capture) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 // DRAGGED event can be synthesized in the incorrect host. So avoid 717 // DRAGGED event can be synthesized in the incorrect host. So avoid
717 // synthesizing any events at all. 718 // synthesizing any events at all.
718 if (Env::GetInstance()->mouse_button_flags()) 719 if (Env::GetInstance()->mouse_button_flags())
719 return details; 720 return details;
720 721
721 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); 722 gfx::Point root_mouse_location = GetLastMouseLocationInRoot();
722 if (!window()->bounds().Contains(root_mouse_location)) 723 if (!window()->bounds().Contains(root_mouse_location))
723 return details; 724 return details;
724 gfx::Point host_mouse_location = root_mouse_location; 725 gfx::Point host_mouse_location = root_mouse_location;
725 host_->ConvertPointToHost(&host_mouse_location); 726 host_->ConvertPointToHost(&host_mouse_location);
726 ui::MouseEvent event(ui::ET_MOUSE_MOVED, host_mouse_location, 727 ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::PointF(host_mouse_location),
727 host_mouse_location, ui::EventTimeForNow(), 728 gfx::PointF(host_mouse_location), ui::EventTimeForNow(),
728 ui::EF_IS_SYNTHESIZED, 0); 729 ui::EF_IS_SYNTHESIZED, 0);
729 return OnEventFromSource(&event); 730 return OnEventFromSource(&event);
730 } 731 }
731 732
732 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target, 733 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target,
733 ui::LocatedEvent* event) { 734 ui::LocatedEvent* event) {
734 int flags = event->flags(); 735 int flags = event->flags();
735 if (IsNonClientLocation(target, event->location())) 736 if (IsNonClientLocation(target, event->location()))
736 flags |= ui::EF_IS_NON_CLIENT; 737 flags |= ui::EF_IS_NON_CLIENT;
737 event->set_flags(flags); 738 event->set_flags(flags);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } 894 }
894 895
895 // This flag is set depending on the gestures recognized in the call above, 896 // This flag is set depending on the gestures recognized in the call above,
896 // and needs to propagate with the forwarded event. 897 // and needs to propagate with the forwarded event.
897 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); 898 event->set_may_cause_scrolling(orig_event.may_cause_scrolling());
898 899
899 PreDispatchLocatedEvent(target, event); 900 PreDispatchLocatedEvent(target, event);
900 } 901 }
901 902
902 } // namespace aura 903 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698