OLD | NEW |
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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1575 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
1576 CompositorFrameMetadata metadata; | 1576 CompositorFrameMetadata metadata; |
1577 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * | 1577 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * |
1578 active_tree_->device_scale_factor(); | 1578 active_tree_->device_scale_factor(); |
1579 | 1579 |
1580 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1580 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
1581 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1581 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
1582 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1582 metadata.root_layer_size = active_tree_->ScrollableSize(); |
1583 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1583 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
1584 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1584 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
1585 metadata.location_bar_offset = | 1585 metadata.top_bar_translate = |
1586 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); | 1586 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); |
1587 metadata.location_bar_content_translation = | 1587 metadata.top_bar_shown = |
1588 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); | 1588 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); |
| 1589 metadata.bottom_bar_translate = |
| 1590 gfx::Vector2dF(0.f, top_controls_manager_->ControlsBottomOffset()); |
| 1591 metadata.bottom_bar_shown = |
| 1592 gfx::Vector2dF(0.f, top_controls_manager_->ContentBottomOffset()); |
1589 metadata.root_background_color = active_tree_->background_color(); | 1593 metadata.root_background_color = active_tree_->background_color(); |
1590 | 1594 |
1591 active_tree_->GetViewportSelection(&metadata.selection); | 1595 active_tree_->GetViewportSelection(&metadata.selection); |
1592 | 1596 |
1593 if (OuterViewportScrollLayer()) { | 1597 if (OuterViewportScrollLayer()) { |
1594 metadata.root_overflow_x_hidden = | 1598 metadata.root_overflow_x_hidden = |
1595 !OuterViewportScrollLayer()->user_scrollable_horizontal(); | 1599 !OuterViewportScrollLayer()->user_scrollable_horizontal(); |
1596 metadata.root_overflow_y_hidden = | 1600 metadata.root_overflow_y_hidden = |
1597 !OuterViewportScrollLayer()->user_scrollable_vertical(); | 1601 !OuterViewportScrollLayer()->user_scrollable_vertical(); |
1598 } | 1602 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 | 1890 |
1887 ViewportAnchor anchor(InnerViewportScrollLayer(), | 1891 ViewportAnchor anchor(InnerViewportScrollLayer(), |
1888 OuterViewportScrollLayer()); | 1892 OuterViewportScrollLayer()); |
1889 | 1893 |
1890 float top_controls_layout_height = | 1894 float top_controls_layout_height = |
1891 active_tree_->top_controls_shrink_blink_size() | 1895 active_tree_->top_controls_shrink_blink_size() |
1892 ? active_tree_->top_controls_height() | 1896 ? active_tree_->top_controls_height() |
1893 : 0.f; | 1897 : 0.f; |
1894 float delta_from_top_controls = | 1898 float delta_from_top_controls = |
1895 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); | 1899 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); |
| 1900 float bottom_controls_layout_height = |
| 1901 active_tree_->top_controls_shrink_blink_size() |
| 1902 ? active_tree_->bottom_controls_height() |
| 1903 : 0.f; |
| 1904 delta_from_top_controls += bottom_controls_layout_height - |
| 1905 top_controls_manager_->ContentBottomOffset(); |
1896 | 1906 |
1897 // Adjust the viewport layers by shrinking/expanding the container to account | 1907 // Adjust the viewport layers by shrinking/expanding the container to account |
1898 // for changes in the size (e.g. top controls) since the last resize from | 1908 // for changes in the size (e.g. top controls) since the last resize from |
1899 // Blink. | 1909 // Blink. |
1900 gfx::Vector2dF amount_to_expand( | 1910 gfx::Vector2dF amount_to_expand( |
1901 0.f, | 1911 0.f, |
1902 delta_from_top_controls); | 1912 delta_from_top_controls); |
1903 inner_container->SetBoundsDelta(amount_to_expand); | 1913 inner_container->SetBoundsDelta(amount_to_expand); |
1904 | 1914 |
1905 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { | 1915 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 SetNeedsRedraw(); | 2450 SetNeedsRedraw(); |
2441 SetNeedsOneBeginImplFrame(); | 2451 SetNeedsOneBeginImplFrame(); |
2442 active_tree_->set_needs_update_draw_properties(); | 2452 active_tree_->set_needs_update_draw_properties(); |
2443 SetFullRootLayerDamage(); | 2453 SetFullRootLayerDamage(); |
2444 } | 2454 } |
2445 | 2455 |
2446 float LayerTreeHostImpl::TopControlsHeight() const { | 2456 float LayerTreeHostImpl::TopControlsHeight() const { |
2447 return active_tree_->top_controls_height(); | 2457 return active_tree_->top_controls_height(); |
2448 } | 2458 } |
2449 | 2459 |
| 2460 float LayerTreeHostImpl::BottomControlsHeight() const { |
| 2461 return active_tree_->bottom_controls_height(); |
| 2462 } |
| 2463 |
2450 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { | 2464 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { |
2451 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) | 2465 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) |
2452 DidChangeTopControlsPosition(); | 2466 DidChangeTopControlsPosition(); |
2453 } | 2467 } |
2454 | 2468 |
2455 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { | 2469 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { |
2456 return active_tree_->CurrentTopControlsShownRatio(); | 2470 return active_tree_->CurrentTopControlsShownRatio(); |
2457 } | 2471 } |
2458 | 2472 |
2459 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { | 2473 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { |
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 return task_runner_provider_->HasImplThread(); | 4022 return task_runner_provider_->HasImplThread(); |
4009 } | 4023 } |
4010 | 4024 |
4011 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4025 bool LayerTreeHostImpl::CommitToActiveTree() const { |
4012 // In single threaded mode we skip the pending tree and commit directly to the | 4026 // In single threaded mode we skip the pending tree and commit directly to the |
4013 // active tree. | 4027 // active tree. |
4014 return !task_runner_provider_->HasImplThread(); | 4028 return !task_runner_provider_->HasImplThread(); |
4015 } | 4029 } |
4016 | 4030 |
4017 } // namespace cc | 4031 } // namespace cc |
OLD | NEW |