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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 } | 533 } |
534 } | 534 } |
535 | 535 |
536 void View::SetPaintToLayer(ui::LayerType layer_type) { | 536 void View::SetPaintToLayer(ui::LayerType layer_type) { |
537 if (paint_to_layer_ && (layer()->type() == layer_type)) | 537 if (paint_to_layer_ && (layer()->type() == layer_type)) |
538 return; | 538 return; |
539 | 539 |
540 DestroyLayer(); | 540 DestroyLayer(); |
541 CreateLayer(layer_type); | 541 CreateLayer(layer_type); |
542 paint_to_layer_ = true; | 542 paint_to_layer_ = true; |
543 | |
544 // Notify the parent chain about the layer change. | |
545 View* view = this; | |
sky
2017/04/17 15:24:01
View* view = parent();
and then you don't need two
ananta
2017/04/18 03:04:25
Done.
| |
546 while (view && view->parent()) { | |
547 view->parent()->OnChildLayerChanged(view); | |
548 view = view->parent(); | |
549 } | |
543 } | 550 } |
544 | 551 |
545 void View::DestroyLayer() { | 552 void View::DestroyLayer() { |
sky
2017/04/17 15:24:01
DestroyLayer needs to call OnChildLayerChanged too
ananta
2017/04/18 03:04:25
Done.
| |
546 if (!paint_to_layer_) | 553 if (!paint_to_layer_) |
547 return; | 554 return; |
548 | 555 |
549 paint_to_layer_ = false; | 556 paint_to_layer_ = false; |
550 if (!layer()) | 557 if (!layer()) |
551 return; | 558 return; |
552 | 559 |
553 ui::Layer* new_parent = layer()->parent(); | 560 ui::Layer* new_parent = layer()->parent(); |
554 std::vector<ui::Layer*> children = layer()->children(); | 561 std::vector<ui::Layer*> children = layer()->children(); |
555 for (size_t i = 0; i < children.size(); ++i) { | 562 for (size_t i = 0; i < children.size(); ++i) { |
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2644 // Message the RootView to do the drag and drop. That way if we're removed | 2651 // Message the RootView to do the drag and drop. That way if we're removed |
2645 // the RootView can detect it and avoid calling us back. | 2652 // the RootView can detect it and avoid calling us back. |
2646 gfx::Point widget_location(event.location()); | 2653 gfx::Point widget_location(event.location()); |
2647 ConvertPointToWidget(this, &widget_location); | 2654 ConvertPointToWidget(this, &widget_location); |
2648 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2655 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2649 // WARNING: we may have been deleted. | 2656 // WARNING: we may have been deleted. |
2650 return true; | 2657 return true; |
2651 } | 2658 } |
2652 | 2659 |
2653 } // namespace views | 2660 } // namespace views |
OLD | NEW |