Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: ui/gfx/geometry/r_tree.cc

Issue 278403004: fix incorrect bounds on remove child from root (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: found probably unrelated bug Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/geometry/r_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/geometry/r_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698