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