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

Side by Side Diff: ui/app_list/apps_grid_view.cc

Issue 10832169: app_list: Make first col move for invalid page switch attempt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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_view.h" 9 #include "ui/app_list/app_list_item_view.h"
10 #include "ui/app_list/pagination_model.h" 10 #include "ui/app_list/pagination_model.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 else if (i > last_visible_index) 142 else if (i > last_visible_index)
143 x_offset = page_width; 143 x_offset = page_width;
144 144
145 int page = i / tiles_per_page(); 145 int page = i / tiles_per_page();
146 if (is_valid) { 146 if (is_valid) {
147 if (page == current_page || page == transition.target_page) 147 if (page == current_page || page == transition.target_page)
148 x_offset += transition_offset; 148 x_offset += transition_offset;
149 } else { 149 } else {
150 const int col = i % cols_; 150 const int col = i % cols_;
151 if (transition_offset > 0) 151 if (transition_offset > 0)
152 x_offset += transition_offset * col; 152 x_offset += transition_offset * (col + 1);
153 else 153 else
154 x_offset += transition_offset * (cols_ - col - 1); 154 x_offset += transition_offset * (cols_ - col);
155 } 155 }
156 156
157 gfx::Rect adjusted_slot(tile_slot); 157 gfx::Rect adjusted_slot(tile_slot);
158 adjusted_slot.Offset(x_offset, 0); 158 adjusted_slot.Offset(x_offset, 0);
159 view->SetBoundsRect(adjusted_slot); 159 view->SetBoundsRect(adjusted_slot);
160 160
161 tile_slot.Offset(tile_size.width(), 0); 161 tile_slot.Offset(tile_size.width(), 0);
162 if ((i + 1) % tiles_per_page() == 0) { 162 if ((i + 1) % tiles_per_page() == 0) {
163 tile_slot.set_origin(grid_rect.origin()); 163 tile_slot.set_origin(grid_rect.origin());
164 } else if ((i + 1) % cols_ == 0) { 164 } else if ((i + 1) % cols_ == 0) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 void AppsGridView::SelectedPageChanged(int old_selected, int new_selected) { 312 void AppsGridView::SelectedPageChanged(int old_selected, int new_selected) {
313 Layout(); 313 Layout();
314 } 314 }
315 315
316 void AppsGridView::TransitionChanged() { 316 void AppsGridView::TransitionChanged() {
317 Layout(); 317 Layout();
318 } 318 }
319 319
320 } // namespace app_list 320 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698