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

Side by Side Diff: ui/compositor/layer_owner.cc

Issue 231193002: Makes recreating a layer inherit target visibility and opacity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/compositor/compositor.gyp ('k') | ui/compositor/layer_owner_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 #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 20 matching lines...) Expand all
31 scoped_ptr<ui::Layer> old_layer(AcquireLayer()); 31 scoped_ptr<ui::Layer> old_layer(AcquireLayer());
32 if (!old_layer) 32 if (!old_layer)
33 return old_layer.Pass(); 33 return old_layer.Pass();
34 34
35 LayerDelegate* old_delegate = old_layer->delegate(); 35 LayerDelegate* old_delegate = old_layer->delegate();
36 old_layer->set_delegate(NULL); 36 old_layer->set_delegate(NULL);
37 37
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->visible()); 41 new_layer->SetVisible(old_layer->GetTargetVisibility());
42 new_layer->SetOpacity(old_layer->GetTargetOpacity());
42 new_layer->set_scale_content(old_layer->scale_content()); 43 new_layer->set_scale_content(old_layer->scale_content());
43 new_layer->SetBounds(layer_bounds); 44 new_layer->SetBounds(layer_bounds);
44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds()); 45 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
45 new_layer->set_name(old_layer->name()); 46 new_layer->set_name(old_layer->name());
46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); 47 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely());
47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); 48 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely());
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);
(...skipping 23 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698