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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 6227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6238 gfx::Vector2d gesture_scroll_delta(10, 0); | 6238 gfx::Vector2d gesture_scroll_delta(10, 0); |
6239 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 6239 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
6240 host_impl_ | 6240 host_impl_ |
6241 ->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), | 6241 ->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), |
6242 InputHandler::TOUCHSCREEN) | 6242 InputHandler::TOUCHSCREEN) |
6243 .thread); | 6243 .thread); |
6244 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); | 6244 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); |
6245 host_impl_->ScrollEnd(EndState().get()); | 6245 host_impl_->ScrollEnd(EndState().get()); |
6246 | 6246 |
6247 // The child layer shouldn't have scrolled. | 6247 // The child layer shouldn't have scrolled. |
6248 gfx::Vector2d expected_scroll_delta( | |
6249 0, -gesture_scroll_delta.x() * | |
6250 std::sin(MathUtil::Deg2Rad(child_layer_angle))); | |
6251 std::unique_ptr<ScrollAndScaleSet> scroll_info = | 6248 std::unique_ptr<ScrollAndScaleSet> scroll_info = |
6252 host_impl_->ProcessScrollDeltas(); | 6249 host_impl_->ProcessScrollDeltas(); |
6253 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child_scroll_id, | 6250 ExpectNone(*scroll_info.get(), child_scroll_id); |
bokan
2017/06/19 21:43:17
What's this change about? The comment above says t
sahel
2017/06/22 16:34:17
As we discussed the comment is incorrect, I confir
bokan
2017/06/22 21:44:37
Acknowledged.
| |
6254 expected_scroll_delta)); | |
6255 | 6251 |
6256 // The root scroll layer shouldn't have scrolled. | 6252 // The root scroll layer shouldn't have scrolled. |
6257 ExpectNone(*scroll_info.get(), scroll_layer->element_id()); | 6253 ExpectNone(*scroll_info.get(), scroll_layer->element_id()); |
6258 } | 6254 } |
6259 } | 6255 } |
6260 | 6256 |
6261 TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) { | 6257 TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) { |
6262 // When scrolling an element with perspective, the distance scrolled | 6258 // When scrolling an element with perspective, the distance scrolled |
6263 // depends on the point at which the scroll begins. | 6259 // depends on the point at which the scroll begins. |
6264 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 6260 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
(...skipping 4651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10916 scrolling_layer->CurrentScrollOffset()); | 10912 scrolling_layer->CurrentScrollOffset()); |
10917 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingNode()); | 10913 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingNode()); |
10918 host_impl_->DidFinishImplFrame(); | 10914 host_impl_->DidFinishImplFrame(); |
10919 } | 10915 } |
10920 | 10916 |
10921 TEST_F(LayerTreeHostImplTest, SecondScrollAnimatedBeginNotIgnored) { | 10917 TEST_F(LayerTreeHostImplTest, SecondScrollAnimatedBeginNotIgnored) { |
10922 const gfx::Size content_size(1000, 1000); | 10918 const gfx::Size content_size(1000, 1000); |
10923 const gfx::Size viewport_size(50, 100); | 10919 const gfx::Size viewport_size(50, 100); |
10924 CreateBasicVirtualViewportLayers(viewport_size, content_size); | 10920 CreateBasicVirtualViewportLayers(viewport_size, content_size); |
10925 | 10921 |
10926 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 10922 EXPECT_EQ( |
10927 host_impl_->ScrollAnimatedBegin(gfx::Point()).thread); | 10923 InputHandler::SCROLL_ON_IMPL_THREAD, |
10924 host_impl_->ScrollAnimatedBegin(BeginState(gfx::Point()).get()).thread); | |
10928 | 10925 |
10929 // The second ScrollAnimatedBegin should not get ignored. | 10926 // The second ScrollAnimatedBegin should not get ignored. |
10930 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 10927 EXPECT_EQ( |
10931 host_impl_->ScrollAnimatedBegin(gfx::Point()).thread); | 10928 InputHandler::SCROLL_ON_IMPL_THREAD, |
10929 host_impl_->ScrollAnimatedBegin(BeginState(gfx::Point()).get()).thread); | |
10932 } | 10930 } |
10933 | 10931 |
10934 // Verfify that a smooth scroll animation doesn't jump when UpdateTarget gets | 10932 // Verfify that a smooth scroll animation doesn't jump when UpdateTarget gets |
10935 // called before the animation is started. | 10933 // called before the animation is started. |
10936 TEST_F(LayerTreeHostImplTest, AnimatedScrollUpdateTargetBeforeStarting) { | 10934 TEST_F(LayerTreeHostImplTest, AnimatedScrollUpdateTargetBeforeStarting) { |
10937 const gfx::Size content_size(1000, 1000); | 10935 const gfx::Size content_size(1000, 1000); |
10938 const gfx::Size viewport_size(50, 100); | 10936 const gfx::Size viewport_size(50, 100); |
10939 CreateBasicVirtualViewportLayers(viewport_size, content_size); | 10937 CreateBasicVirtualViewportLayers(viewport_size, content_size); |
10940 | 10938 |
10941 DrawFrame(); | 10939 DrawFrame(); |
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12643 // layer should be prioritized over the hidden layer. | 12641 // layer should be prioritized over the hidden layer. |
12644 hidden_layer->set_contributes_to_drawn_render_surface(false); | 12642 hidden_layer->set_contributes_to_drawn_render_surface(false); |
12645 hidden_layer->set_raster_even_if_not_drawn(true); | 12643 hidden_layer->set_raster_even_if_not_drawn(true); |
12646 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, | 12644 queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY, |
12647 RasterTilePriorityQueue::Type::ALL); | 12645 RasterTilePriorityQueue::Type::ALL); |
12648 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); | 12646 EXPECT_EQ(queue->Top().tile()->layer_id(), 3); |
12649 } | 12647 } |
12650 | 12648 |
12651 } // namespace | 12649 } // namespace |
12652 } // namespace cc | 12650 } // namespace cc |
OLD | NEW |