| 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/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 template <class T> | 50 template <class T> |
| 51 static void DistributeDelta(int delta, std::vector<T*>* elements) { | 51 static void DistributeDelta(int delta, std::vector<T*>* elements) { |
| 52 if (delta == 0) | 52 if (delta == 0) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 float total_percent = 0; | 55 float total_percent = 0; |
| 56 int resize_count = 0; | 56 int resize_count = 0; |
| 57 for (typename std::vector<T*>::iterator i = elements->begin(); | 57 for (typename std::vector<T*>::iterator i = elements->begin(); |
| 58 i != elements->end(); ++i) { | 58 i != elements->end(); ++i) { |
| 59 total_percent += (*i)->ResizePercent(); | 59 total_percent += (*i)->ResizePercent(); |
| 60 resize_count++; | 60 if ((*i)->ResizePercent() > 0) |
| 61 resize_count++; |
| 61 } | 62 } |
| 62 if (total_percent == 0) { | 63 if (total_percent == 0) { |
| 63 // None of the elements are resizable, return. | 64 // None of the elements are resizable, return. |
| 64 return; | 65 return; |
| 65 } | 66 } |
| 66 int remaining = delta; | 67 int remaining = delta; |
| 67 int resized = resize_count; | 68 int resized = resize_count; |
| 68 for (typename std::vector<T*>::iterator i = elements->begin(); | 69 for (typename std::vector<T*>::iterator i = elements->begin(); |
| 69 i != elements->end(); ++i) { | 70 i != elements->end(); ++i) { |
| 70 T* element = *i; | 71 T* element = *i; |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1064 |
| 1064 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1065 ColumnSet* GridLayout::GetLastValidColumnSet() { |
| 1065 for (int i = current_row_ - 1; i >= 0; --i) { | 1066 for (int i = current_row_ - 1; i >= 0; --i) { |
| 1066 if (rows_[i]->column_set()) | 1067 if (rows_[i]->column_set()) |
| 1067 return rows_[i]->column_set(); | 1068 return rows_[i]->column_set(); |
| 1068 } | 1069 } |
| 1069 return NULL; | 1070 return NULL; |
| 1070 } | 1071 } |
| 1071 | 1072 |
| 1072 } // namespace views | 1073 } // namespace views |
| OLD | NEW |