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

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

Issue 258063009: retry r266622: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert Label changes completely 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 const ui::NativeTheme* old_theme = view->GetNativeTheme(); 220 ui::NativeTheme* old_theme = NULL;
221 if (parent) { 221 if (parent) {
222 old_theme = view->GetNativeTheme();
222 if (parent == this) { 223 if (parent == this) {
223 ReorderChildView(view, index); 224 ReorderChildView(view, index);
224 return; 225 return;
225 } 226 }
226 parent->DoRemoveChildView(view, true, true, false, this); 227 parent->DoRemoveChildView(view, true, true, false, this);
227 } 228 }
228 229
229 // Sets the prev/next focus views. 230 // Sets the prev/next focus views.
230 InitFocusSiblings(view, index); 231 InitFocusSiblings(view, index);
231 232
232 // Let's insert the view. 233 // Let's insert the view.
233 view->parent_ = this; 234 view->parent_ = this;
234 children_.insert(children_.begin() + index, view); 235 children_.insert(children_.begin() + index, view);
235 236
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
236 ViewHierarchyChangedDetails details(true, this, view, parent); 244 ViewHierarchyChangedDetails details(true, this, view, parent);
237 245
238 for (View* v = this; v; v = v->parent_) 246 for (View* v = this; v; v = v->parent_)
239 v->ViewHierarchyChangedImpl(false, details); 247 v->ViewHierarchyChangedImpl(false, details);
240 248
241 view->PropagateAddNotifications(details); 249 view->PropagateAddNotifications(details);
242 UpdateTooltip(); 250 UpdateTooltip();
243 views::Widget* widget = GetWidget();
244 if (widget) { 251 if (widget) {
245 RegisterChildrenForVisibleBoundsNotification(view); 252 RegisterChildrenForVisibleBoundsNotification(view);
246 const ui::NativeTheme* new_theme = widget->GetNativeTheme();
247 if (new_theme != old_theme)
248 view->PropagateNativeThemeChanged(new_theme);
249 if (view->visible()) 253 if (view->visible())
250 view->SchedulePaint(); 254 view->SchedulePaint();
251 } 255 }
252 256
253 if (layout_manager_.get()) 257 if (layout_manager_.get())
254 layout_manager_->ViewAdded(this, view); 258 layout_manager_->ViewAdded(this, view);
255 259
256 ReorderLayers(); 260 ReorderLayers();
257 261
258 // Make sure the visibility of the child layers are correct. 262 // Make sure the visibility of the child layers are correct.
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 // Message the RootView to do the drag and drop. That way if we're removed 2389 // Message the RootView to do the drag and drop. That way if we're removed
2386 // the RootView can detect it and avoid calling us back. 2390 // the RootView can detect it and avoid calling us back.
2387 gfx::Point widget_location(event.location()); 2391 gfx::Point widget_location(event.location());
2388 ConvertPointToWidget(this, &widget_location); 2392 ConvertPointToWidget(this, &widget_location);
2389 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2393 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2390 // WARNING: we may have been deleted. 2394 // WARNING: we may have been deleted.
2391 return true; 2395 return true;
2392 } 2396 }
2393 2397
2394 } // namespace views 2398 } // 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