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

Unified Diff: ui/views/window/non_client_view.cc

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/views/window/non_client_view.cc
diff --git a/ui/views/window/non_client_view.cc b/ui/views/window/non_client_view.cc
index 89df367debe553fd8969f32d108cc205458c67f0..f71fd8c852456c639bdf3229813d41d2ef9ed092 100644
--- a/ui/views/window/non_client_view.cc
+++ b/ui/views/window/non_client_view.cc
@@ -186,7 +186,7 @@ const char* NonClientView::GetClassName() const {
return kViewClassName;
}
-View* NonClientView::GetEventHandlerForRect(const gfx::Rect& rect) {
+View* NonClientView::GetEventHandlerForRect(const gfx::RectF& rect) {
if (!UsePointBasedTargeting(rect))
return View::GetEventHandlerForRect(rect);
@@ -201,10 +201,8 @@ View* NonClientView::GetEventHandlerForRect(const gfx::Rect& rect) {
// During the reset of the frame_view_ it's possible to be in this code
// after it's been removed from the view hierarchy but before it's been
// removed from the NonClientView.
- gfx::RectF rect_in_child_coords_f(rect);
- View::ConvertRectToTarget(this, frame_view_.get(), &rect_in_child_coords_f);
- gfx::Rect rect_in_child_coords = gfx::ToEnclosingRect(
- rect_in_child_coords_f);
+ gfx::RectF rect_in_child_coords(rect);
+ View::ConvertRectToTarget(this, frame_view_.get(), &rect_in_child_coords);
if (frame_view_->HitTestRect(rect_in_child_coords))
return frame_view_->GetEventHandlerForRect(rect_in_child_coords);
}
@@ -303,10 +301,11 @@ int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point,
////////////////////////////////////////////////////////////////////////////////
// NonClientFrameView, View overrides:
-bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const {
+bool NonClientFrameView::HitTestRect(const gfx::RectF& rect) const {
// For the default case, we assume the non-client frame view never overlaps
// the client view.
- return !GetWidget()->client_view()->bounds().Intersects(rect);
+ gfx::RectF bounds(GetWidget()->client_view()->bounds());
+ return bounds.Intersects(rect);
}
////////////////////////////////////////////////////////////////////////////////
« ui/views/rect_based_targeting_utils.cc ('K') | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698