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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 // The impl-based pinch zoom should adjust the max scroll position. | 764 // The impl-based pinch zoom should adjust the max scroll position. |
765 { | 765 { |
766 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 766 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
767 min_page_scale, | 767 min_page_scale, |
768 max_page_scale); | 768 max_page_scale); |
769 host_impl_->active_tree()->SetPageScaleDelta(1.f); | 769 host_impl_->active_tree()->SetPageScaleDelta(1.f); |
770 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 770 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
771 | 771 |
772 float page_scale_delta = 2.f; | 772 float page_scale_delta = 2.f; |
773 host_impl_->PinchGestureBegin(); | 773 host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture); |
774 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 774 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
775 host_impl_->PinchGestureEnd(); | 775 host_impl_->PinchGestureEnd(); |
| 776 host_impl_->ScrollEnd(); |
776 EXPECT_TRUE(did_request_redraw_); | 777 EXPECT_TRUE(did_request_redraw_); |
777 EXPECT_TRUE(did_request_commit_); | 778 EXPECT_TRUE(did_request_commit_); |
778 | 779 |
779 scoped_ptr<ScrollAndScaleSet> scroll_info = | 780 scoped_ptr<ScrollAndScaleSet> scroll_info = |
780 host_impl_->ProcessScrollDeltas(); | 781 host_impl_->ProcessScrollDeltas(); |
781 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 782 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
782 | 783 |
783 EXPECT_EQ(gfx::Vector2d(75, 75).ToString(), | 784 EXPECT_EQ(gfx::Vector2d(75, 75).ToString(), |
784 scroll_layer->max_scroll_offset().ToString()); | 785 scroll_layer->max_scroll_offset().ToString()); |
785 } | 786 } |
786 | 787 |
787 // Scrolling after a pinch gesture should always be in local space. The | 788 // Scrolling after a pinch gesture should always be in local space. The |
788 // scroll deltas do not have the page scale factor applied. | 789 // scroll deltas do not have the page scale factor applied. |
789 { | 790 { |
790 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 791 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
791 min_page_scale, | 792 min_page_scale, |
792 max_page_scale); | 793 max_page_scale); |
793 host_impl_->active_tree()->SetPageScaleDelta(1.f); | 794 host_impl_->active_tree()->SetPageScaleDelta(1.f); |
794 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 795 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
795 | 796 |
796 float page_scale_delta = 2.f; | 797 float page_scale_delta = 2.f; |
| 798 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
797 host_impl_->PinchGestureBegin(); | 799 host_impl_->PinchGestureBegin(); |
798 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); | 800 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); |
799 host_impl_->PinchGestureEnd(); | 801 host_impl_->PinchGestureEnd(); |
| 802 host_impl_->ScrollEnd(); |
800 | 803 |
801 gfx::Vector2d scroll_delta(0, 10); | 804 gfx::Vector2d scroll_delta(0, 10); |
802 EXPECT_EQ(InputHandler::ScrollStarted, | 805 EXPECT_EQ(InputHandler::ScrollStarted, |
803 host_impl_->ScrollBegin(gfx::Point(5, 5), | 806 host_impl_->ScrollBegin(gfx::Point(5, 5), |
804 InputHandler::Wheel)); | 807 InputHandler::Wheel)); |
805 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 808 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
806 host_impl_->ScrollEnd(); | 809 host_impl_->ScrollEnd(); |
807 | 810 |
808 scoped_ptr<ScrollAndScaleSet> scroll_info = | 811 scoped_ptr<ScrollAndScaleSet> scroll_info = |
809 host_impl_->ProcessScrollDeltas(); | 812 host_impl_->ProcessScrollDeltas(); |
(...skipping 15 matching lines...) Expand all Loading... |
825 float max_page_scale = 4.f; | 828 float max_page_scale = 4.f; |
826 | 829 |
827 // Basic pinch zoom in gesture | 830 // Basic pinch zoom in gesture |
828 { | 831 { |
829 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 832 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
830 min_page_scale, | 833 min_page_scale, |
831 max_page_scale); | 834 max_page_scale); |
832 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 835 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
833 | 836 |
834 float page_scale_delta = 2.f; | 837 float page_scale_delta = 2.f; |
| 838 host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture); |
835 host_impl_->PinchGestureBegin(); | 839 host_impl_->PinchGestureBegin(); |
836 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 840 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
837 host_impl_->PinchGestureEnd(); | 841 host_impl_->PinchGestureEnd(); |
| 842 host_impl_->ScrollEnd(); |
838 EXPECT_TRUE(did_request_redraw_); | 843 EXPECT_TRUE(did_request_redraw_); |
839 EXPECT_TRUE(did_request_commit_); | 844 EXPECT_TRUE(did_request_commit_); |
840 | 845 |
841 scoped_ptr<ScrollAndScaleSet> scroll_info = | 846 scoped_ptr<ScrollAndScaleSet> scroll_info = |
842 host_impl_->ProcessScrollDeltas(); | 847 host_impl_->ProcessScrollDeltas(); |
843 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 848 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
844 } | 849 } |
845 | 850 |
846 // Zoom-in clamping | 851 // Zoom-in clamping |
847 { | 852 { |
848 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 853 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
849 min_page_scale, | 854 min_page_scale, |
850 max_page_scale); | 855 max_page_scale); |
851 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 856 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
852 float page_scale_delta = 10.f; | 857 float page_scale_delta = 10.f; |
853 | 858 |
| 859 host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::Gesture); |
854 host_impl_->PinchGestureBegin(); | 860 host_impl_->PinchGestureBegin(); |
855 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 861 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
856 host_impl_->PinchGestureEnd(); | 862 host_impl_->PinchGestureEnd(); |
| 863 host_impl_->ScrollEnd(); |
857 | 864 |
858 scoped_ptr<ScrollAndScaleSet> scroll_info = | 865 scoped_ptr<ScrollAndScaleSet> scroll_info = |
859 host_impl_->ProcessScrollDeltas(); | 866 host_impl_->ProcessScrollDeltas(); |
860 EXPECT_EQ(scroll_info->page_scale_delta, max_page_scale); | 867 EXPECT_EQ(scroll_info->page_scale_delta, max_page_scale); |
861 } | 868 } |
862 | 869 |
863 // Zoom-out clamping | 870 // Zoom-out clamping |
864 { | 871 { |
865 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 872 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
866 min_page_scale, | 873 min_page_scale, |
867 max_page_scale); | 874 max_page_scale); |
868 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 875 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
869 scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50)); | 876 scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50)); |
870 | 877 |
871 float page_scale_delta = 0.1f; | 878 float page_scale_delta = 0.1f; |
| 879 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
872 host_impl_->PinchGestureBegin(); | 880 host_impl_->PinchGestureBegin(); |
873 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); | 881 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); |
874 host_impl_->PinchGestureEnd(); | 882 host_impl_->PinchGestureEnd(); |
| 883 host_impl_->ScrollEnd(); |
875 | 884 |
876 scoped_ptr<ScrollAndScaleSet> scroll_info = | 885 scoped_ptr<ScrollAndScaleSet> scroll_info = |
877 host_impl_->ProcessScrollDeltas(); | 886 host_impl_->ProcessScrollDeltas(); |
878 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); | 887 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); |
879 | 888 |
880 EXPECT_TRUE(scroll_info->scrolls.empty()); | 889 EXPECT_TRUE(scroll_info->scrolls.empty()); |
881 } | 890 } |
882 | 891 |
883 // Two-finger panning should not happen based on pinch events only | 892 // Two-finger panning should not happen based on pinch events only |
884 { | 893 { |
885 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 894 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
886 min_page_scale, | 895 min_page_scale, |
887 max_page_scale); | 896 max_page_scale); |
888 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 897 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
889 scroll_layer->SetScrollOffset(gfx::Vector2d(20, 20)); | 898 scroll_layer->SetScrollOffset(gfx::Vector2d(20, 20)); |
890 | 899 |
891 float page_scale_delta = 1.f; | 900 float page_scale_delta = 1.f; |
| 901 host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture); |
892 host_impl_->PinchGestureBegin(); | 902 host_impl_->PinchGestureBegin(); |
893 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); | 903 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); |
894 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); | 904 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); |
895 host_impl_->PinchGestureEnd(); | 905 host_impl_->PinchGestureEnd(); |
| 906 host_impl_->ScrollEnd(); |
896 | 907 |
897 scoped_ptr<ScrollAndScaleSet> scroll_info = | 908 scoped_ptr<ScrollAndScaleSet> scroll_info = |
898 host_impl_->ProcessScrollDeltas(); | 909 host_impl_->ProcessScrollDeltas(); |
899 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 910 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
900 EXPECT_TRUE(scroll_info->scrolls.empty()); | 911 EXPECT_TRUE(scroll_info->scrolls.empty()); |
901 } | 912 } |
902 | 913 |
903 // Two-finger panning should work with interleaved scroll events | 914 // Two-finger panning should work with interleaved scroll events |
904 { | 915 { |
905 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, | 916 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, |
906 min_page_scale, | 917 min_page_scale, |
907 max_page_scale); | 918 max_page_scale); |
908 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 919 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
909 scroll_layer->SetScrollOffset(gfx::Vector2d(20, 20)); | 920 scroll_layer->SetScrollOffset(gfx::Vector2d(20, 20)); |
910 | 921 |
911 float page_scale_delta = 1.f; | 922 float page_scale_delta = 1.f; |
912 host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Wheel); | 923 host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture); |
913 host_impl_->PinchGestureBegin(); | 924 host_impl_->PinchGestureBegin(); |
914 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); | 925 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); |
915 host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10)); | 926 host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10)); |
916 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); | 927 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); |
917 host_impl_->PinchGestureEnd(); | 928 host_impl_->PinchGestureEnd(); |
918 host_impl_->ScrollEnd(); | 929 host_impl_->ScrollEnd(); |
919 | 930 |
920 scoped_ptr<ScrollAndScaleSet> scroll_info = | 931 scoped_ptr<ScrollAndScaleSet> scroll_info = |
921 host_impl_->ProcessScrollDeltas(); | 932 host_impl_->ProcessScrollDeltas(); |
922 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 933 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
923 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-10, -10)); | 934 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(-10, -10)); |
924 } | 935 } |
| 936 |
| 937 // Two-finger panning should work when starting fully zoomed out. |
| 938 { |
| 939 host_impl_->active_tree()->SetPageScaleFactorAndLimits(0.5f, |
| 940 0.5f, |
| 941 4.f); |
| 942 scroll_layer->SetScrollDelta(gfx::Vector2d()); |
| 943 scroll_layer->SetScrollOffset(gfx::Vector2d(0, 0)); |
| 944 host_impl_->active_tree()->UpdateMaxScrollOffset(); |
| 945 |
| 946 host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Gesture); |
| 947 host_impl_->PinchGestureBegin(); |
| 948 host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0)); |
| 949 host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0)); |
| 950 host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2d(10, 10)); |
| 951 host_impl_->PinchGestureUpdate(1.f, gfx::Point(10, 10)); |
| 952 host_impl_->PinchGestureEnd(); |
| 953 host_impl_->ScrollEnd(); |
| 954 |
| 955 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 956 host_impl_->ProcessScrollDeltas(); |
| 957 EXPECT_EQ(scroll_info->page_scale_delta, 2.f); |
| 958 ExpectContains(*scroll_info, scroll_layer->id(), gfx::Vector2d(20, 20)); |
| 959 } |
925 } | 960 } |
926 | 961 |
927 TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { | 962 TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { |
928 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 963 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
929 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 964 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
930 InitializeRendererAndDrawFrame(); | 965 InitializeRendererAndDrawFrame(); |
931 | 966 |
932 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); | 967 LayerImpl* scroll_layer = host_impl_->RootScrollLayer(); |
933 DCHECK(scroll_layer); | 968 DCHECK(scroll_layer); |
934 | 969 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); | 1212 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); |
1178 } | 1213 } |
1179 host_impl_->ScrollEnd(); | 1214 host_impl_->ScrollEnd(); |
1180 { | 1215 { |
1181 CompositorFrameMetadata metadata = | 1216 CompositorFrameMetadata metadata = |
1182 host_impl_->MakeCompositorFrameMetadata(); | 1217 host_impl_->MakeCompositorFrameMetadata(); |
1183 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); | 1218 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); |
1184 } | 1219 } |
1185 | 1220 |
1186 // Page scale should update metadata correctly (shrinking only the viewport). | 1221 // Page scale should update metadata correctly (shrinking only the viewport). |
| 1222 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
1187 host_impl_->PinchGestureBegin(); | 1223 host_impl_->PinchGestureBegin(); |
1188 host_impl_->PinchGestureUpdate(2.f, gfx::Point()); | 1224 host_impl_->PinchGestureUpdate(2.f, gfx::Point()); |
1189 host_impl_->PinchGestureEnd(); | 1225 host_impl_->PinchGestureEnd(); |
| 1226 host_impl_->ScrollEnd(); |
1190 { | 1227 { |
1191 CompositorFrameMetadata metadata = | 1228 CompositorFrameMetadata metadata = |
1192 host_impl_->MakeCompositorFrameMetadata(); | 1229 host_impl_->MakeCompositorFrameMetadata(); |
1193 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); | 1230 EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset); |
1194 EXPECT_EQ(2.f, metadata.page_scale_factor); | 1231 EXPECT_EQ(2.f, metadata.page_scale_factor); |
1195 EXPECT_EQ(gfx::SizeF(25.f, 25.f), metadata.viewport_size); | 1232 EXPECT_EQ(gfx::SizeF(25.f, 25.f), metadata.viewport_size); |
1196 EXPECT_EQ(gfx::SizeF(100.f, 100.f), metadata.root_layer_size); | 1233 EXPECT_EQ(gfx::SizeF(100.f, 100.f), metadata.root_layer_size); |
1197 EXPECT_EQ(0.5f, metadata.min_page_scale_factor); | 1234 EXPECT_EQ(0.5f, metadata.min_page_scale_factor); |
1198 EXPECT_EQ(4.f, metadata.max_page_scale_factor); | 1235 EXPECT_EQ(4.f, metadata.max_page_scale_factor); |
1199 } | 1236 } |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 gfx::Vector2d scroll_delta(0, 10); | 1819 gfx::Vector2d scroll_delta(0, 10); |
1783 gfx::Vector2d expected_scroll_delta = scroll_delta; | 1820 gfx::Vector2d expected_scroll_delta = scroll_delta; |
1784 gfx::Vector2d expected_max_scroll = root_scroll->max_scroll_offset(); | 1821 gfx::Vector2d expected_max_scroll = root_scroll->max_scroll_offset(); |
1785 EXPECT_EQ(InputHandler::ScrollStarted, | 1822 EXPECT_EQ(InputHandler::ScrollStarted, |
1786 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1823 host_impl_->ScrollBegin(gfx::Point(5, 5), |
1787 InputHandler::Wheel)); | 1824 InputHandler::Wheel)); |
1788 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1825 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
1789 host_impl_->ScrollEnd(); | 1826 host_impl_->ScrollEnd(); |
1790 | 1827 |
1791 // Set new page scale on impl thread by pinching. | 1828 // Set new page scale on impl thread by pinching. |
| 1829 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
1792 host_impl_->PinchGestureBegin(); | 1830 host_impl_->PinchGestureBegin(); |
1793 host_impl_->PinchGestureUpdate(page_scale, gfx::Point()); | 1831 host_impl_->PinchGestureUpdate(page_scale, gfx::Point()); |
1794 host_impl_->PinchGestureEnd(); | 1832 host_impl_->PinchGestureEnd(); |
| 1833 host_impl_->ScrollEnd(); |
1795 DrawOneFrame(); | 1834 DrawOneFrame(); |
1796 | 1835 |
1797 // The scroll delta is not scaled because the main thread did not scale. | 1836 // The scroll delta is not scaled because the main thread did not scale. |
1798 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); | 1837 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); |
1799 ExpectContains(*scroll_info.get(), root_scroll->id(), expected_scroll_delta); | 1838 ExpectContains(*scroll_info.get(), root_scroll->id(), expected_scroll_delta); |
1800 | 1839 |
1801 // The scroll range should also have been updated. | 1840 // The scroll range should also have been updated. |
1802 EXPECT_EQ(expected_max_scroll, root_scroll->max_scroll_offset()); | 1841 EXPECT_EQ(expected_max_scroll, root_scroll->max_scroll_offset()); |
1803 | 1842 |
1804 // The page scale delta should match the new scale on the impl side. | 1843 // The page scale delta should match the new scale on the impl side. |
(...skipping 14 matching lines...) Expand all Loading... |
1819 LayerImpl* scroll = SetupScrollAndContentsLayers(surface_size); | 1858 LayerImpl* scroll = SetupScrollAndContentsLayers(surface_size); |
1820 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 1859 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
1821 LayerImpl* child = scroll->children()[0]; | 1860 LayerImpl* child = scroll->children()[0]; |
1822 | 1861 |
1823 scoped_ptr<LayerImpl> scrollable_child = | 1862 scoped_ptr<LayerImpl> scrollable_child = |
1824 CreateScrollableLayer(4, surface_size); | 1863 CreateScrollableLayer(4, surface_size); |
1825 child->AddChild(scrollable_child.Pass()); | 1864 child->AddChild(scrollable_child.Pass()); |
1826 LayerImpl* grand_child = child->children()[0]; | 1865 LayerImpl* grand_child = child->children()[0]; |
1827 | 1866 |
1828 // Set new page scale on impl thread by pinching. | 1867 // Set new page scale on impl thread by pinching. |
| 1868 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); |
1829 host_impl_->PinchGestureBegin(); | 1869 host_impl_->PinchGestureBegin(); |
1830 host_impl_->PinchGestureUpdate(new_page_scale, gfx::Point()); | 1870 host_impl_->PinchGestureUpdate(new_page_scale, gfx::Point()); |
1831 host_impl_->PinchGestureEnd(); | 1871 host_impl_->PinchGestureEnd(); |
| 1872 host_impl_->ScrollEnd(); |
1832 DrawOneFrame(); | 1873 DrawOneFrame(); |
1833 | 1874 |
1834 EXPECT_EQ(1.f, root->contents_scale_x()); | 1875 EXPECT_EQ(1.f, root->contents_scale_x()); |
1835 EXPECT_EQ(1.f, root->contents_scale_y()); | 1876 EXPECT_EQ(1.f, root->contents_scale_y()); |
1836 EXPECT_EQ(1.f, scroll->contents_scale_x()); | 1877 EXPECT_EQ(1.f, scroll->contents_scale_x()); |
1837 EXPECT_EQ(1.f, scroll->contents_scale_y()); | 1878 EXPECT_EQ(1.f, scroll->contents_scale_y()); |
1838 EXPECT_EQ(1.f, child->contents_scale_x()); | 1879 EXPECT_EQ(1.f, child->contents_scale_x()); |
1839 EXPECT_EQ(1.f, child->contents_scale_y()); | 1880 EXPECT_EQ(1.f, child->contents_scale_y()); |
1840 EXPECT_EQ(1.f, grand_child->contents_scale_x()); | 1881 EXPECT_EQ(1.f, grand_child->contents_scale_x()); |
1841 EXPECT_EQ(1.f, grand_child->contents_scale_y()); | 1882 EXPECT_EQ(1.f, grand_child->contents_scale_y()); |
(...skipping 4434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6276 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6317 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6277 EXPECT_EQ(0u, context3d->NumTextures()); | 6318 EXPECT_EQ(0u, context3d->NumTextures()); |
6278 | 6319 |
6279 // Should not change state for multiple deletion on one UIResourceId | 6320 // Should not change state for multiple deletion on one UIResourceId |
6280 host_impl_->DeleteUIResource(ui_resource_id); | 6321 host_impl_->DeleteUIResource(ui_resource_id); |
6281 EXPECT_EQ(0u, context3d->NumTextures()); | 6322 EXPECT_EQ(0u, context3d->NumTextures()); |
6282 } | 6323 } |
6283 | 6324 |
6284 } // namespace | 6325 } // namespace |
6285 } // namespace cc | 6326 } // namespace cc |
OLD | NEW |