Separate layer property pushes from tree structure syncs and clean up scrollbar layer pointers

We need sync the cc::Layer tree structure and layer properties to cc::LayerImpls
at commit time. We track when properties and tree structure change and use that
to decide whether to do a full tree sync or just a property push. This patch
separates the property push to always happen seperately from the tree sync.

The scrollbar and scroll layer pointer code needed a bit of cleanup to make this
work. Before this patch, the way that scrolling worked was during the scrollbar
pointer sync inside TreeSynchronizer::synchronizeTrees() was what actually
updated the scroll offsets as a side effect of setting the pointer values. This
patch rejiggers things so the ScrollbarAnimationController maintains the scroll
properties at all times and the scrollbar layers pull values from their
controller. As a bonus, this means changes to the scroll offset no longer need
a full tree sync - they just need a property push.

The scrollable bounds are also now pulled from the layer directly instead of the
first child of a layer to avoid depending on properties updating in a specific
order and be overall less hacky. This depends on webkit.org/b/106518

BUG=169143


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176540 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 38fb937..d94d38f 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -47,8 +47,14 @@
 
 void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) {
   root_layer_ = layer.Pass();
+  root_scroll_layer_ = NULL;
+  currently_scrolling_layer_ = NULL;
+
+  layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+}
+
+void LayerTreeImpl::FindRootScrollLayer() {
   root_scroll_layer_ = findRootScrollLayer(root_layer_.get());
-  currently_scrolling_layer_ = 0;
 
   if (root_layer_ && scrolling_layer_id_from_previous_tree_) {
     currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree(
@@ -57,8 +63,6 @@
   }
 
   scrolling_layer_id_from_previous_tree_ = 0;
-
-  layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
 }
 
 scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() {