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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 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 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/window_sizer/window_sizer_common_unittest.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h"
6 6
7 #include "ash/wm/window_resizer.h" 7 #include "ash/wm/window_resizer.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 26 matching lines...) Expand all
37 return work_areas_[GetMonitorIndexMatchingBounds(match_rect)]; 37 return work_areas_[GetMonitorIndexMatchingBounds(match_rect)];
38 } 38 }
39 39
40 size_t TestMonitorInfoProvider::GetMonitorIndexMatchingBounds( 40 size_t TestMonitorInfoProvider::GetMonitorIndexMatchingBounds(
41 const gfx::Rect& match_rect) const { 41 const gfx::Rect& match_rect) const {
42 int max_area = 0; 42 int max_area = 0;
43 size_t max_area_index = 0; 43 size_t max_area_index = 0;
44 // Loop through all the monitors, finding the one that intersects the 44 // Loop through all the monitors, finding the one that intersects the
45 // largest area of the supplied match rect. 45 // largest area of the supplied match rect.
46 for (size_t i = 0; i < work_areas_.size(); ++i) { 46 for (size_t i = 0; i < work_areas_.size(); ++i) {
47 gfx::Rect overlap(match_rect.Intersect(work_areas_[i])); 47 gfx::Rect overlap = work_areas_[i];
48 overlap.Intersect(match_rect);
48 int area = overlap.width() * overlap.height(); 49 int area = overlap.width() * overlap.height();
49 if (area > max_area) { 50 if (area > max_area) {
50 max_area = area; 51 max_area = area;
51 max_area_index = i; 52 max_area_index = i;
52 } 53 }
53 } 54 }
54 return max_area_index; 55 return max_area_index;
55 } 56 }
56 57
57 TestStateProvider::TestStateProvider(): 58 TestStateProvider::TestStateProvider():
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 { // Check that a window which hangs out of the screen get moved back in. 379 { // Check that a window which hangs out of the screen get moved back in.
379 gfx::Rect window_bounds; 380 gfx::Rect window_bounds;
380 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(), 381 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(),
381 gfx::Rect(), DEFAULT, NULL, 382 gfx::Rect(), DEFAULT, NULL,
382 gfx::Rect(1020, 700, 100, 100), &window_bounds); 383 gfx::Rect(1020, 700, 100, 100), &window_bounds);
383 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); 384 EXPECT_EQ("924,668 100x100", window_bounds.ToString());
384 } 385 }
385 } 386 }
386 387
387 #endif // defined(OS_MACOSX) 388 #endif // defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer.cc ('k') | content/browser/renderer_host/accelerated_surface_container_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698