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

Side by Side Diff: ui/views/layout/grid_layout.cc

Issue 139623002: Tweaks to get views compiling with mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mismatch Created 6 years, 11 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 | « ui/views/corewm/transient_window_stacking_client.cc ('k') | ui/views/view.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/views/layout/grid_layout.h" 5 #include "ui/views/layout/grid_layout.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 int min_width, 421 int min_width,
422 bool is_padding) { 422 bool is_padding) {
423 Column* column = new Column(h_align, v_align, resize_percent, size_type, 423 Column* column = new Column(h_align, v_align, resize_percent, size_type,
424 fixed_width, min_width, columns_.size(), 424 fixed_width, min_width, columns_.size(),
425 is_padding); 425 is_padding);
426 columns_.push_back(column); 426 columns_.push_back(column);
427 } 427 }
428 428
429 void ColumnSet::AddViewState(ViewState* view_state) { 429 void ColumnSet::AddViewState(ViewState* view_state) {
430 // view_states are ordered by column_span (in ascending order). 430 // view_states are ordered by column_span (in ascending order).
431 std::vector<ViewState*>::iterator i = lower_bound(view_states_.begin(), 431 std::vector<ViewState*>::iterator i = std::lower_bound(view_states_.begin(),
432 view_states_.end(), 432 view_states_.end(),
433 view_state, 433 view_state,
434 CompareByColumnSpan); 434 CompareByColumnSpan);
435 view_states_.insert(i, view_state); 435 view_states_.insert(i, view_state);
436 } 436 }
437 437
438 void ColumnSet::CalculateMasterColumns() { 438 void ColumnSet::CalculateMasterColumns() {
439 for (std::vector<Column*>::iterator i = columns_.begin(); 439 for (std::vector<Column*>::iterator i = columns_.begin();
440 i != columns_.end(); ++i) { 440 i != columns_.end(); ++i) {
441 Column* column = *i; 441 Column* column = *i;
442 int same_size_column_index = column->same_size_column_; 442 int same_size_column_index = column->same_size_column_;
443 if (same_size_column_index != -1) { 443 if (same_size_column_index != -1) {
444 DCHECK(same_size_column_index >= 0 && 444 DCHECK(same_size_column_index >= 0 &&
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 AccumulateMasterColumns(); 496 AccumulateMasterColumns();
497 } 497 }
498 498
499 void ColumnSet::AccumulateMasterColumns() { 499 void ColumnSet::AccumulateMasterColumns() {
500 DCHECK(master_columns_.empty()); 500 DCHECK(master_columns_.empty());
501 for (std::vector<Column*>::iterator i = columns_.begin(); 501 for (std::vector<Column*>::iterator i = columns_.begin();
502 i != columns_.end(); ++i) { 502 i != columns_.end(); ++i) {
503 Column* column = *i; 503 Column* column = *i;
504 Column* master_column = column->GetLastMasterColumn(); 504 Column* master_column = column->GetLastMasterColumn();
505 if (master_column && 505 if (master_column &&
506 find(master_columns_.begin(), master_columns_.end(), 506 std::find(master_columns_.begin(), master_columns_.end(),
507 master_column) == master_columns_.end()) { 507 master_column) == master_columns_.end()) {
508 master_columns_.push_back(master_column); 508 master_columns_.push_back(master_column);
509 } 509 }
510 // At this point, GetLastMasterColumn may not == master_column 510 // At this point, GetLastMasterColumn may not == master_column
511 // (may have to go through a few Columns)_. Reset master_column to 511 // (may have to go through a few Columns)_. Reset master_column to
512 // avoid hops. 512 // avoid hops.
513 column->master_column_ = master_column; 513 column->master_column_ = master_column;
514 } 514 }
515 } 515 }
516 516
517 void ColumnSet::UnifySameSizedColumnSizes() { 517 void ColumnSet::UnifySameSizedColumnSizes() {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 view_state->view->parent() == host_)); 973 view_state->view->parent() == host_));
974 if (!view_state->view->parent()) { 974 if (!view_state->view->parent()) {
975 adding_view_ = true; 975 adding_view_ = true;
976 host_->AddChildView(view_state->view); 976 host_->AddChildView(view_state->view);
977 adding_view_ = false; 977 adding_view_ = false;
978 } 978 }
979 remaining_row_span_ = std::max(remaining_row_span_, view_state->row_span); 979 remaining_row_span_ = std::max(remaining_row_span_, view_state->row_span);
980 next_column_ += view_state->col_span; 980 next_column_ += view_state->col_span;
981 current_row_col_set_->AddViewState(view_state); 981 current_row_col_set_->AddViewState(view_state);
982 // view_states are ordered by row_span (in ascending order). 982 // view_states are ordered by row_span (in ascending order).
983 std::vector<ViewState*>::iterator i = lower_bound(view_states_.begin(), 983 std::vector<ViewState*>::iterator i = std::lower_bound(view_states_.begin(),
984 view_states_.end(), 984 view_states_.end(),
985 view_state, 985 view_state,
986 CompareByRowSpan); 986 CompareByRowSpan);
987 view_states_.insert(i, view_state); 987 view_states_.insert(i, view_state);
988 SkipPaddingColumns(); 988 SkipPaddingColumns();
989 } 989 }
990 990
991 void GridLayout::AddRow(Row* row) { 991 void GridLayout::AddRow(Row* row) {
992 current_row_++; 992 current_row_++;
993 remaining_row_span_--; 993 remaining_row_span_--;
994 // GridLayout requires that if you add a View with a row span you use the same 994 // GridLayout requires that if you add a View with a row span you use the same
995 // column set for each of the rows the view lands it. This DCHECK verifies 995 // column set for each of the rows the view lands it. This DCHECK verifies
996 // that. 996 // that.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 1063
1064 ColumnSet* GridLayout::GetLastValidColumnSet() { 1064 ColumnSet* GridLayout::GetLastValidColumnSet() {
1065 for (int i = current_row_ - 1; i >= 0; --i) { 1065 for (int i = current_row_ - 1; i >= 0; --i) {
1066 if (rows_[i]->column_set()) 1066 if (rows_[i]->column_set())
1067 return rows_[i]->column_set(); 1067 return rows_[i]->column_set();
1068 } 1068 }
1069 return NULL; 1069 return NULL;
1070 } 1070 }
1071 1071
1072 } // namespace views 1072 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/transient_window_stacking_client.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698