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

Side by Side Diff: ui/app_list/apps_grid_view.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
« no previous file with comments | « content/renderer/webplugin_delegate_proxy.cc ('k') | ui/app_list/page_switcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/app_list/apps_grid_view.h" 5 #include "ui/app_list/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/app_list_item_model.h" 9 #include "ui/app_list/app_list_item_model.h"
10 #include "ui/app_list/app_list_item_view.h" 10 #include "ui/app_list/app_list_item_view.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 void AppsGridView::CalculateIdealBounds() { 396 void AppsGridView::CalculateIdealBounds() {
397 gfx::Rect rect(GetContentsBounds()); 397 gfx::Rect rect(GetContentsBounds());
398 if (rect.IsEmpty()) 398 if (rect.IsEmpty())
399 return; 399 return;
400 400
401 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight); 401 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight);
402 402
403 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_, 403 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_,
404 tile_size.height() * rows_per_page_)); 404 tile_size.height() * rows_per_page_));
405 grid_rect = grid_rect.Intersect(rect); 405 grid_rect.Intersect(rect);
406 406
407 // Page width including padding pixels. A tile.x + page_width means the same 407 // Page width including padding pixels. A tile.x + page_width means the same
408 // tile slot in the next page. 408 // tile slot in the next page.
409 const int page_width = grid_rect.width() + kPagePadding; 409 const int page_width = grid_rect.width() + kPagePadding;
410 410
411 // If there is a transition, calculates offset for current and target page. 411 // If there is a transition, calculates offset for current and target page.
412 const int current_page = pagination_model_->selected_page(); 412 const int current_page = pagination_model_->selected_page();
413 const PaginationModel::Transition& transition = 413 const PaginationModel::Transition& transition =
414 pagination_model_->transition(); 414 pagination_model_->transition();
415 const bool is_valid = 415 const bool is_valid =
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 void AppsGridView::TransitionChanged() { 681 void AppsGridView::TransitionChanged() {
682 // Update layout for valid page transition only since over-scroll no longer 682 // Update layout for valid page transition only since over-scroll no longer
683 // animates app icons. 683 // animates app icons.
684 const PaginationModel::Transition& transition = 684 const PaginationModel::Transition& transition =
685 pagination_model_->transition(); 685 pagination_model_->transition();
686 if (pagination_model_->is_valid_page(transition.target_page)) 686 if (pagination_model_->is_valid_page(transition.target_page))
687 Layout(); 687 Layout();
688 } 688 }
689 689
690 } // namespace app_list 690 } // namespace app_list
OLDNEW
« no previous file with comments | « content/renderer/webplugin_delegate_proxy.cc ('k') | ui/app_list/page_switcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698