| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <unordered_map> | 7 #include <unordered_map> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); | 378 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); |
| 379 scrollbar_layer->SetBounds(gfx::Size(70, 10)); | 379 scrollbar_layer->SetBounds(gfx::Size(70, 10)); |
| 380 scrollbar_layer->SetScrollElementId(root_layer->element_id()); | 380 scrollbar_layer->SetScrollElementId(root_layer->element_id()); |
| 381 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); | 381 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); |
| 382 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); | 382 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); |
| 383 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); | 383 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); |
| 384 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); | 384 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); |
| 385 LayerImpl* root_clip_layer_impl = nullptr; | 385 LayerImpl* root_clip_layer_impl = nullptr; |
| 386 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; | 386 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; |
| 387 | 387 |
| 388 layer_tree_host_->BuildPropertyTreesForTesting(); |
| 388 UPDATE_AND_EXTRACT_LAYER_POINTERS(); | 389 UPDATE_AND_EXTRACT_LAYER_POINTERS(); |
| 389 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), | 390 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), |
| 390 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); | 391 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); |
| 391 | 392 |
| 392 scrollbar_layer->fake_scrollbar()->set_has_thumb(false); | 393 scrollbar_layer->fake_scrollbar()->set_has_thumb(false); |
| 393 | 394 |
| 394 UPDATE_AND_EXTRACT_LAYER_POINTERS(); | 395 UPDATE_AND_EXTRACT_LAYER_POINTERS(); |
| 395 EXPECT_EQ(gfx::Rect(10, 0, 0, 0).ToString(), | 396 EXPECT_EQ(gfx::Rect(10, 0, 0, 0).ToString(), |
| 396 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); | 397 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); |
| 397 } | 398 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 scrollbar->Orientation(), kThumbThickness, kTrackStart, | 738 scrollbar->Orientation(), kThumbThickness, kTrackStart, |
| 738 kIsLeftSideVerticalScrollbar, scroll_layer->element_id()); | 739 kIsLeftSideVerticalScrollbar, scroll_layer->element_id()); |
| 739 scroll_layer->AddChild(child1); | 740 scroll_layer->AddChild(child1); |
| 740 scroll_layer->InsertChild(scrollbar_layer, 1); | 741 scroll_layer->InsertChild(scrollbar_layer, 1); |
| 741 layer_tree_root->AddChild(scroll_layer); | 742 layer_tree_root->AddChild(scroll_layer); |
| 742 layer_tree_host_->SetRootLayer(layer_tree_root); | 743 layer_tree_host_->SetRootLayer(layer_tree_root); |
| 743 | 744 |
| 744 layer_tree_root->SetBounds(gfx::Size(2, 2)); | 745 layer_tree_root->SetBounds(gfx::Size(2, 2)); |
| 745 scroll_layer->SetBounds(gfx::Size(10, 10)); | 746 scroll_layer->SetBounds(gfx::Size(10, 10)); |
| 746 layer_tree_host_->UpdateLayers(); | 747 layer_tree_host_->UpdateLayers(); |
| 747 layer_tree_host_->CommitAndCreateLayerImplTree(); | |
| 748 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl(); | 748 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl(); |
| 749 host_impl->CreatePendingTree(); |
| 750 layer_tree_host_->CommitAndCreatePendingTree(); |
| 751 host_impl->ActivateSyncTree(); |
| 749 EXPECT_TRUE(host_impl->ScrollbarAnimationControllerForElementId( | 752 EXPECT_TRUE(host_impl->ScrollbarAnimationControllerForElementId( |
| 750 scroll_layer->element_id())); | 753 scroll_layer->element_id())); |
| 751 | 754 |
| 752 scroll_layer->SetBounds(gfx::Size(20, 20)); | 755 scroll_layer->SetBounds(gfx::Size(20, 20)); |
| 753 scroll_layer->SetForceRenderSurfaceForTesting(true); | 756 scroll_layer->SetForceRenderSurfaceForTesting(true); |
| 754 layer_tree_host_->UpdateLayers(); | 757 layer_tree_host_->UpdateLayers(); |
| 755 host_impl->CreatePendingTree(); | 758 host_impl->CreatePendingTree(); |
| 756 layer_tree_host_->CommitAndCreatePendingTree(); | 759 layer_tree_host_->CommitAndCreatePendingTree(); |
| 757 host_impl->ActivateSyncTree(); | 760 host_impl->ActivateSyncTree(); |
| 758 EffectNode* node = | 761 EffectNode* node = |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1279 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 1277 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1280 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 1278 | 1281 |
| 1279 // Horizontal Scrollbars. | 1282 // Horizontal Scrollbars. |
| 1280 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1283 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 1281 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1284 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 1282 } | 1285 } |
| 1283 | 1286 |
| 1284 } // namespace | 1287 } // namespace |
| 1285 } // namespace cc | 1288 } // namespace cc |
| OLD | NEW |