| 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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1576 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
| 1577 CompositorFrameMetadata metadata; | 1577 CompositorFrameMetadata metadata; |
| 1578 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * | 1578 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * |
| 1579 active_tree_->device_scale_factor(); | 1579 active_tree_->device_scale_factor(); |
| 1580 | 1580 |
| 1581 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1581 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
| 1582 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1582 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
| 1583 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1583 metadata.root_layer_size = active_tree_->ScrollableSize(); |
| 1584 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1584 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
| 1585 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1585 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
| 1586 metadata.location_bar_offset = | 1586 metadata.top_controls_height = |
| 1587 gfx::Vector2dF(0.f, top_controls_manager_->ControlsTopOffset()); | 1587 gfx::Vector2dF(0.f, top_controls_manager_->TopControlsHeight()); |
| 1588 metadata.location_bar_content_translation = | 1588 metadata.top_controls_shown_ratio = |
| 1589 gfx::Vector2dF(0.f, top_controls_manager_->ContentTopOffset()); | 1589 top_controls_manager_->TopControlsShownRatio(); |
| 1590 metadata.bottom_controls_height = |
| 1591 gfx::Vector2dF(0.f, top_controls_manager_->BottomControlsHeight()); |
| 1592 metadata.bottom_controls_shown_ratio = |
| 1593 top_controls_manager_->BottomControlsShownRatio(); |
| 1590 metadata.root_background_color = active_tree_->background_color(); | 1594 metadata.root_background_color = active_tree_->background_color(); |
| 1591 | 1595 |
| 1592 active_tree_->GetViewportSelection(&metadata.selection); | 1596 active_tree_->GetViewportSelection(&metadata.selection); |
| 1593 | 1597 |
| 1594 if (OuterViewportScrollLayer()) { | 1598 if (OuterViewportScrollLayer()) { |
| 1595 metadata.root_overflow_x_hidden = | 1599 metadata.root_overflow_x_hidden = |
| 1596 !OuterViewportScrollLayer()->user_scrollable_horizontal(); | 1600 !OuterViewportScrollLayer()->user_scrollable_horizontal(); |
| 1597 metadata.root_overflow_y_hidden = | 1601 metadata.root_overflow_y_hidden = |
| 1598 !OuterViewportScrollLayer()->user_scrollable_vertical(); | 1602 !OuterViewportScrollLayer()->user_scrollable_vertical(); |
| 1599 } | 1603 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 | 1892 |
| 1889 ViewportAnchor anchor(InnerViewportScrollLayer(), | 1893 ViewportAnchor anchor(InnerViewportScrollLayer(), |
| 1890 OuterViewportScrollLayer()); | 1894 OuterViewportScrollLayer()); |
| 1891 | 1895 |
| 1892 float top_controls_layout_height = | 1896 float top_controls_layout_height = |
| 1893 active_tree_->top_controls_shrink_blink_size() | 1897 active_tree_->top_controls_shrink_blink_size() |
| 1894 ? active_tree_->top_controls_height() | 1898 ? active_tree_->top_controls_height() |
| 1895 : 0.f; | 1899 : 0.f; |
| 1896 float delta_from_top_controls = | 1900 float delta_from_top_controls = |
| 1897 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); | 1901 top_controls_layout_height - top_controls_manager_->ContentTopOffset(); |
| 1902 float bottom_controls_layout_height = |
| 1903 active_tree_->top_controls_shrink_blink_size() |
| 1904 ? active_tree_->bottom_controls_height() |
| 1905 : 0.f; |
| 1906 delta_from_top_controls += bottom_controls_layout_height - |
| 1907 top_controls_manager_->ContentBottomOffset(); |
| 1898 | 1908 |
| 1899 // Adjust the viewport layers by shrinking/expanding the container to account | 1909 // Adjust the viewport layers by shrinking/expanding the container to account |
| 1900 // for changes in the size (e.g. top controls) since the last resize from | 1910 // for changes in the size (e.g. top controls) since the last resize from |
| 1901 // Blink. | 1911 // Blink. |
| 1902 gfx::Vector2dF amount_to_expand( | 1912 gfx::Vector2dF amount_to_expand( |
| 1903 0.f, | 1913 0.f, |
| 1904 delta_from_top_controls); | 1914 delta_from_top_controls); |
| 1905 inner_container->SetBoundsDelta(amount_to_expand); | 1915 inner_container->SetBoundsDelta(amount_to_expand); |
| 1906 | 1916 |
| 1907 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { | 1917 if (outer_container && !outer_container->BoundsForScrolling().IsEmpty()) { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 SetNeedsRedraw(); | 2452 SetNeedsRedraw(); |
| 2443 SetNeedsOneBeginImplFrame(); | 2453 SetNeedsOneBeginImplFrame(); |
| 2444 active_tree_->set_needs_update_draw_properties(); | 2454 active_tree_->set_needs_update_draw_properties(); |
| 2445 SetFullRootLayerDamage(); | 2455 SetFullRootLayerDamage(); |
| 2446 } | 2456 } |
| 2447 | 2457 |
| 2448 float LayerTreeHostImpl::TopControlsHeight() const { | 2458 float LayerTreeHostImpl::TopControlsHeight() const { |
| 2449 return active_tree_->top_controls_height(); | 2459 return active_tree_->top_controls_height(); |
| 2450 } | 2460 } |
| 2451 | 2461 |
| 2462 float LayerTreeHostImpl::BottomControlsHeight() const { |
| 2463 return active_tree_->bottom_controls_height(); |
| 2464 } |
| 2465 |
| 2452 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { | 2466 void LayerTreeHostImpl::SetCurrentTopControlsShownRatio(float ratio) { |
| 2453 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) | 2467 if (active_tree_->SetCurrentTopControlsShownRatio(ratio)) |
| 2454 DidChangeTopControlsPosition(); | 2468 DidChangeTopControlsPosition(); |
| 2455 } | 2469 } |
| 2456 | 2470 |
| 2457 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { | 2471 float LayerTreeHostImpl::CurrentTopControlsShownRatio() const { |
| 2458 return active_tree_->CurrentTopControlsShownRatio(); | 2472 return active_tree_->CurrentTopControlsShownRatio(); |
| 2459 } | 2473 } |
| 2460 | 2474 |
| 2461 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { | 2475 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 return task_runner_provider_->HasImplThread(); | 4053 return task_runner_provider_->HasImplThread(); |
| 4040 } | 4054 } |
| 4041 | 4055 |
| 4042 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4056 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4043 // In single threaded mode we skip the pending tree and commit directly to the | 4057 // In single threaded mode we skip the pending tree and commit directly to the |
| 4044 // active tree. | 4058 // active tree. |
| 4045 return !task_runner_provider_->HasImplThread(); | 4059 return !task_runner_provider_->HasImplThread(); |
| 4046 } | 4060 } |
| 4047 | 4061 |
| 4048 } // namespace cc | 4062 } // namespace cc |
| OLD | NEW |