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

Unified Diff: ui/views/view.cc

Issue 566403002: Optimize View::UpdateRootBounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | 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 8b79faa37d5d25db90f0eca216514acce879b65d..51e890ed75883344b9468713772398e3f0bf1256 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -417,8 +417,14 @@ void View::SetVisible(bool visible) {
UpdateLayerVisibility();
// If we are newly visible, schedule paint.
- if (visible_)
+ if (visible_) {
SchedulePaint();
+ } else {
+ // We're never painted when hidden, so no need to be in the BoudsTree.
tfarina 2014/09/15 18:02:09 s/BoudsTree/BoundsTree
+ BoundsTree* bounds_tree = GetBoundsTreeFromPaintRoot();
+ if (bounds_tree)
+ RemoveRootBounds(bounds_tree);
+ }
}
}
@@ -2011,6 +2017,14 @@ void View::SetRootBoundsDirty(bool origin_changed) {
}
void View::UpdateRootBounds(BoundsTree* tree, const gfx::Vector2d& offset) {
+ // If we're not visible no need to update BoundsTree. When we are made visible
+ // the BoundsTree will be updated appropriately.
+ if (!visible_)
+ return;
+
+ if (!root_bounds_dirty_ && children_.empty())
+ return;
+
// No need to recompute bounds if we haven't flagged ours as dirty.
TRACE_EVENT1("views", "View::UpdateRootBounds", "class", GetClassName());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698