| OLD | NEW |
| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 677 } |
| 678 return nullptr; | 678 return nullptr; |
| 679 } | 679 } |
| 680 | 680 |
| 681 void GridLayout::StartRowWithPadding(float vertical_resize, int column_set_id, | 681 void GridLayout::StartRowWithPadding(float vertical_resize, int column_set_id, |
| 682 float padding_resize, int padding) { | 682 float padding_resize, int padding) { |
| 683 AddPaddingRow(padding_resize, padding); | 683 AddPaddingRow(padding_resize, padding); |
| 684 StartRow(vertical_resize, column_set_id); | 684 StartRow(vertical_resize, column_set_id); |
| 685 } | 685 } |
| 686 | 686 |
| 687 void GridLayout::StartRow(float vertical_resize, int column_set_id) { | 687 void GridLayout::StartRow(float vertical_resize, |
| 688 int column_set_id, |
| 689 int height) { |
| 690 DCHECK_GE(height, 0); |
| 688 ColumnSet* column_set = GetColumnSet(column_set_id); | 691 ColumnSet* column_set = GetColumnSet(column_set_id); |
| 689 DCHECK(column_set); | 692 DCHECK(column_set); |
| 690 AddRow(base::MakeUnique<Row>(0, vertical_resize, column_set)); | 693 AddRow(base::MakeUnique<Row>(height, vertical_resize, column_set)); |
| 691 } | 694 } |
| 692 | 695 |
| 693 void GridLayout::AddPaddingRow(float vertical_resize, int pixel_count) { | 696 void GridLayout::AddPaddingRow(float vertical_resize, int pixel_count) { |
| 694 AddRow(base::MakeUnique<Row>(pixel_count, vertical_resize, nullptr)); | 697 AddRow(base::MakeUnique<Row>(pixel_count, vertical_resize, nullptr)); |
| 695 } | 698 } |
| 696 | 699 |
| 697 void GridLayout::SkipColumns(int col_count) { | 700 void GridLayout::SkipColumns(int col_count) { |
| 698 DCHECK(col_count > 0); | 701 DCHECK(col_count > 0); |
| 699 next_column_ += col_count; | 702 next_column_ += col_count; |
| 700 DCHECK(current_row_col_set_ && | 703 DCHECK(current_row_col_set_ && |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1020 |
| 1018 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1021 ColumnSet* GridLayout::GetLastValidColumnSet() { |
| 1019 for (int i = current_row_ - 1; i >= 0; --i) { | 1022 for (int i = current_row_ - 1; i >= 0; --i) { |
| 1020 if (rows_[i]->column_set()) | 1023 if (rows_[i]->column_set()) |
| 1021 return rows_[i]->column_set(); | 1024 return rows_[i]->column_set(); |
| 1022 } | 1025 } |
| 1023 return nullptr; | 1026 return nullptr; |
| 1024 } | 1027 } |
| 1025 | 1028 |
| 1026 } // namespace views | 1029 } // namespace views |
| OLD | NEW |