| 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 SolidColorScrollbarLayerImpl* layers[2] = | 592 SolidColorScrollbarLayerImpl* layers[2] = |
| 593 { horizontal_scrollbar_layer_.get(), vertical_scrollbar_layer_.get() }; | 593 { horizontal_scrollbar_layer_.get(), vertical_scrollbar_layer_.get() }; |
| 594 for (size_t i = 0; i < 2; ++i) { | 594 for (size_t i = 0; i < 2; ++i) { |
| 595 layers[i]->SetVisibleToTotalLengthRatio(0.2f); | 595 layers[i]->SetVisibleToTotalLengthRatio(0.2f); |
| 596 layers[i]->SetCurrentPos(25); | 596 layers[i]->SetCurrentPos(25); |
| 597 layers[i]->SetMaximum(100); | 597 layers[i]->SetMaximum(100); |
| 598 } | 598 } |
| 599 layers[0]->SetBounds(gfx::Size(100, 3)); | 599 layers[0]->SetBounds(gfx::Size(100, 3)); |
| 600 layers[1]->SetBounds(gfx::Size(3, 100)); | 600 layers[1]->SetBounds(gfx::Size(3, 100)); |
| 601 | 601 |
| 602 EXPECT_EQ(gfx::RectF(20.f, 0.f, 20.f, 3.f), | 602 EXPECT_EQ(gfx::Rect(20, 0, 20, 3), |
| 603 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); | 603 horizontal_scrollbar_layer_->ComputeThumbQuadRect()); |
| 604 EXPECT_EQ(gfx::RectF(0.f, 20.f, 3.f, 20.f), | 604 EXPECT_EQ(gfx::Rect(0, 20, 3, 20), |
| 605 vertical_scrollbar_layer_->ComputeThumbQuadRect()); | 605 vertical_scrollbar_layer_->ComputeThumbQuadRect()); |
| 606 | 606 |
| 607 horizontal_scrollbar_layer_->SetVerticalAdjust(10.f); | 607 horizontal_scrollbar_layer_->SetVerticalAdjust(10.f); |
| 608 vertical_scrollbar_layer_->SetVerticalAdjust(10.f); | 608 vertical_scrollbar_layer_->SetVerticalAdjust(10.f); |
| 609 | 609 |
| 610 // The vertical adjustment factor has two effects: | 610 // The vertical adjustment factor has two effects: |
| 611 // 1.) Moves the horizontal scrollbar down | 611 // 1.) Moves the horizontal scrollbar down |
| 612 // 2.) Increases the vertical scrollbar's effective track length which both | 612 // 2.) Increases the vertical scrollbar's effective track length which both |
| 613 // increases the thumb's length and its position within the track. | 613 // increases the thumb's length and its position within the track. |
| 614 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), | 614 EXPECT_EQ(gfx::Rect(20.f, 10.f, 20.f, 3.f), |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 1011 | 1011 |
| 1012 // Horizontal Scrollbars. | 1012 // Horizontal Scrollbars. |
| 1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 } // namespace | 1017 } // namespace |
| 1018 } // namespace cc | 1018 } // namespace cc |
| OLD | NEW |