OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gfx/geometry/r_tree.h" | 5 #include "ui/gfx/geometry/r_tree.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 725 |
726 child = parent; | 726 child = parent; |
727 parent = parent->parent(); | 727 parent = parent->parent(); |
728 } | 728 } |
729 | 729 |
730 // If we stopped deleting nodes up the tree before encountering the root, | 730 // If we stopped deleting nodes up the tree before encountering the root, |
731 // we'll need to fix up the bounds from the first parent we didn't delete | 731 // we'll need to fix up the bounds from the first parent we didn't delete |
732 // up to the root. | 732 // up to the root. |
733 if (parent) { | 733 if (parent) { |
734 parent->RecomputeBounds(); | 734 parent->RecomputeBounds(); |
| 735 } else { |
| 736 root_->RecomputeBounds(); |
735 } | 737 } |
736 | 738 |
737 // Now re-insert each of the orphaned nodes back into the tree. | 739 // Now re-insert each of the orphaned nodes back into the tree. |
738 for (size_t i = 0; i < orphans.size(); ++i) { | 740 for (size_t i = 0; i < orphans.size(); ++i) { |
739 int starting_level = -1; | 741 int starting_level = -1; |
740 InsertNode(orphans[i], &starting_level); | 742 InsertNode(orphans[i], &starting_level); |
741 } | 743 } |
742 | 744 |
743 // Clear out the orphans list without deleting any of the children, as they | 745 // Clear out the orphans list without deleting any of the children, as they |
744 // have been re-inserted into the tree. | 746 // have been re-inserted into the tree. |
745 orphans.weak_clear(); | 747 orphans.weak_clear(); |
746 } | 748 } |
747 | 749 |
748 } // namespace gfx | 750 } // namespace gfx |
OLD | NEW |