| Index: cc/layers/scrollbar_layer_unittest.cc
|
| diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
|
| index 68613e87e33360ad4da748168d35c9d155151e2f..8cc778b9e9cbc03541a03c2a40c68ca891f9d19c 100644
|
| --- a/cc/layers/scrollbar_layer_unittest.cc
|
| +++ b/cc/layers/scrollbar_layer_unittest.cc
|
| @@ -26,6 +26,7 @@
|
| #include "cc/test/fake_painted_scrollbar_layer.h"
|
| #include "cc/test/fake_scrollbar.h"
|
| #include "cc/test/geometry_test_utils.h"
|
| +#include "cc/test/layer_test_common.h"
|
| #include "cc/test/layer_tree_test.h"
|
| #include "cc/test/mock_occlusion_tracker.h"
|
| #include "cc/test/stub_layer_tree_host_single_thread_client.h"
|
| @@ -766,6 +767,48 @@ TEST_F(ScrollbarLayerTest, ScrollbarLayerPushProperties) {
|
| EXPECT_EQ(node->opacity, 1.f);
|
| }
|
|
|
| +TEST_F(ScrollbarLayerTest, SubPixelCanScrollOrientation) {
|
| + gfx::Size viewport_size(100, 100);
|
| +
|
| + LayerTestCommon::LayerImplTest impl;
|
| +
|
| + LayerImpl* clip_layer = impl.AddChildToRoot<LayerImpl>();
|
| + LayerImpl* scroll_layer = impl.AddChild<LayerImpl>(clip_layer);
|
| +
|
| + scroll_layer->SetScrollClipLayer(clip_layer->id());
|
| +
|
| + const int kTrackStart = 0;
|
| + const int kThumbThickness = 10;
|
| + const bool kIsLeftSideVerticalScrollbar = false;
|
| + const bool kIsOverlayScrollbar = false;
|
| +
|
| + SolidColorScrollbarLayerImpl* scrollbar_layer =
|
| + impl.AddChild<SolidColorScrollbarLayerImpl>(
|
| + scroll_layer, HORIZONTAL, kThumbThickness, kTrackStart,
|
| + kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
|
| +
|
| + scrollbar_layer->SetScrollInfo(scroll_layer->id(),
|
| + scrollbar_layer->element_id());
|
| + clip_layer->SetBounds(gfx::Size(100, 100));
|
| + scroll_layer->SetBounds(gfx::Size(100, 100));
|
| +
|
| + impl.CalcDrawProps(viewport_size);
|
| +
|
| + // Fake device scale.
|
| + impl.host_impl()->active_tree()->SetDeviceScaleFactor(3);
|
| +
|
| + // Fake clip layer length to scrollbar to mock rounding error.
|
| + scrollbar_layer->SetClipLayerLength(99.99f);
|
| +
|
| + EXPECT_FALSE(scrollbar_layer->CanScrollOrientation());
|
| +
|
| + // Fake clip layer length to scrollbar to 1 device pixel shorter than scroll
|
| + // layer.
|
| + scrollbar_layer->SetClipLayerLength(99.65f);
|
| +
|
| + EXPECT_TRUE(scrollbar_layer->CanScrollOrientation());
|
| +}
|
| +
|
| class ScrollbarLayerSolidColorThumbTest : public testing::Test {
|
| public:
|
| ScrollbarLayerSolidColorThumbTest() {
|
|
|