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 "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
7 #include "cc/animation/scrollbar_animation_controller.h" | 7 #include "cc/animation/scrollbar_animation_controller.h" |
8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
9 #include "cc/layers/painted_scrollbar_layer.h" | 9 #include "cc/layers/painted_scrollbar_layer.h" |
10 #include "cc/layers/painted_scrollbar_layer_impl.h" | 10 #include "cc/layers/painted_scrollbar_layer_impl.h" |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 SolidColorScrollbarLayerImpl* layers[2] = | 593 SolidColorScrollbarLayerImpl* layers[2] = |
594 { horizontal_scrollbar_layer_.get(), vertical_scrollbar_layer_.get() }; | 594 { horizontal_scrollbar_layer_.get(), vertical_scrollbar_layer_.get() }; |
595 for (size_t i = 0; i < 2; ++i) { | 595 for (size_t i = 0; i < 2; ++i) { |
596 layers[i]->SetVisibleToTotalLengthRatio(0.2f); | 596 layers[i]->SetVisibleToTotalLengthRatio(0.2f); |
597 layers[i]->SetCurrentPos(25); | 597 layers[i]->SetCurrentPos(25); |
598 layers[i]->SetMaximum(100); | 598 layers[i]->SetMaximum(100); |
599 } | 599 } |
600 layers[0]->SetBounds(gfx::Size(100, 3)); | 600 layers[0]->SetBounds(gfx::Size(100, 3)); |
601 layers[1]->SetBounds(gfx::Size(3, 100)); | 601 layers[1]->SetBounds(gfx::Size(3, 100)); |
602 | 602 |
603 EXPECT_EQ(gfx::RectF(20.f, 0.f, 20.f, 3.f), | 603 EXPECT_EQ(gfx::Rect(20, 0, 20, 3), |
604 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); | 604 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); |
605 EXPECT_EQ(gfx::RectF(0.f, 20.f, 3.f, 20.f), | 605 EXPECT_EQ(gfx::Rect(0, 20, 3, 20), |
606 vertical_scrollbar_layer_->ComputeThumbQuadRect()); | 606 vertical_scrollbar_layer_->ComputeThumbQuadRect()); |
607 | 607 |
608 horizontal_scrollbar_layer_->SetVerticalAdjust(10.f); | 608 horizontal_scrollbar_layer_->SetVerticalAdjust(10.f); |
609 vertical_scrollbar_layer_->SetVerticalAdjust(10.f); | 609 vertical_scrollbar_layer_->SetVerticalAdjust(10.f); |
610 | 610 |
611 // The vertical adjustment factor has two effects: | 611 // The vertical adjustment factor has two effects: |
612 // 1.) Moves the horizontal scrollbar down | 612 // 1.) Moves the horizontal scrollbar down |
613 // 2.) Increases the vertical scrollbar's effective track length which both | 613 // 2.) Increases the vertical scrollbar's effective track length which both |
614 // increases the thumb's length and its position within the track. | 614 // increases the thumb's length and its position within the track. |
615 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), | 615 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1017 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1018 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1018 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1019 | 1019 |
1020 // Horizontal Scrollbars. | 1020 // Horizontal Scrollbars. |
1021 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1021 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1022 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1022 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1023 } | 1023 } |
1024 | 1024 |
1025 } // namespace | 1025 } // namespace |
1026 } // namespace cc | 1026 } // namespace cc |
OLD | NEW |