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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 child = child_layer.get(); | 804 child = child_layer.get(); |
805 child_layer->SetDrawsContent(true); | 805 child_layer->SetDrawsContent(true); |
806 child_layer->SetPosition(gfx::PointF(0, 20)); | 806 child_layer->SetPosition(gfx::PointF(0, 20)); |
807 child_layer->SetBounds(gfx::Size(50, 50)); | 807 child_layer->SetBounds(gfx::Size(50, 50)); |
808 scroll->test_properties()->AddChild(std::move(child_layer)); | 808 scroll->test_properties()->AddChild(std::move(child_layer)); |
809 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 809 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
810 } | 810 } |
811 | 811 |
812 // Touch handler regions determine whether touch events block scroll. | 812 // Touch handler regions determine whether touch events block scroll. |
813 root->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); | 813 root->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); |
814 EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 10))); | 814 EXPECT_NE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 10)), |
| 815 InputHandler::TouchStartHitResult::HANDLER); |
815 | 816 |
816 // But they don't influence the actual handling of the scroll gestures. | 817 // But they don't influence the actual handling of the scroll gestures. |
817 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( | 818 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( |
818 BeginState(gfx::Point()).get(), InputHandler::TOUCHSCREEN); | 819 BeginState(gfx::Point()).get(), InputHandler::TOUCHSCREEN); |
819 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); | 820 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); |
820 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, | 821 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, |
821 status.main_thread_scrolling_reasons); | 822 status.main_thread_scrolling_reasons); |
822 host_impl_->ScrollEnd(EndState().get()); | 823 host_impl_->ScrollEnd(EndState().get()); |
823 | 824 |
824 EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30))); | 825 EXPECT_NE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)), |
| 826 InputHandler::TouchStartHitResult::HANDLER); |
825 root->SetTouchEventHandlerRegion(gfx::Rect()); | 827 root->SetTouchEventHandlerRegion(gfx::Rect()); |
826 EXPECT_FALSE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30))); | 828 EXPECT_EQ(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)), |
| 829 InputHandler::TouchStartHitResult::HANDLER); |
827 child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); | 830 child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); |
828 EXPECT_TRUE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30))); | 831 EXPECT_NE(host_impl_->DoTouchEventsBlockScrollAt(gfx::Point(10, 30)), |
| 832 InputHandler::TouchStartHitResult::HANDLER); |
829 } | 833 } |
830 | 834 |
831 TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) { | 835 TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) { |
832 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 836 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
833 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 837 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
834 DrawFrame(); | 838 DrawFrame(); |
835 | 839 |
836 // Ignore the fling since no layer is being scrolled | 840 // Ignore the fling since no layer is being scrolled |
837 InputHandler::ScrollStatus status = host_impl_->FlingScrollBegin(); | 841 InputHandler::ScrollStatus status = host_impl_->FlingScrollBegin(); |
838 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); | 842 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); |
(...skipping 10813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11652 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); | 11656 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); |
11653 host_impl_->MouseMoveAt(gfx::Point(10, 150)); | 11657 host_impl_->MouseMoveAt(gfx::Point(10, 150)); |
11654 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar()); | 11658 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar()); |
11655 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar()); | 11659 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar()); |
11656 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar()); | 11660 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar()); |
11657 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); | 11661 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); |
11658 } | 11662 } |
11659 | 11663 |
11660 } // namespace | 11664 } // namespace |
11661 } // namespace cc | 11665 } // namespace cc |
OLD | NEW |