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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 } | 2072 } |
2073 | 2073 |
2074 // Accelerated painting -------------------------------------------------------- | 2074 // Accelerated painting -------------------------------------------------------- |
2075 | 2075 |
2076 void View::CreateLayer() { | 2076 void View::CreateLayer() { |
2077 // A new layer is being created for the view. So all the layers of the | 2077 // A new layer is being created for the view. So all the layers of the |
2078 // sub-tree can inherit the visibility of the corresponding view. | 2078 // sub-tree can inherit the visibility of the corresponding view. |
2079 for (int i = 0, count = child_count(); i < count; ++i) | 2079 for (int i = 0, count = child_count(); i < count; ++i) |
2080 child_at(i)->UpdateChildLayerVisibility(true); | 2080 child_at(i)->UpdateChildLayerVisibility(true); |
2081 | 2081 |
2082 SetLayer(new ui::Layer()); | 2082 SetLayer(base::MakeUnique<ui::Layer>()); |
2083 layer()->set_delegate(this); | 2083 layer()->set_delegate(this); |
2084 layer()->set_name(GetClassName()); | 2084 layer()->set_name(GetClassName()); |
2085 | 2085 |
2086 UpdateParentLayers(); | 2086 UpdateParentLayers(); |
2087 UpdateLayerVisibility(); | 2087 UpdateLayerVisibility(); |
2088 | 2088 |
2089 // The new layer needs to be ordered in the layer tree according | 2089 // The new layer needs to be ordered in the layer tree according |
2090 // to the view tree. Children of this layer were added in order | 2090 // to the view tree. Children of this layer were added in order |
2091 // in UpdateParentLayers(). | 2091 // in UpdateParentLayers(). |
2092 if (parent()) | 2092 if (parent()) |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 // Message the RootView to do the drag and drop. That way if we're removed | 2418 // Message the RootView to do the drag and drop. That way if we're removed |
2419 // the RootView can detect it and avoid calling us back. | 2419 // the RootView can detect it and avoid calling us back. |
2420 gfx::Point widget_location(event.location()); | 2420 gfx::Point widget_location(event.location()); |
2421 ConvertPointToWidget(this, &widget_location); | 2421 ConvertPointToWidget(this, &widget_location); |
2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2423 // WARNING: we may have been deleted. | 2423 // WARNING: we may have been deleted. |
2424 return true; | 2424 return true; |
2425 } | 2425 } |
2426 | 2426 |
2427 } // namespace views | 2427 } // namespace views |
OLD | NEW |