| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3034 host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta); | 3034 host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta); |
| 3035 host_impl_->ScrollEnd(); | 3035 host_impl_->ScrollEnd(); |
| 3036 | 3036 |
| 3037 // The scale should not have been applied to the scroll delta. | 3037 // The scale should not have been applied to the scroll delta. |
| 3038 scroll_info = host_impl_->ProcessScrollDeltas(); | 3038 scroll_info = host_impl_->ProcessScrollDeltas(); |
| 3039 ExpectContains(*scroll_info.get(), | 3039 ExpectContains(*scroll_info.get(), |
| 3040 scroll_layer->id(), | 3040 scroll_layer->id(), |
| 3041 wheel_scroll_delta); | 3041 wheel_scroll_delta); |
| 3042 } | 3042 } |
| 3043 | 3043 |
| 3044 TEST_F(LayerTreeHostImplTest, ScrollViewportRounding) { |
| 3045 int width = 332; |
| 3046 int height = 20; |
| 3047 int scale = 3; |
| 3048 SetupScrollAndContentsLayers(gfx::Size(width, height)); |
| 3049 host_impl_->SetViewportSize(gfx::Size(width * scale - 1, height * scale)); |
| 3050 host_impl_->SetDeviceScaleFactor(scale); |
| 3051 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); |
| 3052 |
| 3053 LayerImpl* inner_viewport_scroll_layer = |
| 3054 host_impl_->active_tree()->InnerViewportScrollLayer(); |
| 3055 EXPECT_EQ(gfx::Vector2d(0, 0), |
| 3056 inner_viewport_scroll_layer->MaxScrollOffset()); |
| 3057 } |
| 3058 |
| 3044 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { | 3059 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { |
| 3045 public: | 3060 public: |
| 3046 TestScrollOffsetDelegate() | 3061 TestScrollOffsetDelegate() |
| 3047 : page_scale_factor_(0.f), | 3062 : page_scale_factor_(0.f), |
| 3048 min_page_scale_factor_(-1.f), | 3063 min_page_scale_factor_(-1.f), |
| 3049 max_page_scale_factor_(-1.f) {} | 3064 max_page_scale_factor_(-1.f) {} |
| 3050 | 3065 |
| 3051 virtual ~TestScrollOffsetDelegate() {} | 3066 virtual ~TestScrollOffsetDelegate() {} |
| 3052 | 3067 |
| 3053 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { | 3068 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { |
| (...skipping 3971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7025 host_impl_->DidLoseOutputSurface(); | 7040 host_impl_->DidLoseOutputSurface(); |
| 7026 EXPECT_TRUE(host_impl_->IsContextLost()); | 7041 EXPECT_TRUE(host_impl_->IsContextLost()); |
| 7027 EXPECT_EQ(1, num_lost_surfaces_); | 7042 EXPECT_EQ(1, num_lost_surfaces_); |
| 7028 host_impl_->DidLoseOutputSurface(); | 7043 host_impl_->DidLoseOutputSurface(); |
| 7029 EXPECT_TRUE(host_impl_->IsContextLost()); | 7044 EXPECT_TRUE(host_impl_->IsContextLost()); |
| 7030 EXPECT_EQ(1, num_lost_surfaces_); | 7045 EXPECT_EQ(1, num_lost_surfaces_); |
| 7031 } | 7046 } |
| 7032 | 7047 |
| 7033 } // namespace | 7048 } // namespace |
| 7034 } // namespace cc | 7049 } // namespace cc |
| OLD | NEW |