Prevent scroll contents being smaller than clip

The linked bug breaks when root-layer-scrolls is turned on because the
scrolling contents layer of the LayoutView's CompositedLayerMapping gets
its size from LayoutView::DocumentRect which is based on the overflow
rect. This is fractional because of Android's minimum-scale frame resize
after layout. This is snapped and becomes 1px shorter than the main
frame - which uses an expanded int rect in WebViewImpl::MainFrameSize().
This causes the background override to not be seen in the bottom row of
pixels.

This works without RLS because the LayoutView itself doesn't have a
scrolling contents layer - the main GraphicsLayer itself is the
scrolling contents and its size comes from
PaintLayer::BoundingBoxForCompositing which uses the expanded-int frame
size for the root layer.

The fix in this CL is to ensure a scrolling contents layer is always at
least as large as its clipping layer. This must necessarily be the case
since we only create scrolling layers if we have overflow. Even if we
only overflow in one dimension, the other dimension is typically set to
the clip size so this is the expectation.

An additional change is required in this CL. The scrolling bounds as
used in CC to calculate whether CC-controlled scrollbars should be shown
uses the same minimum-scale main frame resize as in WebViewImpl
mentioned above. This incorrectly keeps the bounds in fractional pixels.
Since we now effectively ceil the bounds in Blink, we do the same in CC
to avoid showing the scrollbars unnecessarily.

Bug: 811406
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Idcbdac1b03999f30c8d373f4b45dc6040d8f8514
Reviewed-on: https://chromium-review.googlesource.com/949772
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: enne <enne@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542023}
5 files changed