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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.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: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 169d128faa2f31c7f85a841676eabcd731c45ef0..4108f5063860b3e06d6296530a0efe8ba2e51dbf 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -812,11 +812,11 @@ void TabStrip::UpdateLoadingAnimations() {
controller_->UpdateLoadingAnimations();
}
-bool TabStrip::IsPositionInWindowCaption(const gfx::Point& point) {
- return IsRectInWindowCaption(gfx::Rect(point, gfx::Size(1, 1)));
+bool TabStrip::IsPositionInWindowCaption(const gfx::PointF& point) {
+ return IsRectInWindowCaption(gfx::RectF(point, gfx::Size(1, 1)));
}
-bool TabStrip::IsRectInWindowCaption(const gfx::Rect& rect) {
+bool TabStrip::IsRectInWindowCaption(const gfx::RectF& rect) {
views::View* v = GetEventHandlerForRect(rect);
// If there is no control at this location, claim the hit was in the title
@@ -827,11 +827,10 @@ bool TabStrip::IsRectInWindowCaption(const gfx::Rect& rect) {
// Check to see if the rect intersects the non-button parts of the new tab
// button. The button has a non-rectangular shape, so if it's not in the
// visual portions of the button we treat it as a click to the caption.
- gfx::RectF rect_in_newtab_coords_f(rect);
- View::ConvertRectToTarget(this, newtab_button_, &rect_in_newtab_coords_f);
- gfx::Rect rect_in_newtab_coords = gfx::ToEnclosingRect(
- rect_in_newtab_coords_f);
- if (newtab_button_->GetLocalBounds().Intersects(rect_in_newtab_coords) &&
+ gfx::RectF rect_in_newtab_coords(rect);
+ View::ConvertRectToTarget(this, newtab_button_, &rect_in_newtab_coords);
+ gfx::RectF newtab_bounds(newtab_button_->GetLocalBounds());
+ if (newtab_bounds.Intersects(rect_in_newtab_coords) &&
!newtab_button_->HitTestRect(rect_in_newtab_coords))
return true;
@@ -1337,10 +1336,10 @@ void TabStrip::GetAccessibleState(ui::AXViewState* state) {
state->role = ui::AX_ROLE_TAB_LIST;
}
-views::View* TabStrip::GetEventHandlerForRect(const gfx::Rect& rect) {
+views::View* TabStrip::GetEventHandlerForRect(const gfx::RectF& rect) {
if (!views::UsePointBasedTargeting(rect))
return View::GetEventHandlerForRect(rect);
- const gfx::Point point(rect.CenterPoint());
+ const gfx::Point point(gfx::ToFlooredPoint(rect.CenterPoint()));
if (!touch_layout_.get()) {
// Return any view that isn't a Tab or this TabStrip immediately. We don't

Powered by Google App Engine
This is Rietveld 408576698