Made Blink aware of top controls offset
commit88eae010cdf470913c2575222185c6ab99067df4
authorbokan <bokan@chromium.org>
Tue, 9 Sep 2014 20:40:42 +0000 (9 13:40 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 9 Sep 2014 20:51:01 +0000 (9 20:51 +0000)
tree83d35a93d52c701276ae0185a4eee5468dabb8f4
parent1df5b71300297a83efb39b8666ba0ff44369947c
Made Blink aware of top controls offset

Added all the plumbing to make Blink aware of the top controls position
and how its viewport has been resized as a result. This CL adds all the
machinery and plumbing but does not yet connect main-thread scrolls to
the top controls. This is needed to support scrolling the top controls
during slow-scrolls as well as correct viewport behavior in the virtual
viewport pinch-to-zoom.

The machinery for top controls now includes two values:

top_controls_layout_height: The amount that the viewport was shrunk to
accommodate the top controls. This is updated only during a layout that
causes a viewport resize (i.e. RenderWidget::OnResize). The compositor
needs this to know how much the viewport layer has already been resized
by Blink.

top_controls_content_offset: The amount that the top controls are showing.
This will be the same as top_controls_layout_height right after a viewport
resize, but will diverge since the top controls will move without
immediately causing a RenderWidget resize.

Blink now keeps track of the top controls "content offset", which is the
distance the content is offset from the top of the screen due to top
controls. It receives updates to this value from the Impl thread during
a commit and echos them back to the compositor.

On the compositor side, the top controls layout height is moved into the
LayerTreeImpl. This is necessary since a commit will change the viewport
layer's size on the pending tree. Keeping it in LayerTreeHostImpl meant
that, until the pending tree was activated, the top controls layout height
corresponded to the viewport bounds in the pending tree. This was causing
flickering as the viewport container was the incorrect size for a short
time. The compositor also keeps track of the top controls content offset
value. The top controls offset uses the same model as page scale, keeping
an offset (the value as known by the main thread), a delta from the main
thread's value, and a sent_delta to keep track of what has been sent to
the main thread.

See https://codereview.chromium.org/513053003 for Blink-side patch.

BUG=333143

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

Cr-Commit-Position: refs/heads/master@{#294003}
28 files changed:
android_webview/browser/hardware_renderer.h
cc/input/top_controls_manager.cc
cc/input/top_controls_manager.h
cc/input/top_controls_manager_client.h
cc/input/top_controls_manager_unittest.cc
cc/test/fake_layer_tree_host_client.h
cc/test/layer_tree_test.cc
cc/test/layer_tree_test.h
cc/trees/layer_tree_host.cc
cc/trees/layer_tree_host.h
cc/trees/layer_tree_host_client.h
cc/trees/layer_tree_host_common.h
cc/trees/layer_tree_host_impl.cc
cc/trees/layer_tree_host_impl.h
cc/trees/layer_tree_host_impl_unittest.cc
cc/trees/layer_tree_host_unittest.cc
cc/trees/layer_tree_host_unittest_no_message_loop.cc
cc/trees/layer_tree_host_unittest_scroll.cc
cc/trees/layer_tree_impl.cc
cc/trees/layer_tree_impl.h
content/browser/renderer_host/compositor_impl_android.h
content/renderer/gpu/render_widget_compositor.cc
content/renderer/gpu/render_widget_compositor.h
content/test/web_layer_tree_view_impl_for_testing.cc
content/test/web_layer_tree_view_impl_for_testing.h
mojo/examples/compositor_app/compositor_host.cc
mojo/examples/compositor_app/compositor_host.h
ui/compositor/compositor.h