| 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> | |
| 8 | |
| 9 #include "base/logging.h" | 7 #include "base/logging.h" |
| 10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" |
| 12 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
| 13 #include "ui/views/layout/layout_provider.h" | 12 #include "ui/views/layout/layout_provider.h" |
| 14 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 15 #include "ui/views/window/dialog_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
| 16 | 15 |
| 17 namespace views { | 16 namespace views { |
| 18 | 17 |
| 19 // LayoutElement ------------------------------------------------------ | 18 // LayoutElement ------------------------------------------------------ |
| 20 | 19 |
| 21 // A LayoutElement has a size and location along one axis. It contains | 20 // A LayoutElement has a size and location along one axis. It contains |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 477 } |
| 479 } | 478 } |
| 480 } | 479 } |
| 481 AccumulateMasterColumns(); | 480 AccumulateMasterColumns(); |
| 482 } | 481 } |
| 483 | 482 |
| 484 void ColumnSet::AccumulateMasterColumns() { | 483 void ColumnSet::AccumulateMasterColumns() { |
| 485 DCHECK(master_columns_.empty()); | 484 DCHECK(master_columns_.empty()); |
| 486 for (const auto& column : columns_) { | 485 for (const auto& column : columns_) { |
| 487 Column* master_column = column->GetLastMasterColumn(); | 486 Column* master_column = column->GetLastMasterColumn(); |
| 488 if (master_column && | 487 if (master_column && !base::ContainsValue(master_columns_, master_column)) { |
| 489 std::find(master_columns_.begin(), master_columns_.end(), | |
| 490 master_column) == master_columns_.end()) { | |
| 491 master_columns_.push_back(master_column); | 488 master_columns_.push_back(master_column); |
| 492 } | 489 } |
| 493 // At this point, GetLastMasterColumn may not == master_column | 490 // At this point, GetLastMasterColumn may not == master_column |
| 494 // (may have to go through a few Columns)_. Reset master_column to | 491 // (may have to go through a few Columns)_. Reset master_column to |
| 495 // avoid hops. | 492 // avoid hops. |
| 496 column->master_column_ = master_column; | 493 column->master_column_ = master_column; |
| 497 } | 494 } |
| 498 } | 495 } |
| 499 | 496 |
| 500 void ColumnSet::UnifyLinkedColumnSizes() { | 497 void ColumnSet::UnifyLinkedColumnSizes() { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 | 1019 |
| 1023 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1020 ColumnSet* GridLayout::GetLastValidColumnSet() { |
| 1024 for (int i = current_row_ - 1; i >= 0; --i) { | 1021 for (int i = current_row_ - 1; i >= 0; --i) { |
| 1025 if (rows_[i]->column_set()) | 1022 if (rows_[i]->column_set()) |
| 1026 return rows_[i]->column_set(); | 1023 return rows_[i]->column_set(); |
| 1027 } | 1024 } |
| 1028 return nullptr; | 1025 return nullptr; |
| 1029 } | 1026 } |
| 1030 | 1027 |
| 1031 } // namespace views | 1028 } // namespace views |
| OLD | NEW |