Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2106753004: Introduce bottom controls to CC and let it respond to scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: findbug Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { 1616 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
1617 CompositorFrameMetadata metadata; 1617 CompositorFrameMetadata metadata;
1618 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * 1618 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() *
1619 active_tree_->device_scale_factor(); 1619 active_tree_->device_scale_factor();
1620 1620
1621 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); 1621 metadata.page_scale_factor = active_tree_->current_page_scale_factor();
1622 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); 1622 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize();
1623 metadata.root_layer_size = active_tree_->ScrollableSize(); 1623 metadata.root_layer_size = active_tree_->ScrollableSize();
1624 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); 1624 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
1625 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); 1625 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
1626 metadata.location_bar_offset = 1626 metadata.top_controls_height = top_controls_manager_->TopControlsHeight();
1627 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); 1627 metadata.top_controls_shown_ratio =
1628 metadata.location_bar_content_translation = 1628 top_controls_manager_->TopControlsShownRatio();
1629 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); 1629 metadata.bottom_controls_height =
1630 top_controls_manager_->BottomControlsHeight();
1631 metadata.bottom_controls_shown_ratio =
1632 top_controls_manager_->BottomControlsShownRatio();
1630 metadata.root_background_color = active_tree_->background_color(); 1633 metadata.root_background_color = active_tree_->background_color();
1631 1634
1632 active_tree_->GetViewportSelection(&metadata.selection); 1635 active_tree_->GetViewportSelection(&metadata.selection);
1633 1636
1634 if (OuterViewportScrollLayer()) { 1637 if (OuterViewportScrollLayer()) {
1635 metadata.root_overflow_x_hidden = 1638 metadata.root_overflow_x_hidden =
1636 !OuterViewportScrollLayer()->user_scrollable_horizontal(); 1639 !OuterViewportScrollLayer()->user_scrollable_horizontal();
1637 metadata.root_overflow_y_hidden = 1640 metadata.root_overflow_y_hidden =
1638 !OuterViewportScrollLayer()->user_scrollable_vertical(); 1641 !OuterViewportScrollLayer()->user_scrollable_vertical();
1639 } 1642 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 return; 1939 return;
1937 1940
1938 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); 1941 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer());
1939 1942
1940 float top_controls_layout_height = 1943 float top_controls_layout_height =
1941 active_tree_->top_controls_shrink_blink_size() 1944 active_tree_->top_controls_shrink_blink_size()
1942 ? active_tree_->top_controls_height() 1945 ? active_tree_->top_controls_height()
1943 : 0.f; 1946 : 0.f;
1944 float delta_from_top_controls = 1947 float delta_from_top_controls =
1945 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); 1948 top_controls_layout_height - top_controls_manager_->ContentTopOffset();
1949 float bottom_controls_layout_height =
1950 active_tree_->top_controls_shrink_blink_size()
1951 ? active_tree_->bottom_controls_height()
1952 : 0.f;
1953 delta_from_top_controls += bottom_controls_layout_height -
1954 top_controls_manager_->ContentBottomOffset();
1946 1955
1947 // Adjust the viewport layers by shrinking/expanding the container to account 1956 // Adjust the viewport layers by shrinking/expanding the container to account
1948 // for changes in the size (e.g. top controls) since the last resize from 1957 // for changes in the size (e.g. top controls) since the last resize from
1949 // Blink. 1958 // Blink.
1950 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); 1959 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls);
1951 inner_container->SetBoundsDelta(amount_to_expand); 1960 inner_container->SetBoundsDelta(amount_to_expand);
1952 1961
1953 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { 1962 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) {
1954 // Adjust the outer viewport container as well, since adjusting only the 1963 // Adjust the outer viewport container as well, since adjusting only the
1955 // inner may cause its bounds to exceed those of the outer, causing scroll 1964 // inner may cause its bounds to exceed those of the outer, causing scroll
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 SetNeedsRedraw(); 2474 SetNeedsRedraw();
2466 SetNeedsOneBeginImplFrame(); 2475 SetNeedsOneBeginImplFrame();
2467 active_tree_->set_needs_update_draw_properties(); 2476 active_tree_->set_needs_update_draw_properties();
2468 SetFullViewportDamage(); 2477 SetFullViewportDamage();
2469 } 2478 }
2470 2479
2471 float LayerTreeHostImpl::TopControlsHeight() const { 2480 float LayerTreeHostImpl::TopControlsHeight() const {
2472 return active_tree_->top_controls_height(); 2481 return active_tree_->top_controls_height();
2473 } 2482 }
2474 2483
2484 float LayerTreeHostImpl::BottomControlsHeight() const {
2485 return active_tree_->bottom_controls_height();
2486 }
2487
2475 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { 2488 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) {
2476 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) 2489 if (active_tree_->SetCurrentTopControlsShownRatio(ratio))
2477 DidChangeTopControlsPosition(); 2490 DidChangeTopControlsPosition();
2478 } 2491 }
2479 2492
2480 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { 2493 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const {
2481 return active_tree_->CurrentTopControlsShownRatio(); 2494 return active_tree_->CurrentTopControlsShownRatio();
2482 } 2495 }
2483 2496
2484 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { 2497 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) {
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 return task_runner_provider_->HasImplThread(); 4101 return task_runner_provider_->HasImplThread();
4089 } 4102 }
4090 4103
4091 bool LayerTreeHostImpl::CommitToActiveTree() const { 4104 bool LayerTreeHostImpl::CommitToActiveTree() const {
4092 // In single threaded mode we skip the pending tree and commit directly to the 4105 // In single threaded mode we skip the pending tree and commit directly to the
4093 // active tree. 4106 // active tree.
4094 return !task_runner_provider_->HasImplThread(); 4107 return !task_runner_provider_->HasImplThread();
4095 } 4108 }
4096 4109
4097 } // namespace cc 4110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698