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

Unified Diff: cc/layers/layer.cc

Issue 12552004: Support bottom-right anchored fixed-position elements during a pinch gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move [Web]LayerPositionConstraint conversion to glue Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
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 {
+ if (!transform_.IsIdentityOrTranslation())
+ return true;
+ if (parent_ && !parent_->sublayer_transform_.IsIdentityOrTranslation())
+ 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_);
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/trees/layer_tree_host_common.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698