Index: ui/views/view.cc |
diff --git a/ui/views/view.cc b/ui/views/view.cc |
index 0e12e14f494eed0172f426d2ca2986b44a24d97f..5931f77aa88ec3377238b0fd1392e5c723a8dd2a 100644 |
--- a/ui/views/view.cc |
+++ b/ui/views/view.cc |
@@ -163,6 +163,7 @@ const char View::kViewClassName[] = "views/View"; |
View::View() |
: owned_by_client_(false), |
+ weak_ptr_factory_(this), |
id_(0), |
group_(-1), |
parent_(NULL), |
@@ -596,8 +597,11 @@ 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(); |
+ // Schedule a layout |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&View::LayoutIfNeeded, |
+ weak_ptr_factory_.GetWeakPtr())); |
} |
LayoutManager* View::GetLayoutManager() const { |
@@ -1251,7 +1255,9 @@ 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() { |
@@ -1822,6 +1828,11 @@ void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { |
// Size and disposition -------------------------------------------------------- |
+void View::LayoutIfNeeded() { |
+ if (needs_layout_) |
+ Layout(); |
+} |
+ |
void View::PropagateVisibilityNotifications(View* start, bool is_visible) { |
for (int i = 0, count = child_count(); i < count; ++i) |
child_at(i)->PropagateVisibilityNotifications(start, is_visible); |