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

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: vector->float in IPC 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
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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { 1561 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
1562 CompositorFrameMetadata metadata; 1562 CompositorFrameMetadata metadata;
1563 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * 1563 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() *
1564 active_tree_->device_scale_factor(); 1564 active_tree_->device_scale_factor();
1565 1565
1566 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); 1566 metadata.page_scale_factor = active_tree_->current_page_scale_factor();
1567 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); 1567 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize();
1568 metadata.root_layer_size = active_tree_->ScrollableSize(); 1568 metadata.root_layer_size = active_tree_->ScrollableSize();
1569 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); 1569 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
1570 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); 1570 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
1571 metadata.location_bar_offset = 1571 metadata.top_controls_height = top_controls_manager_->TopControlsHeight();
1572 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); 1572 metadata.top_controls_shown_ratio =
1573 metadata.location_bar_content_translation = 1573 top_controls_manager_->TopControlsShownRatio();
1574 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); 1574 metadata.bottom_controls_height =
1575 top_controls_manager_->BottomControlsHeight();
1576 metadata.bottom_controls_shown_ratio =
1577 top_controls_manager_->BottomControlsShownRatio();
1575 metadata.root_background_color = active_tree_->background_color(); 1578 metadata.root_background_color = active_tree_->background_color();
1576 1579
1577 active_tree_->GetViewportSelection(&metadata.selection); 1580 active_tree_->GetViewportSelection(&metadata.selection);
1578 1581
1579 if (OuterViewportScrollLayer()) { 1582 if (OuterViewportScrollLayer()) {
1580 metadata.root_overflow_x_hidden = 1583 metadata.root_overflow_x_hidden =
1581 !OuterViewportScrollLayer()->user_scrollable_horizontal(); 1584 !OuterViewportScrollLayer()->user_scrollable_horizontal();
1582 metadata.root_overflow_y_hidden = 1585 metadata.root_overflow_y_hidden =
1583 !OuterViewportScrollLayer()->user_scrollable_vertical(); 1586 !OuterViewportScrollLayer()->user_scrollable_vertical();
1584 } 1587 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 return; 1863 return;
1861 1864
1862 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); 1865 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer());
1863 1866
1864 float top_controls_layout_height = 1867 float top_controls_layout_height =
1865 active_tree_->top_controls_shrink_blink_size() 1868 active_tree_->top_controls_shrink_blink_size()
1866 ? active_tree_->top_controls_height() 1869 ? active_tree_->top_controls_height()
1867 : 0.f; 1870 : 0.f;
1868 float delta_from_top_controls = 1871 float delta_from_top_controls =
1869 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); 1872 top_controls_layout_height - top_controls_manager_->ContentTopOffset();
1873 float bottom_controls_layout_height =
1874 active_tree_->top_controls_shrink_blink_size()
1875 ? active_tree_->bottom_controls_height()
1876 : 0.f;
1877 delta_from_top_controls += bottom_controls_layout_height -
1878 top_controls_manager_->ContentBottomOffset();
1870 1879
1871 // Adjust the viewport layers by shrinking/expanding the container to account 1880 // Adjust the viewport layers by shrinking/expanding the container to account
1872 // for changes in the size (e.g. top controls) since the last resize from 1881 // for changes in the size (e.g. top controls) since the last resize from
1873 // Blink. 1882 // Blink.
1874 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); 1883 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls);
1875 inner_container->SetBoundsDelta(amount_to_expand); 1884 inner_container->SetBoundsDelta(amount_to_expand);
1876 1885
1877 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { 1886 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) {
1878 // Adjust the outer viewport container as well, since adjusting only the 1887 // Adjust the outer viewport container as well, since adjusting only the
1879 // inner may cause its bounds to exceed those of the outer, causing scroll 1888 // inner may cause its bounds to exceed those of the outer, causing scroll
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 SetNeedsRedraw(); 2399 SetNeedsRedraw();
2391 SetNeedsOneBeginImplFrame(); 2400 SetNeedsOneBeginImplFrame();
2392 active_tree_->set_needs_update_draw_properties(); 2401 active_tree_->set_needs_update_draw_properties();
2393 SetFullRootLayerDamage(); 2402 SetFullRootLayerDamage();
2394 } 2403 }
2395 2404
2396 float LayerTreeHostImpl::TopControlsHeight() const { 2405 float LayerTreeHostImpl::TopControlsHeight() const {
2397 return active_tree_->top_controls_height(); 2406 return active_tree_->top_controls_height();
2398 } 2407 }
2399 2408
2409 float LayerTreeHostImpl::BottomControlsHeight() const {
2410 return active_tree_->bottom_controls_height();
2411 }
2412
2400 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { 2413 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) {
2401 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) 2414 if (active_tree_->SetCurrentTopControlsShownRatio(ratio))
2402 DidChangeTopControlsPosition(); 2415 DidChangeTopControlsPosition();
2403 } 2416 }
2404 2417
2405 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { 2418 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const {
2406 return active_tree_->CurrentTopControlsShownRatio(); 2419 return active_tree_->CurrentTopControlsShownRatio();
2407 } 2420 }
2408 2421
2409 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { 2422 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) {
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
4012 return task_runner_provider_->HasImplThread(); 4025 return task_runner_provider_->HasImplThread();
4013 } 4026 }
4014 4027
4015 bool LayerTreeHostImpl::CommitToActiveTree() const { 4028 bool LayerTreeHostImpl::CommitToActiveTree() const {
4016 // In single threaded mode we skip the pending tree and commit directly to the 4029 // In single threaded mode we skip the pending tree and commit directly to the
4017 // active tree. 4030 // active tree.
4018 return !task_runner_provider_->HasImplThread(); 4031 return !task_runner_provider_->HasImplThread();
4019 } 4032 }
4020 4033
4021 } // namespace cc 4034 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698