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 #include "ui/compositor/layer_owner.h" | 5 #include "ui/compositor/layer_owner.h" |
6 | 6 |
7 #include "ui/compositor/layer_owner_delegate.h" | 7 #include "ui/compositor/layer_owner_delegate.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 const gfx::Rect layer_bounds(old_layer->bounds()); | 38 const gfx::Rect layer_bounds(old_layer->bounds()); |
39 Layer* new_layer = new ui::Layer(old_layer->type()); | 39 Layer* new_layer = new ui::Layer(old_layer->type()); |
40 SetLayer(new_layer); | 40 SetLayer(new_layer); |
41 new_layer->SetVisible(old_layer->GetTargetVisibility()); | 41 new_layer->SetVisible(old_layer->GetTargetVisibility()); |
42 new_layer->SetOpacity(old_layer->GetTargetOpacity()); | 42 new_layer->SetOpacity(old_layer->GetTargetOpacity()); |
43 new_layer->SetBounds(layer_bounds); | 43 new_layer->SetBounds(layer_bounds); |
44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds()); | 44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds()); |
45 new_layer->set_name(old_layer->name()); | 45 new_layer->set_name(old_layer->name()); |
46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); | 46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); |
47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); | 47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); |
| 48 new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset()); |
48 | 49 |
49 // Install new layer as a sibling of the old layer, stacked below it. | 50 // Install new layer as a sibling of the old layer, stacked below it. |
50 if (old_layer->parent()) { | 51 if (old_layer->parent()) { |
51 old_layer->parent()->Add(new_layer); | 52 old_layer->parent()->Add(new_layer); |
52 old_layer->parent()->StackBelow(new_layer, old_layer.get()); | 53 old_layer->parent()->StackBelow(new_layer, old_layer.get()); |
53 } | 54 } |
54 | 55 |
55 // Migrate all the child layers over to the new layer. Copy the list because | 56 // Migrate all the child layers over to the new layer. Copy the list because |
56 // the items are removed during iteration. | 57 // the items are removed during iteration. |
57 std::vector<ui::Layer*> children_copy = old_layer->children(); | 58 std::vector<ui::Layer*> children_copy = old_layer->children(); |
(...skipping 17 matching lines...) Expand all Loading... |
75 void LayerOwner::DestroyLayer() { | 76 void LayerOwner::DestroyLayer() { |
76 layer_ = NULL; | 77 layer_ = NULL; |
77 layer_owner_.reset(); | 78 layer_owner_.reset(); |
78 } | 79 } |
79 | 80 |
80 bool LayerOwner::OwnsLayer() const { | 81 bool LayerOwner::OwnsLayer() const { |
81 return !!layer_owner_; | 82 return !!layer_owner_; |
82 } | 83 } |
83 | 84 |
84 } // namespace ui | 85 } // namespace ui |
OLD | NEW |