| 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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 UpdateRemainingHeightFromRows(view_state); | 930 UpdateRemainingHeightFromRows(view_state); |
| 931 | 931 |
| 932 // Distribute the remaining height. | 932 // Distribute the remaining height. |
| 933 DistributeRemainingHeight(view_state); | 933 DistributeRemainingHeight(view_state); |
| 934 } | 934 } |
| 935 | 935 |
| 936 // Update the location of each of the rows. | 936 // Update the location of each of the rows. |
| 937 LayoutElement::CalculateLocationsFromSize(&rows_); | 937 LayoutElement::CalculateLocationsFromSize(&rows_); |
| 938 | 938 |
| 939 // We now know the preferred height, set it here. | 939 // We now know the preferred height, set it here. |
| 940 pref->set_height(rows_[rows_.size() - 1]->Location() + | 940 pref->set_height(rows_.back()->Location() + rows_.back()->Size() + |
| 941 rows_[rows_.size() - 1]->Size() + insets_.height()); | 941 insets_.height()); |
| 942 | 942 |
| 943 if (layout && height != pref->height()) { | 943 if (layout && height != pref->height()) { |
| 944 // We're doing a layout, and the height differs from the preferred height, | 944 // We're doing a layout, and the height differs from the preferred height, |
| 945 // divy up the extra space. | 945 // divy up the extra space. |
| 946 LayoutElement::DistributeDelta(height - pref->height(), &rows_); | 946 LayoutElement::DistributeDelta(height - pref->height(), &rows_); |
| 947 | 947 |
| 948 // Reset y locations. | 948 // Reset y locations. |
| 949 LayoutElement::CalculateLocationsFromSize(&rows_); | 949 LayoutElement::CalculateLocationsFromSize(&rows_); |
| 950 } | 950 } |
| 951 } | 951 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1055 |
| 1056 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1056 ColumnSet* GridLayout::GetLastValidColumnSet() { |
| 1057 for (int i = current_row_ - 1; i >= 0; --i) { | 1057 for (int i = current_row_ - 1; i >= 0; --i) { |
| 1058 if (rows_[i]->column_set()) | 1058 if (rows_[i]->column_set()) |
| 1059 return rows_[i]->column_set(); | 1059 return rows_[i]->column_set(); |
| 1060 } | 1060 } |
| 1061 return NULL; | 1061 return NULL; |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 } // namespace views | 1064 } // namespace views |
| OLD | NEW |