| 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/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "cc/input/scrollbar_animation_controller.h" | 10 #include "cc/input/scrollbar_animation_controller.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); | 520 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); |
| 521 scroll_layer->AddChild(child1); | 521 scroll_layer->AddChild(child1); |
| 522 scroll_layer->InsertChild(scrollbar_layer, 1); | 522 scroll_layer->InsertChild(scrollbar_layer, 1); |
| 523 layer_tree_root->AddChild(scroll_layer); | 523 layer_tree_root->AddChild(scroll_layer); |
| 524 layer_tree_host_->SetRootLayer(layer_tree_root); | 524 layer_tree_host_->SetRootLayer(layer_tree_root); |
| 525 | 525 |
| 526 // Choose layer bounds to give max_scroll_offset = (8, 8). | 526 // Choose layer bounds to give max_scroll_offset = (8, 8). |
| 527 layer_tree_root->SetBounds(gfx::Size(2, 2)); | 527 layer_tree_root->SetBounds(gfx::Size(2, 2)); |
| 528 scroll_layer->SetBounds(gfx::Size(10, 10)); | 528 scroll_layer->SetBounds(gfx::Size(10, 10)); |
| 529 | 529 |
| 530 // Building property trees twice shouldn't change the size of |
| 531 // PropertyTrees::always_use_active_tree_opacity_effect_ids. |
| 532 layer_tree_host_->BuildPropertyTreesForTesting(); |
| 533 EXPECT_EQ(layer_tree_host_->property_trees() |
| 534 ->always_use_active_tree_opacity_effect_ids.size(), |
| 535 1u); |
| 536 layer_tree_host_->property_trees()->needs_rebuild = true; |
| 537 layer_tree_host_->BuildPropertyTreesForTesting(); |
| 538 EXPECT_EQ(layer_tree_host_->property_trees() |
| 539 ->always_use_active_tree_opacity_effect_ids.size(), |
| 540 1u); |
| 541 |
| 530 // A solid color scrollbar layer's opacity is initialized to 0 on main thread | 542 // A solid color scrollbar layer's opacity is initialized to 0 on main thread |
| 531 layer_tree_host_->UpdateLayers(); | 543 layer_tree_host_->UpdateLayers(); |
| 532 EffectNode* node = layer_tree_host_->property_trees()->effect_tree.Node( | 544 EffectNode* node = layer_tree_host_->property_trees()->effect_tree.Node( |
| 533 scrollbar_layer->effect_tree_index()); | 545 scrollbar_layer->effect_tree_index()); |
| 534 EXPECT_EQ(node->data.opacity, 0.f); | 546 EXPECT_EQ(node->data.opacity, 0.f); |
| 535 | 547 |
| 536 // This tests that the initial opacity(0) of the scrollbar gets pushed onto | 548 // This tests that the initial opacity(0) of the scrollbar gets pushed onto |
| 537 // the pending tree and then onto the active tree. | 549 // the pending tree and then onto the active tree. |
| 538 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl(); | 550 LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl(); |
| 539 host_impl->CreatePendingTree(); | 551 host_impl->CreatePendingTree(); |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1146 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 1135 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1147 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 1136 | 1148 |
| 1137 // Horizontal Scrollbars. | 1149 // Horizontal Scrollbars. |
| 1138 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1150 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 1139 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1151 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 1140 } | 1152 } |
| 1141 | 1153 |
| 1142 } // namespace | 1154 } // namespace |
| 1143 } // namespace cc | 1155 } // namespace cc |
| OLD | NEW |