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

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: comments addressed, moved fuzzing utility functions to new file Created 7 years, 2 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 11b3474f51ad2b3b3e7750cf708bd79a3301a0e6..289f8a9910659c2276a84d57d2298cb34b8fb8f7 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -28,6 +28,7 @@
#include "ui/views/controls/progress_bar.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
+#include "ui/views/rect_based_targeting_utils.h"
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
@@ -693,8 +694,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::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_);
@@ -702,10 +705,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