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

Side by Side Diff: ui/views/view.cc

Issue 259073004: Revert of retry r266042: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 AddChildViewAt(view, child_count()); 210 AddChildViewAt(view, child_count());
211 } 211 }
212 212
213 void View::AddChildViewAt(View* view, int index) { 213 void View::AddChildViewAt(View* view, int index) {
214 CHECK_NE(view, this) << "You cannot add a view as its own child"; 214 CHECK_NE(view, this) << "You cannot add a view as its own child";
215 DCHECK_GE(index, 0); 215 DCHECK_GE(index, 0);
216 DCHECK_LE(index, child_count()); 216 DCHECK_LE(index, child_count());
217 217
218 // If |view| has a parent, remove it from its parent. 218 // If |view| has a parent, remove it from its parent.
219 View* parent = view->parent_; 219 View* parent = view->parent_;
220 ui::NativeTheme* old_theme = NULL; 220 const ui::NativeTheme* old_theme = view->GetNativeTheme();
221 if (parent) { 221 if (parent) {
222 old_theme = view->GetNativeTheme();
223 if (parent == this) { 222 if (parent == this) {
224 ReorderChildView(view, index); 223 ReorderChildView(view, index);
225 return; 224 return;
226 } 225 }
227 parent->DoRemoveChildView(view, true, true, false, this); 226 parent->DoRemoveChildView(view, true, true, false, this);
228 } 227 }
229 228
230 // Sets the prev/next focus views. 229 // Sets the prev/next focus views.
231 InitFocusSiblings(view, index); 230 InitFocusSiblings(view, index);
232 231
233 // Let's insert the view. 232 // Let's insert the view.
234 view->parent_ = this; 233 view->parent_ = this;
235 children_.insert(children_.begin() + index, view); 234 children_.insert(children_.begin() + index, view);
236 235
237 views::Widget* widget = GetWidget();
238 if (widget) {
239 const ui::NativeTheme* new_theme = view->GetNativeTheme();
240 if (new_theme != old_theme)
241 view->PropagateNativeThemeChanged(new_theme);
242 }
243
244 ViewHierarchyChangedDetails details(true, this, view, parent); 236 ViewHierarchyChangedDetails details(true, this, view, parent);
245 237
246 for (View* v = this; v; v = v->parent_) 238 for (View* v = this; v; v = v->parent_)
247 v->ViewHierarchyChangedImpl(false, details); 239 v->ViewHierarchyChangedImpl(false, details);
248 240
249 view->PropagateAddNotifications(details); 241 view->PropagateAddNotifications(details);
250 UpdateTooltip(); 242 UpdateTooltip();
243 views::Widget* widget = GetWidget();
251 if (widget) { 244 if (widget) {
252 RegisterChildrenForVisibleBoundsNotification(view); 245 RegisterChildrenForVisibleBoundsNotification(view);
246 const ui::NativeTheme* new_theme = widget->GetNativeTheme();
247 if (new_theme != old_theme)
248 view->PropagateNativeThemeChanged(new_theme);
253 if (view->visible()) 249 if (view->visible())
254 view->SchedulePaint(); 250 view->SchedulePaint();
255 } 251 }
256 252
257 if (layout_manager_.get()) 253 if (layout_manager_.get())
258 layout_manager_->ViewAdded(this, view); 254 layout_manager_->ViewAdded(this, view);
259 255
260 ReorderLayers(); 256 ReorderLayers();
261 257
262 // Make sure the visibility of the child layers are correct. 258 // Make sure the visibility of the child layers are correct.
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 // Message the RootView to do the drag and drop. That way if we're removed 2385 // Message the RootView to do the drag and drop. That way if we're removed
2390 // the RootView can detect it and avoid calling us back. 2386 // the RootView can detect it and avoid calling us back.
2391 gfx::Point widget_location(event.location()); 2387 gfx::Point widget_location(event.location());
2392 ConvertPointToWidget(this, &widget_location); 2388 ConvertPointToWidget(this, &widget_location);
2393 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2389 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2394 // WARNING: we may have been deleted. 2390 // WARNING: we may have been deleted.
2395 return true; 2391 return true;
2396 } 2392 }
2397 2393
2398 } // namespace views 2394 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698