Index: cc/layers/layer.cc |
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
index 938449cb968e2e57ac3e792c1c4d9d6ddd1c548b..2acf5f0dbdc865f49c03806482fbfe7f709eb868 100644 |
--- a/cc/layers/layer.cc |
+++ b/cc/layers/layer.cc |
@@ -118,6 +118,9 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
if (layer_tree_host_ == host) |
return; |
+ if (layer_tree_host_) |
+ layer_tree_host_->property_trees()->needs_rebuild = true; |
+ |
layer_tree_host_ = host; |
// When changing hosts, the layer needs to commit its properties to the impl |
@@ -154,6 +157,19 @@ void Layer::SetNeedsCommit() { |
return; |
SetNeedsPushProperties(); |
+ layer_tree_host_->property_trees()->needs_rebuild = true; |
+ |
+ if (ignore_set_needs_commit_) |
+ return; |
+ |
+ layer_tree_host_->SetNeedsCommit(); |
+} |
+ |
+void Layer::SetNeedsCommitNoRebuild() { |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ SetNeedsPushProperties(); |
if (ignore_set_needs_commit_) |
return; |
@@ -165,6 +181,7 @@ void Layer::SetNeedsFullTreeSync() { |
if (!layer_tree_host_) |
return; |
+ layer_tree_host_->property_trees()->needs_rebuild = true; |
ajuma
2015/04/16 14:52:14
LayerTreeHost::SetNeedsFullTreeSync will trigger a
enne (OOO)
2015/04/16 21:49:33
That's kind of subtle to skip it. I think I'd pre
|
layer_tree_host_->SetNeedsFullTreeSync(); |
} |
@@ -335,8 +352,20 @@ void Layer::SetBounds(const gfx::Size& size) { |
DCHECK(IsPropertyChangeAllowed()); |
if (bounds() == size) |
return; |
- |
bounds_ = size; |
+ |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ if (ClipNode* clip_node = layer_tree_host_->property_trees()->clip_tree.Node( |
+ clip_tree_index())) { |
+ if (clip_node->owner_id == id()) { |
+ clip_node->data.clip.set_size(size); |
+ SetNeedsCommitNoRebuild(); |
+ return; |
+ } |
+ } |
+ |
SetNeedsCommit(); |
ajuma
2015/04/16 14:52:14
In what situations will changing bounds change whe
Ian Vollick
2015/04/17 14:56:22
None! I've gotten rid of the early out and we now
|
} |
@@ -577,6 +606,22 @@ void Layer::SetPosition(const gfx::PointF& position) { |
if (position_ == position) |
return; |
position_ = position; |
+ |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ if (TransformNode* transform_node = |
+ layer_tree_host_->property_trees()->transform_tree.Node( |
+ transform_tree_index())) { |
+ if (transform_node->owner_id == id()) { |
+ transform_node->data.update_post_local_transform(position, |
+ transform_origin()); |
+ transform_node->data.needs_local_transform_update = true; |
+ SetNeedsCommitNoRebuild(); |
+ return; |
+ } |
+ } |
+ |
SetNeedsCommit(); |
ajuma
2015/04/16 14:52:13
Can setting position change whether a transform no
Ian Vollick
2015/04/17 14:56:22
The latter, yeah.
|
} |
@@ -594,6 +639,21 @@ void Layer::SetTransform(const gfx::Transform& transform) { |
return; |
transform_ = transform; |
transform_is_invertible_ = transform.IsInvertible(); |
+ |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ if (TransformNode* transform_node = |
+ layer_tree_host_->property_trees()->transform_tree.Node( |
+ transform_tree_index())) { |
+ if (transform_node->owner_id == id()) { |
+ transform_node->data.local = transform; |
+ transform_node->data.needs_local_transform_update = true; |
ajuma
2015/04/16 14:52:14
Could changing a transform's value affect whether
Ian Vollick
2015/04/17 14:56:22
Yeah, it could. I've updated this code to check fo
|
+ SetNeedsCommitNoRebuild(); |
+ return; |
+ } |
+ } |
+ |
SetNeedsCommit(); |
ajuma
2015/04/16 14:52:14
As a future optimization (not in this CL), we coul
ajuma
2015/04/16 14:55:04
Actually, I take this back; a 2d translation would
Ian Vollick
2015/04/17 14:56:22
We've talked about the offset_to_transform_parent
|
} |
@@ -602,6 +662,22 @@ void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { |
if (transform_origin_ == transform_origin) |
return; |
transform_origin_ = transform_origin; |
+ |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ if (TransformNode* transform_node = |
+ layer_tree_host_->property_trees()->transform_tree.Node( |
+ transform_tree_index())) { |
+ if (transform_node->owner_id == id()) { |
+ transform_node->data.update_post_local_transform(position(), |
+ transform_origin); |
+ transform_node->data.needs_local_transform_update = true; |
+ SetNeedsCommitNoRebuild(); |
+ return; |
+ } |
+ } |
+ |
SetNeedsCommit(); |
} |
@@ -679,6 +755,22 @@ void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { |
if (scroll_offset_ == scroll_offset) |
return; |
scroll_offset_ = scroll_offset; |
+ |
+ if (!layer_tree_host_) |
+ return; |
+ |
+ if (TransformNode* transform_node = |
+ layer_tree_host_->property_trees()->transform_tree.Node( |
+ transform_tree_index())) { |
+ if (transform_node->owner_id == id()) { |
+ transform_node->data.scroll_offset = |
+ gfx::ScrollOffsetToVector2dF(CurrentScrollOffset()); |
+ transform_node->data.needs_local_transform_update = true; |
+ SetNeedsCommitNoRebuild(); |
+ return; |
+ } |
+ } |
+ |
SetNeedsCommit(); |
} |
@@ -694,8 +786,8 @@ gfx::Vector2dF Layer::ScrollCompensationAdjustment() const { |
return scroll_compensation_adjustment_; |
} |
-void Layer::SetScrollOffsetFromImplSide( |
- const gfx::ScrollOffset& scroll_offset) { |
+void Layer::SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset, |
+ LayerTreeHost* host) { |
ajuma
2015/04/16 14:52:14
Will this ever get called with a |host| that's not
Ian Vollick
2015/04/17 14:56:22
Nope. Removed.
|
DCHECK(IsPropertyChangeAllowed()); |
// This function only gets called during a BeginMainFrame, so there |
// is no need to call SetNeedsUpdate here. |
@@ -704,6 +796,21 @@ void Layer::SetScrollOffsetFromImplSide( |
return; |
scroll_offset_ = scroll_offset; |
SetNeedsPushProperties(); |
+ |
+ bool needs_rebuild = true; |
+ if (TransformNode* transform_node = |
+ host->property_trees()->transform_tree.Node(transform_tree_index())) { |
+ if (transform_node->owner_id == id()) { |
+ transform_node->data.scroll_offset = |
+ gfx::ScrollOffsetToVector2dF(CurrentScrollOffset()); |
+ transform_node->data.needs_local_transform_update = true; |
+ needs_rebuild = false; |
+ } |
+ } |
+ |
+ if (needs_rebuild) |
+ host->property_trees()->needs_rebuild = true; |
+ |
if (!did_scroll_callback_.is_null()) |
did_scroll_callback_.Run(); |
// The callback could potentially change the layer structure: |
@@ -1019,6 +1126,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { |
base::Passed(&original_request))); |
main_thread_copy_requests.push_back(main_thread_request.Pass()); |
} |
+ if (!copy_requests_.empty() && layer_tree_host_) |
+ layer_tree_host_->property_trees()->needs_rebuild = true; |
copy_requests_.clear(); |
layer->PassCopyRequests(&main_thread_copy_requests); |
@@ -1157,6 +1266,14 @@ void Layer::OnFilterAnimated(const FilterOperations& filters) { |
void Layer::OnOpacityAnimated(float opacity) { |
opacity_ = opacity; |
+ if (layer_tree_host_) { |
+ if (OpacityNode* node = |
+ layer_tree_host_->property_trees()->opacity_tree.Node( |
+ opacity_tree_index_)) { |
+ if (node->owner_id == id()) |
+ node->data = opacity; |
+ } |
+ } |
} |
void Layer::OnTransformAnimated(const gfx::Transform& transform) { |
@@ -1164,6 +1281,17 @@ void Layer::OnTransformAnimated(const gfx::Transform& transform) { |
return; |
transform_ = transform; |
transform_is_invertible_ = transform.IsInvertible(); |
+ if (layer_tree_host_) { |
+ if (TransformNode* node = |
+ layer_tree_host_->property_trees()->transform_tree.Node( |
+ transform_tree_index_)) { |
+ if (node->owner_id == id()) { |
+ node->data.local = transform; |
+ node->data.needs_local_transform_update = true; |
+ node->data.is_animated = true; |
+ } |
+ } |
+ } |
} |
void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { |