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

Unified Diff: cc/layers/layer.cc

Issue 1736073002: cc: Move SyncedScrollOffset to scroll tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove scroll_offset() from LayerImpl Created 4 years, 10 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 38427416ddb98f0ad442ed2d10bca8a819db13f7..f171dc5bb7a9d0deee1834cc78bcdd76a71dbacd 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -884,6 +884,10 @@ void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) {
if (!layer_tree_host_)
return;
+ if (scroll_tree_index() != -1 && scrollable())
+ layer_tree_host_->property_trees()->scroll_tree.SetScrollOffset(
+ id(), scroll_offset);
+
if (TransformNode* transform_node =
layer_tree_host_->property_trees()->transform_tree.Node(
transform_tree_index())) {
@@ -923,6 +927,11 @@ void Layer::SetScrollOffsetFromImplSide(
SetNeedsPushProperties();
bool needs_rebuild = true;
+
+ if (scroll_tree_index() != -1 && scrollable())
+ layer_tree_host_->property_trees()->scroll_tree.SetScrollOffset(
+ id(), scroll_offset);
+
if (TransformNode* transform_node =
layer_tree_host_->property_trees()->transform_tree.Node(
transform_tree_index())) {
@@ -1337,9 +1346,10 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
// active tree. To do so, avoid scrolling the pending tree along with it
// instead of trying to undo that scrolling later.
if (ScrollOffsetAnimationWasInterrupted())
- layer->PushScrollOffsetFromMainThreadAndClobberActiveValue(scroll_offset_);
- else
- layer->PushScrollOffsetFromMainThread(scroll_offset_);
+ layer_tree_host()
+ ->property_trees()
+ ->scroll_tree.synced_scroll_offset(layer->id())
+ ->set_clobber_active_value();
layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment());
{
@@ -1700,8 +1710,7 @@ void Layer::FromLayerSpecificPropertiesProto(
}
scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
- return LayerImpl::Create(tree_impl, layer_id_,
- new LayerImpl::SyncedScrollOffset);
+ return LayerImpl::Create(tree_impl, layer_id_);
}
bool Layer::DrawsContent() const {

Powered by Google App Engine
This is Rietveld 408576698