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

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

Issue 2730903005: Start with event_target in for loop to avoid GetEventTargeter crash. (Closed)
Patch Set: nits Created 3 years, 9 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
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 if (event->IsLocatedEvent()) { 448 if (event->IsLocatedEvent()) {
449 ui::EventTarget* target = event_targeter_->FindTargetInRootWindow( 449 ui::EventTarget* target = event_targeter_->FindTargetInRootWindow(
450 window(), *event->AsLocatedEvent()); 450 window(), *event->AsLocatedEvent());
451 if (target) { 451 if (target) {
452 ConvertEventLocationToTarget(event_target, target, event); 452 ConvertEventLocationToTarget(event_target, target, event);
453 return target; 453 return target;
454 } 454 }
455 } 455 }
456 456
457 ui::EventTarget* ancestor_with_targeter = event_target; 457 ui::EventTarget* ancestor_with_targeter = event_target;
458 for (ui::EventTarget* ancestor = event_target->GetParentTarget(); ancestor; 458 for (ui::EventTarget* ancestor = event_target; ancestor;
459 ancestor = ancestor->GetParentTarget()) { 459 ancestor = ancestor->GetParentTarget()) {
460 if (ancestor->GetEventTargeter()) 460 if (ancestor->GetEventTargeter())
461 ancestor_with_targeter = ancestor; 461 ancestor_with_targeter = ancestor;
462 if (ancestor == window()) 462 if (ancestor == window())
463 break; 463 break;
464 } 464 }
465 ConvertEventLocationToTarget(event_target, ancestor_with_targeter, event); 465 ConvertEventLocationToTarget(event_target, ancestor_with_targeter, event);
466 return ancestor_with_targeter; 466 return ancestor_with_targeter;
467 } 467 }
468 468
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 916 }
917 917
918 // This flag is set depending on the gestures recognized in the call above, 918 // This flag is set depending on the gestures recognized in the call above,
919 // and needs to propagate with the forwarded event. 919 // and needs to propagate with the forwarded event.
920 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); 920 event->set_may_cause_scrolling(orig_event.may_cause_scrolling());
921 921
922 return PreDispatchLocatedEvent(target, event); 922 return PreDispatchLocatedEvent(target, event);
923 } 923 }
924 924
925 } // namespace aura 925 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698