| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1618 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| 1619 CompositorFrameMetadata metadata; | 1619 CompositorFrameMetadata metadata; |
| 1620 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * | 1620 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * |
| 1621 active_tree_->device_scale_factor(); | 1621 active_tree_->device_scale_factor(); |
| 1622 | 1622 |
| 1623 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1623 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
| 1624 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1624 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
| 1625 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1625 metadata.root_layer_size = active_tree_->ScrollableSize(); |
| 1626 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1626 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
| 1627 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1627 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
| 1628 metadata.location_bar_offset = | 1628 metadata.top_controls_height = top_controls_manager_->TopControlsHeight(); |
| 1629 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); | 1629 metadata.top_controls_shown_ratio = |
| 1630 metadata.location_bar_content_translation = | 1630 top_controls_manager_->TopControlsShownRatio(); |
| 1631 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); | 1631 metadata.bottom_controls_height = |
| 1632 top_controls_manager_->BottomControlsHeight(); |
| 1633 metadata.bottom_controls_shown_ratio = |
| 1634 top_controls_manager_->BottomControlsShownRatio(); |
| 1632 metadata.root_background_color = active_tree_->background_color(); | 1635 metadata.root_background_color = active_tree_->background_color(); |
| 1633 | 1636 |
| 1634 active_tree_->GetViewportSelection(&metadata.selection); | 1637 active_tree_->GetViewportSelection(&metadata.selection); |
| 1635 | 1638 |
| 1636 if (OuterViewportScrollLayer()) { | 1639 if (OuterViewportScrollLayer()) { |
| 1637 metadata.root_overflow_x_hidden = | 1640 metadata.root_overflow_x_hidden = |
| 1638 !OuterViewportScrollLayer()->user_scrollable_horizontal(); | 1641 !OuterViewportScrollLayer()->user_scrollable_horizontal(); |
| 1639 metadata.root_overflow_y_hidden = | 1642 metadata.root_overflow_y_hidden = |
| 1640 !OuterViewportScrollLayer()->user_scrollable_vertical(); | 1643 !OuterViewportScrollLayer()->user_scrollable_vertical(); |
| 1641 } | 1644 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 return; | 1915 return; |
| 1913 | 1916 |
| 1914 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); | 1917 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); |
| 1915 | 1918 |
| 1916 float top_controls_layout_height = | 1919 float top_controls_layout_height = |
| 1917 active_tree_->top_controls_shrink_blink_size() | 1920 active_tree_->top_controls_shrink_blink_size() |
| 1918 ? active_tree_->top_controls_height() | 1921 ? active_tree_->top_controls_height() |
| 1919 : 0.f; | 1922 : 0.f; |
| 1920 float delta_from_top_controls = | 1923 float delta_from_top_controls = |
| 1921 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); | 1924 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); |
| 1925 float bottom_controls_layout_height = |
| 1926 active_tree_->top_controls_shrink_blink_size() |
| 1927 ? active_tree_->bottom_controls_height() |
| 1928 : 0.f; |
| 1929 delta_from_top_controls += bottom_controls_layout_height - |
| 1930 top_controls_manager_->ContentBottomOffset(); |
| 1922 | 1931 |
| 1923 // Adjust the viewport layers by shrinking/expanding the container to account | 1932 // Adjust the viewport layers by shrinking/expanding the container to account |
| 1924 // for changes in the size (e.g. top controls) since the last resize from | 1933 // for changes in the size (e.g. top controls) since the last resize from |
| 1925 // Blink. | 1934 // Blink. |
| 1926 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); | 1935 gfx::Vector2dF amount_to_expand(0.f, delta_from_top_controls); |
| 1927 inner_container->SetBoundsDelta(amount_to_expand); | 1936 inner_container->SetBoundsDelta(amount_to_expand); |
| 1928 | 1937 |
| 1929 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { | 1938 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { |
| 1930 // Adjust the outer viewport container as well, since adjusting only the | 1939 // Adjust the outer viewport container as well, since adjusting only the |
| 1931 // inner may cause its bounds to exceed those of the outer, causing scroll | 1940 // inner may cause its bounds to exceed those of the outer, causing scroll |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 SetNeedsRedraw(); | 2452 SetNeedsRedraw(); |
| 2444 SetNeedsOneBeginImplFrame(); | 2453 SetNeedsOneBeginImplFrame(); |
| 2445 active_tree_->set_needs_update_draw_properties(); | 2454 active_tree_->set_needs_update_draw_properties(); |
| 2446 SetFullRootLayerDamage(); | 2455 SetFullRootLayerDamage(); |
| 2447 } | 2456 } |
| 2448 | 2457 |
| 2449 float LayerTreeHostImpl::TopControlsHeight() const { | 2458 float LayerTreeHostImpl::TopControlsHeight() const { |
| 2450 return active_tree_->top_controls_height(); | 2459 return active_tree_->top_controls_height(); |
| 2451 } | 2460 } |
| 2452 | 2461 |
| 2462 float LayerTreeHostImpl::BottomControlsHeight() const { |
| 2463 return active_tree_->bottom_controls_height(); |
| 2464 } |
| 2465 |
| 2453 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { | 2466 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { |
| 2454 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) | 2467 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) |
| 2455 DidChangeTopControlsPosition(); | 2468 DidChangeTopControlsPosition(); |
| 2456 } | 2469 } |
| 2457 | 2470 |
| 2458 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { | 2471 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { |
| 2459 return active_tree_->CurrentTopControlsShownRatio(); | 2472 return active_tree_->CurrentTopControlsShownRatio(); |
| 2460 } | 2473 } |
| 2461 | 2474 |
| 2462 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { | 2475 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4066 return task_runner_provider_->HasImplThread(); | 4079 return task_runner_provider_->HasImplThread(); |
| 4067 } | 4080 } |
| 4068 | 4081 |
| 4069 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4082 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4070 // In single threaded mode we skip the pending tree and commit directly to the | 4083 // In single threaded mode we skip the pending tree and commit directly to the |
| 4071 // active tree. | 4084 // active tree. |
| 4072 return !task_runner_provider_->HasImplThread(); | 4085 return !task_runner_provider_->HasImplThread(); |
| 4073 } | 4086 } |
| 4074 | 4087 |
| 4075 } // namespace cc | 4088 } // namespace cc |
| OLD | NEW |