Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1432 | 1432 |
| 1433 base::Closure View::PrepareForLayerBoundsChange() { | 1433 base::Closure View::PrepareForLayerBoundsChange() { |
| 1434 return base::Closure(); | 1434 return base::Closure(); |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 void View::ReorderLayers() { | 1437 void View::ReorderLayers() { |
| 1438 View* v = this; | 1438 View* v = this; |
| 1439 while (v && !v->layer()) | 1439 while (v && !v->layer()) |
| 1440 v = v->parent(); | 1440 v = v->parent(); |
| 1441 | 1441 |
| 1442 // Forward to widget in case we're in a NativeWidgetAura. | 1442 if (GetWidget()) { |
|
sky
2013/05/23 15:36:49
cache call to GetWidget
| |
| 1443 if (!v) { | 1443 // If the widget has a view with an attached NativeView (eg NativeViewHost), |
| 1444 if (GetWidget()) | 1444 // the widget's layers must be reordered. The attached NativeView's layer is |
| 1445 // always parented to the widget's layer regardless of whether the host view | |
| 1446 // has an ancestor view with a layer. | |
| 1447 if (!v || GetWidget()->HasNativeViewAttachedToViewTree()) | |
|
sky
2013/05/23 15:36:49
HasNativeViewAttachedToViewTree doesn't make sense
| |
| 1445 GetWidget()->ReorderLayers(); | 1448 GetWidget()->ReorderLayers(); |
| 1446 } else { | 1449 } |
| 1450 if (v) { | |
| 1447 for (Views::const_iterator i(v->children_.begin()); | 1451 for (Views::const_iterator i(v->children_.begin()); |
| 1448 i != v->children_.end(); | 1452 i != v->children_.end(); |
| 1449 ++i) | 1453 ++i) |
| 1450 (*i)->ReorderChildLayers(v->layer()); | 1454 (*i)->ReorderChildLayers(v->layer()); |
| 1451 } | 1455 } |
| 1452 } | 1456 } |
| 1453 | 1457 |
| 1454 void View::ReorderChildLayers(ui::Layer* parent_layer) { | 1458 void View::ReorderChildLayers(ui::Layer* parent_layer) { |
| 1455 if (layer()) { | 1459 if (layer()) { |
| 1456 DCHECK_EQ(parent_layer, layer()->parent()); | 1460 DCHECK_EQ(parent_layer, layer()->parent()); |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2298 ConvertPointToWidget(this, &widget_location); | 2302 ConvertPointToWidget(this, &widget_location); |
| 2299 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2303 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
| 2300 source); | 2304 source); |
| 2301 return true; | 2305 return true; |
| 2302 #else | 2306 #else |
| 2303 return false; | 2307 return false; |
| 2304 #endif // !defined(OS_MACOSX) | 2308 #endif // !defined(OS_MACOSX) |
| 2305 } | 2309 } |
| 2306 | 2310 |
| 2307 } // namespace views | 2311 } // namespace views |
| OLD | NEW |