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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/animation/scrollbar_animation_controller.h" | 6 #include "cc/animation/scrollbar_animation_controller.h" |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/layers/painted_scrollbar_layer.h" | 8 #include "cc/layers/painted_scrollbar_layer.h" |
9 #include "cc/layers/painted_scrollbar_layer_impl.h" | 9 #include "cc/layers/painted_scrollbar_layer_impl.h" |
10 #include "cc/layers/scrollbar_layer_interface.h" | 10 #include "cc/layers/scrollbar_layer_interface.h" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 EXPECT_RECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), | 446 EXPECT_RECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), |
447 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); | 447 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); |
448 EXPECT_RECT_EQ(gfx::Rect(0.f, 22, 3.f, 22.f), | 448 EXPECT_RECT_EQ(gfx::Rect(0.f, 22, 3.f, 22.f), |
449 vertical_scrollbar_layer_->ComputeThumbQuadRect()); | 449 vertical_scrollbar_layer_->ComputeThumbQuadRect()); |
450 } | 450 } |
451 | 451 |
452 class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { | 452 class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { |
453 public: | 453 public: |
454 ScrollbarLayerTestMaxTextureSize() {} | 454 ScrollbarLayerTestMaxTextureSize() {} |
455 | 455 |
456 void SetScrollbarBounds(gfx::Size bounds) { bounds_ = bounds; } | 456 void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; } |
457 | 457 |
458 virtual void BeginTest() OVERRIDE { | 458 virtual void BeginTest() OVERRIDE { |
459 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); | 459 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
460 scrollbar_layer_ = PaintedScrollbarLayer::Create(scrollbar.Pass(), 1); | 460 scrollbar_layer_ = PaintedScrollbarLayer::Create(scrollbar.Pass(), 1); |
461 scrollbar_layer_->SetLayerTreeHost(layer_tree_host()); | 461 scrollbar_layer_->SetLayerTreeHost(layer_tree_host()); |
462 scrollbar_layer_->SetBounds(bounds_); | 462 scrollbar_layer_->SetBounds(bounds_); |
463 layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); | 463 layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); |
464 | 464 |
465 scroll_layer_ = Layer::Create(); | 465 scroll_layer_ = Layer::Create(); |
466 scrollbar_layer_->SetScrollLayerId(scroll_layer_->id()); | 466 scrollbar_layer_->SetScrollLayerId(scroll_layer_->id()); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { | 727 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { |
728 // Pick a test scale that moves the scrollbar's (non-zero) position to | 728 // Pick a test scale that moves the scrollbar's (non-zero) position to |
729 // a non-pixel-aligned location. | 729 // a non-pixel-aligned location. |
730 TestResourceUpload(.041f); | 730 TestResourceUpload(.041f); |
731 TestResourceUpload(1.41f); | 731 TestResourceUpload(1.41f); |
732 TestResourceUpload(4.1f); | 732 TestResourceUpload(4.1f); |
733 } | 733 } |
734 | 734 |
735 } // namespace | 735 } // namespace |
736 } // namespace cc | 736 } // namespace cc |
OLD | NEW |