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

Unified Diff: ui/message_center/views/notification_view.cc

Issue 22891016: Add support for rect-based event targeting in views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP Created 7 years, 3 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/message_center/views/notification_view.cc
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index a39b4e4beeed8087e35098b041224f24498d014c..d83b9f431d7b09b2ec1517ad41e36954d8785f7a 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -685,8 +685,10 @@ void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) {
views::View::ScrollRectToVisible(GetLocalBounds());
}
-views::View* NotificationView::GetEventHandlerForPoint(
- const gfx::Point& point) {
+views::View* NotificationView::GetEventHandlerForRect(const gfx::Rect& rect) {
+ if (!views::View::UsePointBasedTargeting(rect))
+ return views::View::GetEventHandlerForRect(rect);
+
// Want to return this for underlying views, otherwise GetCursor is not
// called. But buttons are exceptions, they'll have their own event handlings.
std::vector<views::View*> buttons(action_buttons_);
@@ -694,10 +696,10 @@ views::View* NotificationView::GetEventHandlerForPoint(
buttons.push_back(expand_button());
for (size_t i = 0; i < buttons.size(); ++i) {
- gfx::Point point_in_child = point;
- ConvertPointToTarget(this, buttons[i], &point_in_child);
- if (buttons[i]->HitTestPoint(point_in_child))
- return buttons[i]->GetEventHandlerForPoint(point_in_child);
+ gfx::Rect rect_in_child = rect;
+ ConvertRectToTarget(this, buttons[i], &rect_in_child);
+ if (buttons[i]->HitTestRect(rect_in_child))
+ return buttons[i]->GetEventHandlerForRect(rect_in_child);
}
return this;

Powered by Google App Engine
This is Rietveld 408576698