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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip_unittest.cc

Issue 1302233006: aura: Stop converting Rect to RectF implicitly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rectfconvert-aura: . Created 5 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 unified diff | Download patch
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 "chrome/browser/ui/views/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" 8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h"
9 #include "chrome/browser/ui/views/tabs/tab.h" 9 #include "chrome/browser/ui/views/tabs/tab.h"
10 #include "chrome/browser/ui/views/tabs/tab_strip.h" 10 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 bool valid_mask = delegate->GetHitTestMask(&mask); 147 bool valid_mask = delegate->GetHitTestMask(&mask);
148 DCHECK(valid_mask); 148 DCHECK(valid_mask);
149 149
150 return gfx::ToEnclosingRect((gfx::SkRectToRectF(mask.getBounds()))); 150 return gfx::ToEnclosingRect((gfx::SkRectToRectF(mask.getBounds())));
151 } 151 }
152 152
153 // Returns the rectangular hit test region of the tab close button of 153 // Returns the rectangular hit test region of the tab close button of
154 // |tab| in |tab|'s coordinate space (including padding if |padding| 154 // |tab| in |tab|'s coordinate space (including padding if |padding|
155 // is true). 155 // is true).
156 gfx::Rect GetTabCloseHitTestMask(Tab* tab, bool padding) { 156 gfx::Rect GetTabCloseHitTestMask(Tab* tab, bool padding) {
157 gfx::RectF bounds_f = tab->close_button_->GetContentsBounds(); 157 gfx::RectF bounds_f = gfx::RectF(tab->close_button_->GetContentsBounds());
158 if (padding) 158 if (padding)
159 bounds_f = tab->close_button_->GetLocalBounds(); 159 bounds_f = gfx::RectF(tab->close_button_->GetLocalBounds());
160 views::View::ConvertRectToTarget(tab->close_button_, tab, &bounds_f); 160 views::View::ConvertRectToTarget(tab->close_button_, tab, &bounds_f);
161 return gfx::ToEnclosingRect(bounds_f); 161 return gfx::ToEnclosingRect(bounds_f);
162 } 162 }
163 163
164 // Checks whether |tab| contains |point_in_tabstrip_coords|, where the point 164 // Checks whether |tab| contains |point_in_tabstrip_coords|, where the point
165 // is in |tab_strip_| coordinates. 165 // is in |tab_strip_| coordinates.
166 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords) { 166 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords) {
167 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 167 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
168 views::View::ConvertPointToTarget(tab_strip_, tab, &point_in_tab_coords); 168 views::View::ConvertPointToTarget(tab_strip_, tab, &point_in_tab_coords);
169 return tab->HitTestPoint(point_in_tab_coords); 169 return tab->HitTestPoint(point_in_tab_coords);
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ASSERT_TRUE(IsPointInTab(most_right_tab, unactive_overlap)); 621 ASSERT_TRUE(IsPointInTab(most_right_tab, unactive_overlap));
622 622
623 EXPECT_EQ( 623 EXPECT_EQ(
624 right_tab, 624 right_tab,
625 FindTabView(tab_strip_->GetTooltipHandlerForPoint(unactive_overlap))); 625 FindTabView(tab_strip_->GetTooltipHandlerForPoint(unactive_overlap)));
626 626
627 // Confirm that tab strip doe not return tooltip handler for points that 627 // Confirm that tab strip doe not return tooltip handler for points that
628 // don't hit it. 628 // don't hit it.
629 EXPECT_FALSE(tab_strip_->GetTooltipHandlerForPoint(gfx::Point(-1, 2))); 629 EXPECT_FALSE(tab_strip_->GetTooltipHandlerForPoint(gfx::Point(-1, 2)));
630 } 630 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc ('k') | ui/aura/test/test_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698