| 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 10504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10515 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get()); | 10515 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get()); |
| 10516 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), | 10516 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), |
| 10517 InputHandler::WHEEL)); | 10517 InputHandler::WHEEL)); |
| 10518 std::unique_ptr<ScrollState> scroll_state_end = EndState(); | 10518 std::unique_ptr<ScrollState> scroll_state_end = EndState(); |
| 10519 host_impl_->ScrollEnd(scroll_state_end.get()); | 10519 host_impl_->ScrollEnd(scroll_state_end.get()); |
| 10520 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), | 10520 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), |
| 10521 InputHandler::WHEEL)); | 10521 InputHandler::WHEEL)); |
| 10522 | 10522 |
| 10523 // The instant scroll should have marked the smooth scroll animation as | 10523 // The instant scroll should have marked the smooth scroll animation as |
| 10524 // aborted. | 10524 // aborted. |
| 10525 EXPECT_FALSE(GetImplAnimationHost()->HasActiveAnimationForTesting( | 10525 EXPECT_FALSE(GetImplAnimationHost()->HasTickingAnimationForTesting( |
| 10526 scrolling_layer->element_id())); | 10526 scrolling_layer->element_id())); |
| 10527 | 10527 |
| 10528 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), | 10528 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), |
| 10529 scrolling_layer->CurrentScrollOffset()); | 10529 scrolling_layer->CurrentScrollOffset()); |
| 10530 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 10530 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 10531 host_impl_->DidFinishImplFrame(); | 10531 host_impl_->DidFinishImplFrame(); |
| 10532 } | 10532 } |
| 10533 | 10533 |
| 10534 // Test that a smooth scroll offset animation is marked finished when aborted | 10534 // Test that a smooth scroll offset animation is marked finished when aborted |
| 10535 // with the needs_completion flag. The animation is then finished on the | 10535 // with the needs_completion flag. The animation is then finished on the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10574 | 10574 |
| 10575 float y = scrolling_layer->CurrentScrollOffset().y(); | 10575 float y = scrolling_layer->CurrentScrollOffset().y(); |
| 10576 EXPECT_TRUE(y > 1 && y < 49); | 10576 EXPECT_TRUE(y > 1 && y < 49); |
| 10577 | 10577 |
| 10578 // Abort animation. | 10578 // Abort animation. |
| 10579 GetImplAnimationHost()->ScrollAnimationAbort(true /*needs_completion*/); | 10579 GetImplAnimationHost()->ScrollAnimationAbort(true /*needs_completion*/); |
| 10580 host_impl_->UpdateAnimationState(true); | 10580 host_impl_->UpdateAnimationState(true); |
| 10581 | 10581 |
| 10582 // Aborting with the needs completion param should have marked the smooth | 10582 // Aborting with the needs completion param should have marked the smooth |
| 10583 // scroll animation as finished. | 10583 // scroll animation as finished. |
| 10584 EXPECT_FALSE(GetImplAnimationHost()->HasActiveAnimationForTesting( | 10584 EXPECT_FALSE(GetImplAnimationHost()->HasTickingAnimationForTesting( |
| 10585 scrolling_layer->element_id())); | 10585 scrolling_layer->element_id())); |
| 10586 EXPECT_TRUE(y > 1 && y < 49); | 10586 EXPECT_TRUE(y > 1 && y < 49); |
| 10587 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 10587 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 10588 host_impl_->DidFinishImplFrame(); | 10588 host_impl_->DidFinishImplFrame(); |
| 10589 } | 10589 } |
| 10590 | 10590 |
| 10591 // Evolved from LayerTreeHostImplTest.ScrollAnimated. | 10591 // Evolved from LayerTreeHostImplTest.ScrollAnimated. |
| 10592 TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) { | 10592 TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) { |
| 10593 const gfx::Size content_size(1000, 1000); | 10593 const gfx::Size content_size(1000, 1000); |
| 10594 const gfx::Size viewport_size(500, 500); | 10594 const gfx::Size viewport_size(500, 500); |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11740 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); | 11740 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); |
| 11741 host_impl_->MouseMoveAt(gfx::Point(10, 150)); | 11741 host_impl_->MouseMoveAt(gfx::Point(10, 150)); |
| 11742 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar()); | 11742 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar()); |
| 11743 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar()); | 11743 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar()); |
| 11744 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar()); | 11744 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar()); |
| 11745 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); | 11745 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); |
| 11746 } | 11746 } |
| 11747 | 11747 |
| 11748 } // namespace | 11748 } // namespace |
| 11749 } // namespace cc | 11749 } // namespace cc |
| OLD | NEW |