| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index 30de9244e1f9f394e5109c14b6bb4f78b37dfbd6..639a243477348d9fabf54fdf208ad6d8660014c5 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -35,12 +35,12 @@
|
| #include "cc/debug/frame_viewer_instrumentation.h"
|
| #include "cc/debug/rendering_stats_instrumentation.h"
|
| #include "cc/debug/traced_value.h"
|
| +#include "cc/input/browser_controls_offset_manager.h"
|
| #include "cc/input/main_thread_scrolling_reason.h"
|
| #include "cc/input/page_scale_animation.h"
|
| #include "cc/input/scroll_elasticity_helper.h"
|
| #include "cc/input/scroll_state.h"
|
| #include "cc/input/scrollbar_animation_controller.h"
|
| -#include "cc/input/top_controls_manager.h"
|
| #include "cc/layers/append_quads_data.h"
|
| #include "cc/layers/heads_up_display_layer_impl.h"
|
| #include "cc/layers/layer_impl.h"
|
| @@ -262,9 +262,9 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
|
| "cc::LayerTreeHostImpl", id_);
|
|
|
| - top_controls_manager_ =
|
| - TopControlsManager::Create(this, settings.top_controls_show_threshold,
|
| - settings.top_controls_hide_threshold);
|
| + browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create(
|
| + this, settings.top_controls_show_threshold,
|
| + settings.top_controls_hide_threshold);
|
| }
|
|
|
| LayerTreeHostImpl::~LayerTreeHostImpl() {
|
| @@ -1035,7 +1035,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
|
| }
|
|
|
| void LayerTreeHostImpl::MainThreadHasStoppedFlinging() {
|
| - top_controls_manager_->MainThreadHasStoppedFlinging();
|
| + browser_controls_offset_manager_->MainThreadHasStoppedFlinging();
|
| if (input_handler_client_)
|
| input_handler_client_->MainThreadHasStoppedFlinging();
|
| }
|
| @@ -1542,13 +1542,14 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
|
| metadata.root_layer_size = active_tree_->ScrollableSize();
|
| metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
|
| metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
|
| - metadata.top_controls_height = top_controls_manager_->TopControlsHeight();
|
| + metadata.top_controls_height =
|
| + browser_controls_offset_manager_->TopControlsHeight();
|
| metadata.top_controls_shown_ratio =
|
| - top_controls_manager_->TopControlsShownRatio();
|
| + browser_controls_offset_manager_->TopControlsShownRatio();
|
| metadata.bottom_controls_height =
|
| - top_controls_manager_->BottomControlsHeight();
|
| + browser_controls_offset_manager_->BottomControlsHeight();
|
| metadata.bottom_controls_shown_ratio =
|
| - top_controls_manager_->BottomControlsShownRatio();
|
| + browser_controls_offset_manager_->BottomControlsShownRatio();
|
| metadata.root_background_color = active_tree_->background_color();
|
|
|
| active_tree_->GetViewportSelection(&metadata.selection);
|
| @@ -1865,13 +1866,15 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() {
|
| ? active_tree_->top_controls_height()
|
| : 0.f;
|
| float delta_from_top_controls =
|
| - top_controls_layout_height - top_controls_manager_->ContentTopOffset();
|
| + top_controls_layout_height -
|
| + browser_controls_offset_manager_->ContentTopOffset();
|
| float bottom_controls_layout_height =
|
| active_tree_->top_controls_shrink_blink_size()
|
| ? active_tree_->bottom_controls_height()
|
| : 0.f;
|
| - delta_from_top_controls += bottom_controls_layout_height -
|
| - top_controls_manager_->ContentBottomOffset();
|
| + delta_from_top_controls +=
|
| + bottom_controls_layout_height -
|
| + browser_controls_offset_manager_->ContentBottomOffset();
|
|
|
| // Adjust the viewport layers by shrinking/expanding the container to account
|
| // for changes in the size (e.g. top controls) since the last resize from
|
| @@ -2613,7 +2616,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
|
| scroll_status.thread = SCROLL_ON_IMPL_THREAD;
|
| ScrollAnimationAbort(scrolling_layer_impl);
|
|
|
| - top_controls_manager_->ScrollBegin();
|
| + browser_controls_offset_manager_->ScrollBegin();
|
|
|
| active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
|
| // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation
|
| @@ -3083,7 +3086,7 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
|
| return InputHandlerScrollResult();
|
|
|
| float initial_top_controls_offset =
|
| - top_controls_manager_->ControlsTopOffset();
|
| + browser_controls_offset_manager_->ControlsTopOffset();
|
|
|
| scroll_state->set_delta_consumed_for_scroll_sequence(
|
| did_lock_scrolling_layer_);
|
| @@ -3131,7 +3134,8 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
|
| accumulated_root_overscroll_ += unused_root_delta;
|
|
|
| bool did_scroll_top_controls =
|
| - initial_top_controls_offset != top_controls_manager_->ControlsTopOffset();
|
| + initial_top_controls_offset !=
|
| + browser_controls_offset_manager_->ControlsTopOffset();
|
|
|
| InputHandlerScrollResult scroll_result;
|
| scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls;
|
| @@ -3181,7 +3185,7 @@ void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
|
| DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
|
|
|
| DistributeScrollDelta(scroll_state);
|
| - top_controls_manager_->ScrollEnd();
|
| + browser_controls_offset_manager_->ScrollEnd();
|
|
|
| if (scroll_state->is_in_inertial_phase()) {
|
| // Only clear the currently scrolling layer if we know the scroll is done.
|
| @@ -3314,7 +3318,7 @@ void LayerTreeHostImpl::PinchGestureBegin() {
|
| client_->RenewTreePriority();
|
| pinch_gesture_end_should_clear_scrolling_layer_ = !CurrentlyScrollingLayer();
|
| active_tree_->SetCurrentlyScrollingLayer(viewport()->MainScrollLayer());
|
| - top_controls_manager_->PinchBegin();
|
| + browser_controls_offset_manager_->PinchBegin();
|
| }
|
|
|
| void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta,
|
| @@ -3338,7 +3342,7 @@ void LayerTreeHostImpl::PinchGestureEnd() {
|
| ClearCurrentlyScrollingLayer();
|
| }
|
| viewport()->PinchEnd();
|
| - top_controls_manager_->PinchEnd();
|
| + browser_controls_offset_manager_->PinchEnd();
|
| client_->SetNeedsCommitOnImplThread();
|
| // When a pinch ends, we may be displaying content cached at incorrect scales,
|
| // so updating draw properties and drawing will ensure we are using the right
|
| @@ -3420,12 +3424,12 @@ bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
|
| }
|
|
|
| bool LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
|
| - if (!top_controls_manager_->has_animation())
|
| + if (!browser_controls_offset_manager_->has_animation())
|
| return false;
|
|
|
| - gfx::Vector2dF scroll = top_controls_manager_->Animate(time);
|
| + gfx::Vector2dF scroll = browser_controls_offset_manager_->Animate(time);
|
|
|
| - if (top_controls_manager_->has_animation())
|
| + if (browser_controls_offset_manager_->has_animation())
|
| SetNeedsOneBeginImplFrame();
|
|
|
| if (active_tree_->TotalScrollOffset().y() == 0.f)
|
|
|