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

Unified Diff: ui/views/view.cc

Issue 15071002: WIP - loop in LayoutManager for preferred size changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scoped layouter Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc » ('j') | 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 0e12e14f494eed0172f426d2ca2986b44a24d97f..48e1b1eb9372cc1571c69ff0b5fd828e44ef107a 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -156,6 +156,15 @@ ViewsDelegate* ViewsDelegate::views_delegate = NULL;
// static
const char View::kViewClassName[] = "views/View";
+ScopedMaybeLayout::ScopedMaybeLayout(views::View* view) : view_(view) {
+ view_->InvalidateLayout();
+}
+
+ScopedMaybeLayout::~ScopedMaybeLayout() {
+ if (view_->needs_layout_)
+ view_->Layout();
+}
+
////////////////////////////////////////////////////////////////////////////////
// View, public:
@@ -596,8 +605,8 @@ void View::InvalidateLayout() {
// Always invalidate up. This is needed to handle the case of us already being
// valid, but not our parent.
needs_layout_ = true;
- if (parent_)
- parent_->InvalidateLayout();
+// if (parent_)
+// parent_->InvalidateLayout();
}
LayoutManager* View::GetLayoutManager() const {
@@ -1251,13 +1260,18 @@ int View::GetLineScrollIncrement(ScrollView* scroll_view,
// Size and disposition --------------------------------------------------------
-void View::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+void View::ChildPreferredSizeChanged(View* child) {
+ if (layout_manager_)
+ layout_manager_->OnChildPreferredSizeChanged(this, child);
}
void View::PreferredSizeChanged() {
- InvalidateLayout();
+ ScopedMaybeLayout layout(this);
+// InvalidateLayout();
if (parent_)
parent_->ChildPreferredSizeChanged(this);
+// if (needs_layout_)
+// Layout();
}
bool View::NeedsNotificationWhenVisibleBoundsChange() const {
« no previous file with comments | « ui/views/view.h ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698