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

Side by Side Diff: ui/views/widget/root_view.cc

Issue 12212117: views: Dispatch mouse events using EventDispatch interface too. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/root_view.h ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 10 matching lines...) Expand all
21 namespace views { 21 namespace views {
22 namespace internal { 22 namespace internal {
23 23
24 namespace { 24 namespace {
25 25
26 enum EventType { 26 enum EventType {
27 EVENT_ENTER, 27 EVENT_ENTER,
28 EVENT_EXIT 28 EVENT_EXIT
29 }; 29 };
30 30
31 // |view| is the view receiving |event|. This function sends the event to all 31 class MouseEnterExitEvent : public ui::MouseEvent {
32 // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag turned 32 public:
33 // on, but does not contain |sibling|. 33 MouseEnterExitEvent(const ui::MouseEvent& event, ui::EventType type)
34 void NotifyEnterExitOfDescendant(const ui::MouseEvent& event, 34 : ui::MouseEvent(event,
35 EventType type, 35 static_cast<View*>(NULL),
36 View* view, 36 static_cast<View*>(NULL)) {
37 View* sibling) { 37 DCHECK(type == ui::ET_MOUSE_ENTERED ||
38 for (View* p = view->parent(); p; p = p->parent()) { 38 type == ui::ET_MOUSE_EXITED);
39 if (!p->notify_enter_exit_on_child()) 39 SetType(type);
40 continue;
41 if (sibling && p->Contains(sibling))
42 break;
43 if (type == EVENT_ENTER)
44 p->OnMouseEntered(event);
45 else
46 p->OnMouseExited(event);
47 } 40 }
48 } 41
42 virtual ~MouseEnterExitEvent() {}
43 };
49 44
50 } // namespace 45 } // namespace
51 46
52 // static 47 // static
53 const char RootView::kViewClassName[] = "views/RootView"; 48 const char RootView::kViewClassName[] = "views/RootView";
54 49
55 //////////////////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////////////////
56 // RootView, public: 51 // RootView, public:
57 52
58 // Creation and lifetime ------------------------------------------------------- 53 // Creation and lifetime -------------------------------------------------------
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // under the cursor. 139 // under the cursor.
145 ui::MouseWheelEvent wheel(*event); 140 ui::MouseWheelEvent wheel(*event);
146 if (OnMouseWheel(wheel)) { 141 if (OnMouseWheel(wheel)) {
147 event->SetHandled(); 142 event->SetHandled();
148 } else { 143 } else {
149 View* focused_view = 144 View* focused_view =
150 GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL; 145 GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL;
151 View* v = GetEventHandlerForPoint(wheel.location()); 146 View* v = GetEventHandlerForPoint(wheel.location());
152 if (v != focused_view) { 147 if (v != focused_view) {
153 for (; v && v != this; v = v->parent()) { 148 for (; v && v != this; v = v->parent()) {
154 if (v->OnMouseWheel(wheel)) { 149 DispatchEventToTarget(v, &wheel);
150 if (wheel.handled()) {
155 event->SetHandled(); 151 event->SetHandled();
156 break; 152 break;
157 } 153 }
158 } 154 }
159 } 155 }
160 } 156 }
161 } 157 }
162 158
163 void RootView::DispatchTouchEvent(ui::TouchEvent* event) { 159 void RootView::DispatchTouchEvent(ui::TouchEvent* event) {
164 // TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the 160 // TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 UpdateCursor(event); 397 UpdateCursor(event);
402 SetMouseLocationAndFlags(event); 398 SetMouseLocationAndFlags(event);
403 399
404 // If mouse_pressed_handler_ is non null, we are currently processing 400 // If mouse_pressed_handler_ is non null, we are currently processing
405 // a pressed -> drag -> released session. In that case we send the 401 // a pressed -> drag -> released session. In that case we send the
406 // event to mouse_pressed_handler_ 402 // event to mouse_pressed_handler_
407 if (mouse_pressed_handler_) { 403 if (mouse_pressed_handler_) {
408 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this), 404 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this),
409 mouse_pressed_handler_); 405 mouse_pressed_handler_);
410 drag_info_.Reset(); 406 drag_info_.Reset();
411 mouse_pressed_handler_->ProcessMousePressed(mouse_pressed_event, 407 DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event);
412 &drag_info_);
413 return true; 408 return true;
414 } 409 }
415 DCHECK(!explicit_mouse_handler_); 410 DCHECK(!explicit_mouse_handler_);
416 411
417 bool hit_disabled_view = false; 412 bool hit_disabled_view = false;
418 // Walk up the tree until we find a view that wants the mouse event. 413 // Walk up the tree until we find a view that wants the mouse event.
419 for (mouse_pressed_handler_ = GetEventHandlerForPoint(event.location()); 414 for (mouse_pressed_handler_ = GetEventHandlerForPoint(event.location());
420 mouse_pressed_handler_ && (mouse_pressed_handler_ != this); 415 mouse_pressed_handler_ && (mouse_pressed_handler_ != this);
421 mouse_pressed_handler_ = mouse_pressed_handler_->parent()) { 416 mouse_pressed_handler_ = mouse_pressed_handler_->parent()) {
422 DVLOG(1) << "OnMousePressed testing " 417 DVLOG(1) << "OnMousePressed testing "
423 << mouse_pressed_handler_->GetClassName(); 418 << mouse_pressed_handler_->GetClassName();
424 if (!mouse_pressed_handler_->enabled()) { 419 if (!mouse_pressed_handler_->enabled()) {
425 // Disabled views should eat events instead of propagating them upwards. 420 // Disabled views should eat events instead of propagating them upwards.
426 hit_disabled_view = true; 421 hit_disabled_view = true;
427 break; 422 break;
428 } 423 }
429 424
430 // See if this view wants to handle the mouse press. 425 // See if this view wants to handle the mouse press.
431 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this), 426 ui::MouseEvent mouse_pressed_event(event, static_cast<View*>(this),
432 mouse_pressed_handler_); 427 mouse_pressed_handler_);
433 428
434 // Remove the double-click flag if the handler is different than the 429 // Remove the double-click flag if the handler is different than the
435 // one which got the first click part of the double-click. 430 // one which got the first click part of the double-click.
436 if (mouse_pressed_handler_ != last_click_handler_) 431 if (mouse_pressed_handler_ != last_click_handler_)
437 mouse_pressed_event.set_flags(event.flags() & ~ui::EF_IS_DOUBLE_CLICK); 432 mouse_pressed_event.set_flags(event.flags() & ~ui::EF_IS_DOUBLE_CLICK);
438 433
439 drag_info_.Reset(); 434 drag_info_.Reset();
440 bool handled = mouse_pressed_handler_->ProcessMousePressed( 435 DispatchEventToTarget(mouse_pressed_handler_, &mouse_pressed_event);
441 mouse_pressed_event, &drag_info_);
442 436
443 // The view could have removed itself from the tree when handling 437 // The view could have removed itself from the tree when handling
444 // OnMousePressed(). In this case, the removal notification will have 438 // OnMousePressed(). In this case, the removal notification will have
445 // reset mouse_pressed_handler_ to NULL out from under us. Detect this 439 // reset mouse_pressed_handler_ to NULL out from under us. Detect this
446 // case and stop. (See comments in view.h.) 440 // case and stop. (See comments in view.h.)
447 // 441 //
448 // NOTE: Don't return true here, because we don't want the frame to 442 // NOTE: Don't return true here, because we don't want the frame to
449 // forward future events to us when there's no handler. 443 // forward future events to us when there's no handler.
450 if (!mouse_pressed_handler_) 444 if (!mouse_pressed_handler_)
451 break; 445 break;
452 446
453 // If the view handled the event, leave mouse_pressed_handler_ set and 447 // If the view handled the event, leave mouse_pressed_handler_ set and
454 // return true, which will cause subsequent drag/release events to get 448 // return true, which will cause subsequent drag/release events to get
455 // forwarded to that view. 449 // forwarded to that view.
456 if (handled) { 450 if (mouse_pressed_event.handled()) {
457 last_click_handler_ = mouse_pressed_handler_; 451 last_click_handler_ = mouse_pressed_handler_;
458 DVLOG(1) << "OnMousePressed handled by " 452 DVLOG(1) << "OnMousePressed handled by "
459 << mouse_pressed_handler_->GetClassName(); 453 << mouse_pressed_handler_->GetClassName();
460 return true; 454 return true;
461 } 455 }
462 } 456 }
463 457
464 // Reset mouse_pressed_handler_ to indicate that no processing is occurring. 458 // Reset mouse_pressed_handler_ to indicate that no processing is occurring.
465 mouse_pressed_handler_ = NULL; 459 mouse_pressed_handler_ = NULL;
466 460
467 // In the event that a double-click is not handled after traversing the 461 // In the event that a double-click is not handled after traversing the
468 // entire hierarchy (even as a single-click when sent to a different view), 462 // entire hierarchy (even as a single-click when sent to a different view),
469 // it must be marked as handled to avoid anything happening from default 463 // it must be marked as handled to avoid anything happening from default
470 // processing if it the first click-part was handled by us. 464 // processing if it the first click-part was handled by us.
471 if (last_click_handler_ && (event.flags() & ui::EF_IS_DOUBLE_CLICK)) 465 if (last_click_handler_ && (event.flags() & ui::EF_IS_DOUBLE_CLICK))
472 hit_disabled_view = true; 466 hit_disabled_view = true;
473 467
474 last_click_handler_ = NULL; 468 last_click_handler_ = NULL;
475 return hit_disabled_view; 469 return hit_disabled_view;
476 } 470 }
477 471
478 bool RootView::OnMouseDragged(const ui::MouseEvent& event) { 472 bool RootView::OnMouseDragged(const ui::MouseEvent& event) {
479 if (mouse_pressed_handler_) { 473 if (mouse_pressed_handler_) {
480 SetMouseLocationAndFlags(event); 474 SetMouseLocationAndFlags(event);
481 475
482 ui::MouseEvent mouse_event(event, static_cast<View*>(this), 476 ui::MouseEvent mouse_event(event, static_cast<View*>(this),
483 mouse_pressed_handler_); 477 mouse_pressed_handler_);
484 return mouse_pressed_handler_->ProcessMouseDragged(mouse_event, 478 DispatchEventToTarget(mouse_pressed_handler_, &mouse_event);
485 &drag_info_); 479 return mouse_event.handled();
486 } 480 }
487 return false; 481 return false;
488 } 482 }
489 483
490 void RootView::OnMouseReleased(const ui::MouseEvent& event) { 484 void RootView::OnMouseReleased(const ui::MouseEvent& event) {
491 UpdateCursor(event); 485 UpdateCursor(event);
492 486
493 if (mouse_pressed_handler_) { 487 if (mouse_pressed_handler_) {
494 ui::MouseEvent mouse_released(event, static_cast<View*>(this), 488 ui::MouseEvent mouse_released(event, static_cast<View*>(this),
495 mouse_pressed_handler_); 489 mouse_pressed_handler_);
496 // TODO(sadrul|oshima): This is tentative solution to pass target 490 // We allow the view to delete us from the event dispatch callback. As such,
497 // to LauncherDelegate::ItemClicked. Remove this once crbug.com/173235
498 // is implemented.
499 ui::Event::DispatcherApi api(&mouse_released);
500 api.set_target(this);
501
502 // We allow the view to delete us from ProcessMouseReleased. As such,
503 // configure state such that we're done first, then call View. 491 // configure state such that we're done first, then call View.
504 View* mouse_pressed_handler = mouse_pressed_handler_; 492 View* mouse_pressed_handler = mouse_pressed_handler_;
505 SetMouseHandler(NULL); 493 SetMouseHandler(NULL);
506 mouse_pressed_handler->ProcessMouseReleased(mouse_released); 494 DispatchEventToTarget(mouse_pressed_handler, &mouse_released);
507 // WARNING: we may have been deleted. 495 // WARNING: we may have been deleted.
508 } 496 }
509 } 497 }
510 498
511 void RootView::OnMouseCaptureLost() { 499 void RootView::OnMouseCaptureLost() {
512 // TODO: this likely needs to reset touch handler too. 500 // TODO: this likely needs to reset touch handler too.
513 501
514 if (mouse_pressed_handler_ || gesture_handler_) { 502 if (mouse_pressed_handler_ || gesture_handler_) {
515 // Synthesize a release event for UpdateCursor. 503 // Synthesize a release event for UpdateCursor.
516 if (mouse_pressed_handler_) { 504 if (mouse_pressed_handler_) {
(...skipping 22 matching lines...) Expand all
539 // first. The check for the existing handler is because if a view becomes 527 // first. The check for the existing handler is because if a view becomes
540 // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED 528 // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED
541 // and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet. 529 // and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet.
542 while (v && !v->enabled() && (v != mouse_move_handler_)) 530 while (v && !v->enabled() && (v != mouse_move_handler_))
543 v = v->parent(); 531 v = v->parent();
544 if (v && v != this) { 532 if (v && v != this) {
545 if (v != mouse_move_handler_) { 533 if (v != mouse_move_handler_) {
546 if (mouse_move_handler_ != NULL && 534 if (mouse_move_handler_ != NULL &&
547 (!mouse_move_handler_->notify_enter_exit_on_child() || 535 (!mouse_move_handler_->notify_enter_exit_on_child() ||
548 !mouse_move_handler_->Contains(v))) { 536 !mouse_move_handler_->Contains(v))) {
549 mouse_move_handler_->OnMouseExited(event); 537 MouseEnterExitEvent exit(event, ui::ET_MOUSE_EXITED);
550 NotifyEnterExitOfDescendant(event, EVENT_EXIT, mouse_move_handler_, v); 538 DispatchEventToTarget(mouse_move_handler_, &exit);
539 NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
540 mouse_move_handler_, v);
551 } 541 }
552 View* old_handler = mouse_move_handler_; 542 View* old_handler = mouse_move_handler_;
553 mouse_move_handler_ = v; 543 mouse_move_handler_ = v;
554 ui::MouseEvent entered_event(event, static_cast<View*>(this),
555 mouse_move_handler_);
556 if (!mouse_move_handler_->notify_enter_exit_on_child() || 544 if (!mouse_move_handler_->notify_enter_exit_on_child() ||
557 !mouse_move_handler_->Contains(old_handler)) { 545 !mouse_move_handler_->Contains(old_handler)) {
558 mouse_move_handler_->OnMouseEntered(entered_event); 546 MouseEnterExitEvent entered(event, ui::ET_MOUSE_ENTERED);
559 NotifyEnterExitOfDescendant(entered_event, EVENT_ENTER, v, 547 DispatchEventToTarget(mouse_move_handler_, &entered);
548 NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_ENTERED, v,
560 old_handler); 549 old_handler);
561 } 550 }
562 } 551 }
563 ui::MouseEvent moved_event(event, static_cast<View*>(this), 552 ui::MouseEvent moved_event(event, static_cast<View*>(this),
564 mouse_move_handler_); 553 mouse_move_handler_);
565 mouse_move_handler_->OnMouseMoved(moved_event); 554 DispatchEventToTarget(mouse_move_handler_, &moved_event);
566 if (!(moved_event.flags() & ui::EF_IS_NON_CLIENT)) 555 if (!(moved_event.flags() & ui::EF_IS_NON_CLIENT))
567 widget_->SetCursor(mouse_move_handler_->GetCursor(moved_event)); 556 widget_->SetCursor(mouse_move_handler_->GetCursor(moved_event));
568 } else if (mouse_move_handler_ != NULL) { 557 } else if (mouse_move_handler_ != NULL) {
569 mouse_move_handler_->OnMouseExited(event); 558 MouseEnterExitEvent exited(event, ui::ET_MOUSE_EXITED);
570 NotifyEnterExitOfDescendant(event, EVENT_EXIT, mouse_move_handler_, v); 559 DispatchEventToTarget(mouse_move_handler_, &exited);
560 NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
561 mouse_move_handler_, v);
571 // On Aura the non-client area extends slightly outside the root view for 562 // On Aura the non-client area extends slightly outside the root view for
572 // some windows. Let the non-client cursor handling code set the cursor 563 // some windows. Let the non-client cursor handling code set the cursor
573 // as we do above. 564 // as we do above.
574 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 565 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
575 widget_->SetCursor(gfx::kNullCursor); 566 widget_->SetCursor(gfx::kNullCursor);
576 mouse_move_handler_ = NULL; 567 mouse_move_handler_ = NULL;
577 } 568 }
578 } 569 }
579 570
580 void RootView::OnMouseExited(const ui::MouseEvent& event) { 571 void RootView::OnMouseExited(const ui::MouseEvent& event) {
581 if (mouse_move_handler_ != NULL) { 572 if (mouse_move_handler_ != NULL) {
582 mouse_move_handler_->OnMouseExited(event); 573 MouseEnterExitEvent exited(event, ui::ET_MOUSE_EXITED);
583 NotifyEnterExitOfDescendant(event, EVENT_EXIT, mouse_move_handler_, NULL); 574 DispatchEventToTarget(mouse_move_handler_, &exited);
575 NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
576 mouse_move_handler_, NULL);
584 mouse_move_handler_ = NULL; 577 mouse_move_handler_ = NULL;
585 } 578 }
586 } 579 }
587 580
588 bool RootView::OnMouseWheel(const ui::MouseWheelEvent& event) { 581 bool RootView::OnMouseWheel(const ui::MouseWheelEvent& event) {
589 bool consumed = false;
590 for (View* v = GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL; 582 for (View* v = GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL;
591 v && v != this && !consumed; v = v->parent()) 583 v && v != this && !event.handled(); v = v->parent())
592 consumed = v->OnMouseWheel(event); 584 DispatchEventToTarget(v, const_cast<ui::MouseWheelEvent*>(&event));
593 return consumed; 585 return event.handled();
594 } 586 }
595 587
596 void RootView::SetMouseHandler(View* new_mh) { 588 void RootView::SetMouseHandler(View* new_mh) {
597 // If we're clearing the mouse handler, clear explicit_mouse_handler_ as well. 589 // If we're clearing the mouse handler, clear explicit_mouse_handler_ as well.
598 explicit_mouse_handler_ = (new_mh != NULL); 590 explicit_mouse_handler_ = (new_mh != NULL);
599 mouse_pressed_handler_ = new_mh; 591 mouse_pressed_handler_ = new_mh;
600 gesture_handler_ = new_mh; 592 gesture_handler_ = new_mh;
601 scroll_gesture_handler_ = new_mh; 593 scroll_gesture_handler_ = new_mh;
602 drag_info_.Reset(); 594 drag_info_.Reset();
603 } 595 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 636 }
645 637
646 gfx::Vector2d RootView::CalculateOffsetToAncestorWithLayer( 638 gfx::Vector2d RootView::CalculateOffsetToAncestorWithLayer(
647 ui::Layer** layer_parent) { 639 ui::Layer** layer_parent) {
648 gfx::Vector2d offset(View::CalculateOffsetToAncestorWithLayer(layer_parent)); 640 gfx::Vector2d offset(View::CalculateOffsetToAncestorWithLayer(layer_parent));
649 if (!layer()) 641 if (!layer())
650 offset += widget_->CalculateOffsetToAncestorWithLayer(layer_parent); 642 offset += widget_->CalculateOffsetToAncestorWithLayer(layer_parent);
651 return offset; 643 return offset;
652 } 644 }
653 645
646 View::DragInfo* RootView::GetDragInfo() {
647 return &drag_info_;
648 }
649
654 //////////////////////////////////////////////////////////////////////////////// 650 ////////////////////////////////////////////////////////////////////////////////
655 // RootView, private: 651 // RootView, private:
656 652
657 // Input ----------------------------------------------------------------------- 653 // Input -----------------------------------------------------------------------
658 654
659 void RootView::UpdateCursor(const ui::MouseEvent& event) { 655 void RootView::UpdateCursor(const ui::MouseEvent& event) {
660 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) { 656 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) {
661 View* v = GetEventHandlerForPoint(event.location()); 657 View* v = GetEventHandlerForPoint(event.location());
662 ui::MouseEvent me(event, static_cast<View*>(this), v); 658 ui::MouseEvent me(event, static_cast<View*>(this), v);
663 widget_->SetCursor(v->GetCursor(me)); 659 widget_->SetCursor(v->GetCursor(me));
664 } 660 }
665 } 661 }
666 662
667 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { 663 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) {
668 last_mouse_event_flags_ = event.flags(); 664 last_mouse_event_flags_ = event.flags();
669 last_mouse_event_x_ = event.x(); 665 last_mouse_event_x_ = event.x();
670 last_mouse_event_y_ = event.y(); 666 last_mouse_event_y_ = event.y();
671 } 667 }
672 668
673 void RootView::DispatchEventToTarget(View* target, ui::Event* event) { 669 void RootView::DispatchEventToTarget(View* target, ui::Event* event) {
674 View* old_target = event_dispatch_target_; 670 View* old_target = event_dispatch_target_;
675 event_dispatch_target_ = target; 671 event_dispatch_target_ = target;
676 if (DispatchEvent(target, event)) 672 if (DispatchEvent(target, event))
677 event_dispatch_target_ = old_target; 673 event_dispatch_target_ = old_target;
678 } 674 }
679 675
676 void RootView::NotifyEnterExitOfDescendant(const ui::MouseEvent& event,
677 ui::EventType type,
678 View* view,
679 View* sibling) {
680 for (View* p = view->parent(); p; p = p->parent()) {
681 if (!p->notify_enter_exit_on_child())
682 continue;
683 if (sibling && p->Contains(sibling))
684 break;
685 // It is necessary to recreate the notify-event for each dispatch, since one
686 // of the callbacks can mark the event as handled, and that would cause
687 // incorrect event dispatch.
688 MouseEnterExitEvent notify_event(event, type);
689 DispatchEventToTarget(p, &notify_event);
690 }
691 }
692
680 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { 693 bool RootView::CanDispatchToTarget(ui::EventTarget* target) {
681 return event_dispatch_target_ == target; 694 return event_dispatch_target_ == target;
682 } 695 }
683 696
684 } // namespace internal 697 } // namespace internal
685 } // namespace views 698 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/root_view.h ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698