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 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 2912 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
2913 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, | 2913 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, |
2914 VERTICAL, 10, 0, false, true); | 2914 VERTICAL, 10, 0, false, true); |
2915 scrollbar->test_properties()->opacity = 0.f; | 2915 scrollbar->test_properties()->opacity = 0.f; |
2916 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity); | 2916 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity); |
2917 | 2917 |
2918 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer(); | 2918 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer(); |
2919 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer(); | 2919 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer(); |
2920 scrollbar->SetScrollElementId(scroll->element_id()); | 2920 scrollbar->SetScrollElementId(scroll->element_id()); |
2921 root->test_properties()->AddChild(std::move(scrollbar)); | 2921 root->test_properties()->AddChild(std::move(scrollbar)); |
| 2922 scroll->set_needs_show_scrollbars(true); |
2922 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 2923 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
2923 host_impl_->active_tree()->DidBecomeActive(); | 2924 host_impl_->active_tree()->DidBecomeActive(); |
2924 host_impl_->active_tree()->HandleScrollbarShowRequestsFromMain(); | 2925 host_impl_->active_tree()->HandleScrollbarShowRequestsFromMain(); |
2925 DrawFrame(); | 2926 DrawFrame(); |
2926 | 2927 |
2927 // SetScrollElementId will initialize the scrollbar which will cause it to | 2928 // SetScrollElementId will initialize the scrollbar which will cause it to |
2928 // show and request a redraw. | 2929 // show and request a redraw. |
2929 did_request_redraw_ = false; | 2930 did_request_redraw_ = false; |
2930 } | 2931 } |
2931 | 2932 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 VERTICAL, 10, 0, false, true); | 3216 VERTICAL, 10, 0, false, true); |
3216 scrollbar->test_properties()->opacity = 0.f; | 3217 scrollbar->test_properties()->opacity = 0.f; |
3217 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); | 3218 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); |
3218 LayerImpl* container = | 3219 LayerImpl* container = |
3219 host_impl_->pending_tree()->InnerViewportContainerLayer(); | 3220 host_impl_->pending_tree()->InnerViewportContainerLayer(); |
3220 scrollbar->SetScrollElementId(scroll->element_id()); | 3221 scrollbar->SetScrollElementId(scroll->element_id()); |
3221 scrollbar->SetBounds(gfx::Size(10, 100)); | 3222 scrollbar->SetBounds(gfx::Size(10, 100)); |
3222 scrollbar->SetPosition(gfx::PointF(90, 0)); | 3223 scrollbar->SetPosition(gfx::PointF(90, 0)); |
3223 container->test_properties()->AddChild(std::move(scrollbar)); | 3224 container->test_properties()->AddChild(std::move(scrollbar)); |
3224 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); | 3225 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); |
| 3226 scroll->set_needs_show_scrollbars(true); |
3225 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 3227 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
3226 host_impl_->ActivateSyncTree(); | 3228 host_impl_->ActivateSyncTree(); |
3227 | 3229 |
3228 ScrollbarAnimationController* scrollbar_controller = | 3230 ScrollbarAnimationController* scrollbar_controller = |
3229 host_impl_->ScrollbarAnimationControllerForElementId( | 3231 host_impl_->ScrollbarAnimationControllerForElementId( |
3230 scroll->element_id()); | 3232 scroll->element_id()); |
3231 | 3233 |
3232 // Scrollbars will flash shown but we should have a fade out animation | 3234 // Scrollbars will flash shown but we should have a fade out animation |
3233 // queued. Run it and fade out the scrollbars. | 3235 // queued. Run it and fade out the scrollbars. |
3234 { | 3236 { |
(...skipping 9128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12363 else | 12365 else |
12364 EXPECT_FALSE(tile->HasRasterTask()); | 12366 EXPECT_FALSE(tile->HasRasterTask()); |
12365 } | 12367 } |
12366 Region expected_invalidation( | 12368 Region expected_invalidation( |
12367 raster_source->GetRectForImage(checkerable_image->uniqueID())); | 12369 raster_source->GetRectForImage(checkerable_image->uniqueID())); |
12368 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); | 12370 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); |
12369 } | 12371 } |
12370 | 12372 |
12371 } // namespace | 12373 } // namespace |
12372 } // namespace cc | 12374 } // namespace cc |
OLD | NEW |