Chromium Code Reviews| Index: cc/layers/layer.cc |
| diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
| index b07b30855615920ac9295c4587306604f527af76..71c6706dbe979cff8edd1efc781978b2e4bce6a0 100644 |
| --- a/cc/layers/layer.cc |
| +++ b/cc/layers/layer.cc |
| @@ -40,7 +40,6 @@ Layer::Layer() |
| opacity_(1.f), |
| anchor_point_z_(0.f), |
| is_container_for_fixed_position_layers_(false), |
| - fixed_to_container_layer_(false), |
| is_drawable_(false), |
| masks_to_bounds_(false), |
| contents_opaque_(false), |
| @@ -415,6 +414,14 @@ void Layer::SetPosition(gfx::PointF position) { |
| SetNeedsCommit(); |
| } |
| +bool Layer::is_container_for_fixed_position_layers() const { |
|
Sami
2013/03/25 11:41:37
Any reason why this is on Layer instead LayerImpl?
trchen
2013/03/26 01:45:28
Extra transform may be applied in LayerImpl but tr
|
| + if (!transform_.IsIdentityOrTranslation()) |
| + return true; |
| + if (parent_ && !parent_->sublayer_transform_.IsIdentityOrTranslation()) |
|
Sami
2013/03/25 11:41:37
Should we also check sublayer_transform_ for this
trchen
2013/03/26 01:45:28
It is arguable but I would vote not. The point of
shawnsingh
2013/03/27 19:46:39
In reply to Sami asking "Should we also check subl
|
| + return true; |
| + return is_container_for_fixed_position_layers_; |
| +} |
| + |
| void Layer::SetSublayerTransform(const gfx::Transform& sublayer_transform) { |
| if (sublayer_transform_ == sublayer_transform) |
| return; |
| @@ -532,7 +539,7 @@ void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { |
| bool Layer::DescendantIsFixedToContainerLayer() const { |
| for (size_t i = 0; i < children_.size(); ++i) { |
| - if (children_[i]->fixed_to_container_layer() || |
| + if (children_[i]->position_constraint_.is_fixed_position() || |
| children_[i]->DescendantIsFixedToContainerLayer()) |
| return true; |
| } |
| @@ -552,11 +559,11 @@ void Layer::SetIsContainerForFixedPositionLayers(bool container) { |
| SetNeedsCommit(); |
| } |
| -void Layer::SetFixedToContainerLayer(bool fixed_to_container_layer) { |
| - if (fixed_to_container_layer_ == fixed_to_container_layer) |
| - return; |
| - fixed_to_container_layer_ = fixed_to_container_layer; |
| - SetNeedsCommit(); |
| +void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { |
| + if (position_constraint_ == constraint) |
| + return; |
| + position_constraint_ = constraint; |
| + SetNeedsCommit(); |
| } |
| void Layer::PushPropertiesTo(LayerImpl* layer) { |
| @@ -587,7 +594,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { |
| layer->SetPosition(position_); |
| layer->SetIsContainerForFixedPositionLayers( |
| is_container_for_fixed_position_layers_); |
| - layer->SetFixedToContainerLayer(fixed_to_container_layer_); |
| + layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); |
| + layer->SetPositionConstraint(position_constraint_); |
| layer->SetPreserves3d(preserves_3d()); |
| layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| layer->SetSublayerTransform(sublayer_transform_); |