Made top controls work with virtual viewport pinch-to-zoom. (Chromium)

This change adjusts the scroll bubbling logic in LayerTreeHostImpl so
that outer viewport layer scrolls affect the top controls. Additionally,
the outer viewport's size is adjusted to match the inner viewport's
aspect ratio until a resize occurs.

Blink side: https://codereview.chromium.org/643473002
BUG=364109

Review URL: https://codereview.chromium.org/641873003

Cr-Commit-Position: refs/heads/master@{#299384}
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index dd7b359..d88f37c 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -771,10 +771,15 @@
   return layer_tree_impl_->IsActiveTree();
 }
 
-// TODO(aelias): Convert so that bounds returns SizeF.
 gfx::Size LayerImpl::bounds() const {
-  return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(),
-                                      bounds_.height() + bounds_delta_.y()));
+  gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_);
+  return gfx::Size(bounds_.width() + delta.x(),
+                   bounds_.height() + delta.y());
+}
+
+gfx::SizeF LayerImpl::BoundsForScrolling() const {
+  return gfx::SizeF(bounds_.width() + bounds_delta_.x(),
+                    bounds_.height() + bounds_delta_.y());
 }
 
 void LayerImpl::SetBounds(const gfx::Size& bounds) {
@@ -1174,7 +1179,7 @@
   DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() ||
          IsContainerForFixedPositionLayers());
 
-  gfx::SizeF scaled_scroll_bounds(bounds());
+  gfx::SizeF scaled_scroll_bounds(BoundsForScrolling());
 
   float scale_factor = 1.f;
   for (LayerImpl const* current_layer = this;
@@ -1242,11 +1247,12 @@
   DCHECK(scrollbar_clip_layer);
   DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() ||
          IsContainerForFixedPositionLayers());
-  gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds());
+  gfx::RectF clip_rect(gfx::PointF(),
+                       scrollbar_clip_layer->BoundsForScrolling());
 
   // See comment in MaxScrollOffset() regarding the use of the content layer
   // bounds here.
-  gfx::RectF scroll_rect(gfx::PointF(), bounds());
+  gfx::RectF scroll_rect(gfx::PointF(), BoundsForScrolling());
 
   if (scroll_rect.size().IsEmpty())
     return;