Index: ui/views/view.cc |
diff --git a/ui/views/view.cc b/ui/views/view.cc |
index 2918ee1aa908ae9dc847777214cfe680b8c38149..f4f6f0d577dffded361184822bb4f012f532f88e 100644 |
--- a/ui/views/view.cc |
+++ b/ui/views/view.cc |
@@ -217,9 +217,8 @@ |
// If |view| has a parent, remove it from its parent. |
View* parent = view->parent_; |
- ui::NativeTheme* old_theme = NULL; |
+ const ui::NativeTheme* old_theme = view->GetNativeTheme(); |
if (parent) { |
- old_theme = view->GetNativeTheme(); |
if (parent == this) { |
ReorderChildView(view, index); |
return; |
@@ -234,22 +233,19 @@ |
view->parent_ = this; |
children_.insert(children_.begin() + index, view); |
+ ViewHierarchyChangedDetails details(true, this, view, parent); |
+ |
+ for (View* v = this; v; v = v->parent_) |
+ v->ViewHierarchyChangedImpl(false, details); |
+ |
+ view->PropagateAddNotifications(details); |
+ UpdateTooltip(); |
views::Widget* widget = GetWidget(); |
if (widget) { |
- const ui::NativeTheme* new_theme = view->GetNativeTheme(); |
+ RegisterChildrenForVisibleBoundsNotification(view); |
+ const ui::NativeTheme* new_theme = widget->GetNativeTheme(); |
if (new_theme != old_theme) |
view->PropagateNativeThemeChanged(new_theme); |
- } |
- |
- ViewHierarchyChangedDetails details(true, this, view, parent); |
- |
- for (View* v = this; v; v = v->parent_) |
- v->ViewHierarchyChangedImpl(false, details); |
- |
- view->PropagateAddNotifications(details); |
- UpdateTooltip(); |
- if (widget) { |
- RegisterChildrenForVisibleBoundsNotification(view); |
if (view->visible()) |
view->SchedulePaint(); |
} |