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

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

Issue 23464036: Adds a comment to GridLayout to explain what DCHECK does (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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/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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 view_states_.end(), 988 view_states_.end(),
989 view_state, 989 view_state,
990 CompareByRowSpan); 990 CompareByRowSpan);
991 view_states_.insert(i, view_state); 991 view_states_.insert(i, view_state);
992 SkipPaddingColumns(); 992 SkipPaddingColumns();
993 } 993 }
994 994
995 void GridLayout::AddRow(Row* row) { 995 void GridLayout::AddRow(Row* row) {
996 current_row_++; 996 current_row_++;
997 remaining_row_span_--; 997 remaining_row_span_--;
998 // GridLayout requires that if you add a View with a row span you use the same
999 // column set for each of the rows the view lands it. This DCHECK verifies
1000 // that.
998 DCHECK(remaining_row_span_ <= 0 || 1001 DCHECK(remaining_row_span_ <= 0 ||
999 row->column_set() == NULL || 1002 row->column_set() == NULL ||
1000 row->column_set() == GetLastValidColumnSet()); 1003 row->column_set() == GetLastValidColumnSet());
1001 next_column_ = 0; 1004 next_column_ = 0;
1002 rows_.push_back(row); 1005 rows_.push_back(row);
1003 current_row_col_set_ = row->column_set(); 1006 current_row_col_set_ = row->column_set();
1004 SkipPaddingColumns(); 1007 SkipPaddingColumns();
1005 } 1008 }
1006 1009
1007 void GridLayout::UpdateRemainingHeightFromRows(ViewState* view_state) { 1010 void GridLayout::UpdateRemainingHeightFromRows(ViewState* view_state) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1067
1065 ColumnSet* GridLayout::GetLastValidColumnSet() { 1068 ColumnSet* GridLayout::GetLastValidColumnSet() {
1066 for (int i = current_row_ - 1; i >= 0; --i) { 1069 for (int i = current_row_ - 1; i >= 0; --i) {
1067 if (rows_[i]->column_set()) 1070 if (rows_[i]->column_set())
1068 return rows_[i]->column_set(); 1071 return rows_[i]->column_set();
1069 } 1072 }
1070 return NULL; 1073 return NULL;
1071 } 1074 }
1072 1075
1073 } // namespace views 1076 } // namespace views
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