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

Unified Diff: ui/views/view.cc

Issue 342723002: Repairs crash in RTreeBase::Node::LeastAreaEnlargement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: crash fix and test added Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 6cb29e9f85c25b1bed8b71ec853af80f423643cf..c8ebd0abb67cda2dde5193c03c6c364b94e86a87 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -782,7 +782,7 @@ void View::Paint(gfx::Canvas* canvas, const CullSet& cull_set) {
// propagation to our children.
if (IsPaintRoot()) {
if (!bounds_tree_)
- bounds_tree_.reset(new gfx::RTree(2, 5));
+ bounds_tree_.reset(new BoundsTree(2, 5));
// Recompute our bounds tree as needed.
UpdateRootBounds(bounds_tree_.get(), gfx::Vector2d());
@@ -798,7 +798,8 @@ void View::Paint(gfx::Canvas* canvas, const CullSet& cull_set) {
// our canvas bounds.
scoped_ptr<base::hash_set<intptr_t> > damaged_views(
new base::hash_set<intptr_t>());
- bounds_tree_->Query(canvas_bounds, damaged_views.get());
+ bounds_tree_->AppendIntersectingRecords(
+ canvas_bounds, damaged_views.get());
// Construct a CullSet to wrap the damaged views set, it will delete it
// for us on scope exit.
CullSet paint_root_cull_set(damaged_views.Pass());
@@ -1867,7 +1868,7 @@ void View::DoRemoveChildView(View* view,
// Remove the bounds of this child and any of its descendants from our
// paint root bounds tree.
- gfx::RTree* bounds_tree = GetBoundsTreeFromPaintRoot();
+ BoundsTree* bounds_tree = GetBoundsTreeFromPaintRoot();
if (bounds_tree)
view->RemoveRootBounds(bounds_tree);
@@ -2078,7 +2079,7 @@ void View::SetRootBoundsDirty(bool origin_changed) {
}
}
-void View::UpdateRootBounds(gfx::RTree* tree, const gfx::Vector2d& offset) {
+void View::UpdateRootBounds(BoundsTree* tree, const gfx::Vector2d& offset) {
// No need to recompute bounds if we haven't flagged ours as dirty.
TRACE_EVENT1("views", "View::UpdateRootBounds", "class", GetClassName());
@@ -2103,7 +2104,7 @@ void View::UpdateRootBounds(gfx::RTree* tree, const gfx::Vector2d& offset) {
}
}
-void View::RemoveRootBounds(gfx::RTree* tree) {
+void View::RemoveRootBounds(BoundsTree* tree) {
tree->Remove(reinterpret_cast<intptr_t>(this));
root_bounds_dirty_ = true;
@@ -2114,8 +2115,8 @@ void View::RemoveRootBounds(gfx::RTree* tree) {
}
}
-gfx::RTree* View::GetBoundsTreeFromPaintRoot() {
- gfx::RTree* bounds_tree = bounds_tree_.get();
+View::BoundsTree* View::GetBoundsTreeFromPaintRoot() {
+ BoundsTree* bounds_tree = bounds_tree_.get();
View* paint_root = this;
while (!bounds_tree && !paint_root->IsPaintRoot()) {
// Assumption is that if IsPaintRoot() is false then parent_ is valid.
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698