Commit 1e0f8d69 authored by enne@chromium.org's avatar enne@chromium.org

cc: Preserve currently scrolling layer during tree activation

BUG=168421


Review URL: https://chromiumcodereview.appspot.com/11826017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175729 0039d316-1c4b-4281-b951-d872f2087c98
parent 9513c15e
...@@ -1025,6 +1025,8 @@ void LayerTreeHostImpl::activatePendingTreeIfNeeded() ...@@ -1025,6 +1025,8 @@ void LayerTreeHostImpl::activatePendingTreeIfNeeded()
void LayerTreeHostImpl::activatePendingTree() void LayerTreeHostImpl::activatePendingTree()
{ {
CHECK(m_pendingTree); CHECK(m_pendingTree);
m_activeTree->PushPersistedState(m_pendingTree.get());
m_activeTree.swap(m_pendingTree); m_activeTree.swap(m_pendingTree);
// TODO(enne): consider recycling this tree to prevent layer churn // TODO(enne): consider recycling this tree to prevent layer churn
m_pendingTree.reset(); m_pendingTree.reset();
......
...@@ -177,6 +177,12 @@ void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { ...@@ -177,6 +177,12 @@ void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
layer_id_map_.erase(layer->id()); layer_id_map_.erase(layer->id());
} }
void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) {
int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0;
pendingTree->set_currently_scrolling_layer(
LayerTreeHostCommon::findLayerInSubtree(pendingTree->RootLayer(), id));
}
const LayerTreeSettings& LayerTreeImpl::settings() const { const LayerTreeSettings& LayerTreeImpl::settings() const {
return layer_tree_host_impl_->settings(); return layer_tree_host_impl_->settings();
} }
......
...@@ -129,6 +129,8 @@ class CC_EXPORT LayerTreeImpl { ...@@ -129,6 +129,8 @@ class CC_EXPORT LayerTreeImpl {
AnimationRegistrar* animationRegistrar() const; AnimationRegistrar* animationRegistrar() const;
void PushPersistedState(LayerTreeImpl* pendingTree);
protected: protected:
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl);
...@@ -144,7 +146,7 @@ protected: ...@@ -144,7 +146,7 @@ protected:
typedef base::hash_map<int, LayerImpl*> LayerIdMap; typedef base::hash_map<int, LayerImpl*> LayerIdMap;
LayerIdMap layer_id_map_; LayerIdMap layer_id_map_;
// Persisted state // Persisted state for non-impl-side-painting.
int scrolling_layer_id_from_previous_tree_; int scrolling_layer_id_from_previous_tree_;
// List of visible layers for the most recently prepared frame. Used for // List of visible layers for the most recently prepared frame. Used for
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment