OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 view_state->baseline = view_state->view->GetBaseline(); | 890 view_state->baseline = view_state->view->GetBaseline(); |
891 | 891 |
892 if (view_state->h_align == FILL) { | 892 if (view_state->h_align == FILL) { |
893 // The view is resizable. As the pref height may vary with the width, | 893 // The view is resizable. As the pref height may vary with the width, |
894 // ask for the pref again. | 894 // ask for the pref again. |
895 int actual_width = | 895 int actual_width = |
896 view_state->column_set->GetColumnWidth(view_state->start_col, | 896 view_state->column_set->GetColumnWidth(view_state->start_col, |
897 view_state->col_span); | 897 view_state->col_span); |
898 if (actual_width != view_state->pref_width && | 898 if (actual_width != view_state->pref_width && |
899 !view_state->pref_height_fixed) { | 899 !view_state->pref_height_fixed) { |
900 // The width this view will get differs from it's preferred. Some Views | 900 // The width this view will get differs from its preferred. Some Views |
901 // pref height varies with it's width; ask for the preferred again. | 901 // pref height varies with its width; ask for the preferred again. |
902 view_state->pref_height = | 902 view_state->pref_height = |
903 view_state->view->GetHeightForWidth(actual_width); | 903 view_state->view->GetHeightForWidth(actual_width); |
904 view_state->remaining_height = view_state->pref_height; | 904 view_state->remaining_height = view_state->pref_height; |
905 } | 905 } |
906 } | 906 } |
907 } | 907 } |
908 | 908 |
909 // Update the height/ascent/descent of each row from the views. | 909 // Update the height/ascent/descent of each row from the views. |
910 std::vector<ViewState*>::iterator view_states_iterator = view_states_.begin(); | 910 std::vector<ViewState*>::iterator view_states_iterator = view_states_.begin(); |
911 for (; view_states_iterator != view_states_.end() && | 911 for (; view_states_iterator != view_states_.end() && |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 | 1061 |
1062 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1062 ColumnSet* GridLayout::GetLastValidColumnSet() { |
1063 for (int i = current_row_ - 1; i >= 0; --i) { | 1063 for (int i = current_row_ - 1; i >= 0; --i) { |
1064 if (rows_[i]->column_set()) | 1064 if (rows_[i]->column_set()) |
1065 return rows_[i]->column_set(); | 1065 return rows_[i]->column_set(); |
1066 } | 1066 } |
1067 return NULL; | 1067 return NULL; |
1068 } | 1068 } |
1069 | 1069 |
1070 } // namespace views | 1070 } // namespace views |
OLD | NEW |