| 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.h" |    5 #include "ui/compositor/layer.h" | 
|    6  |    6  | 
|    7 #include <algorithm> |    7 #include <algorithm> | 
|    8  |    8  | 
|    9 #include "base/command_line.h" |    9 #include "base/command_line.h" | 
|   10 #include "base/debug/trace_event.h" |   10 #include "base/debug/trace_event.h" | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   88       delegate_(NULL), |   88       delegate_(NULL), | 
|   89       scale_content_(true), |   89       scale_content_(true), | 
|   90       device_scale_factor_(1.0f) { |   90       device_scale_factor_(1.0f) { | 
|   91   CreateWebLayer(); |   91   CreateWebLayer(); | 
|   92 } |   92 } | 
|   93  |   93  | 
|   94 Layer::~Layer() { |   94 Layer::~Layer() { | 
|   95   // Destroying the animator may cause observers to use the layer (and |   95   // Destroying the animator may cause observers to use the layer (and | 
|   96   // indirectly the WebLayer). Destroy the animator first so that the WebLayer |   96   // indirectly the WebLayer). Destroy the animator first so that the WebLayer | 
|   97   // is still around. |   97   // is still around. | 
|   98   animator_.reset(); |   98   if (animator_) | 
 |   99     animator_->SetDelegate(NULL); | 
 |  100   animator_ = NULL; | 
|   99   if (compositor_) |  101   if (compositor_) | 
|  100     compositor_->SetRootLayer(NULL); |  102     compositor_->SetRootLayer(NULL); | 
|  101   if (parent_) |  103   if (parent_) | 
|  102     parent_->Remove(this); |  104     parent_->Remove(this); | 
|  103   if (layer_mask_) |  105   if (layer_mask_) | 
|  104     SetMaskLayer(NULL); |  106     SetMaskLayer(NULL); | 
|  105   if (layer_mask_back_link_) |  107   if (layer_mask_back_link_) | 
|  106     layer_mask_back_link_->SetMaskLayer(NULL); |  108     layer_mask_back_link_->SetMaskLayer(NULL); | 
|  107   for (size_t i = 0; i < children_.size(); ++i) |  109   for (size_t i = 0; i < children_.size(); ++i) | 
|  108     children_[i]->parent_ = NULL; |  110     children_[i]->parent_ = NULL; | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  167   for (const Layer* parent = other; parent; parent = parent->parent()) { |  169   for (const Layer* parent = other; parent; parent = parent->parent()) { | 
|  168     if (parent == this) |  170     if (parent == this) | 
|  169       return true; |  171       return true; | 
|  170   } |  172   } | 
|  171   return false; |  173   return false; | 
|  172 } |  174 } | 
|  173  |  175  | 
|  174 void Layer::SetAnimator(LayerAnimator* animator) { |  176 void Layer::SetAnimator(LayerAnimator* animator) { | 
|  175   if (animator) |  177   if (animator) | 
|  176     animator->SetDelegate(this); |  178     animator->SetDelegate(this); | 
|  177   animator_.reset(animator); |  179   animator_ = animator; | 
|  178 } |  180 } | 
|  179  |  181  | 
|  180 LayerAnimator* Layer::GetAnimator() { |  182 LayerAnimator* Layer::GetAnimator() { | 
|  181   if (!animator_.get()) |  183   if (!animator_.get()) | 
|  182     SetAnimator(LayerAnimator::CreateDefaultAnimator()); |  184     SetAnimator(LayerAnimator::CreateDefaultAnimator()); | 
|  183   return animator_.get(); |  185   return animator_.get(); | 
|  184 } |  186 } | 
|  185  |  187  | 
|  186 void Layer::SetTransform(const ui::Transform& transform) { |  188 void Layer::SetTransform(const ui::Transform& transform) { | 
|  187   GetAnimator()->SetTransform(transform); |  189   GetAnimator()->SetTransform(transform); | 
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  773     return; |  775     return; | 
|  774   unsigned int color = 0xFF000000; |  776   unsigned int color = 0xFF000000; | 
|  775   color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |  777   color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 
|  776   bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |  778   bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 
|  777   if (!opaque) |  779   if (!opaque) | 
|  778     color |= 0xFF; |  780     color |= 0xFF; | 
|  779   web_layer_->setDebugBorderColor(color); |  781   web_layer_->setDebugBorderColor(color); | 
|  780 } |  782 } | 
|  781  |  783  | 
|  782 }  // namespace ui |  784 }  // namespace ui | 
| OLD | NEW |