Chromium Code Reviews| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 | 282 |
| 283 scoped_ptr<LayerImpl> root = | 283 scoped_ptr<LayerImpl> root = |
| 284 LayerImpl::Create(layer_tree_impl, 1); | 284 LayerImpl::Create(layer_tree_impl, 1); |
| 285 root->SetBounds(content_size); | 285 root->SetBounds(content_size); |
| 286 root->SetPosition(gfx::PointF()); | 286 root->SetPosition(gfx::PointF()); |
| 287 root->SetForceRenderSurface(true); | 287 root->SetForceRenderSurface(true); |
| 288 | 288 |
| 289 scoped_ptr<LayerImpl> inner_scroll = | 289 scoped_ptr<LayerImpl> inner_scroll = |
| 290 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 290 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
| 291 inner_scroll->SetIsContainerForFixedPositionLayers(true); | 291 inner_scroll->SetIsContainerForFixedPositionLayers(true); |
| 292 inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 292 inner_scroll->layer_tree_impl() |
| 293 ->property_trees() | |
| 294 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), | |
| 295 gfx::ScrollOffset()); | |
| 293 | 296 |
| 294 scoped_ptr<LayerImpl> inner_clip = | 297 scoped_ptr<LayerImpl> inner_clip = |
| 295 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 298 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
| 296 inner_clip->SetBounds( | 299 inner_clip->SetBounds( |
| 297 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 300 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
| 298 | 301 |
| 299 scoped_ptr<LayerImpl> page_scale = | 302 scoped_ptr<LayerImpl> page_scale = |
| 300 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 303 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
| 301 | 304 |
| 302 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 305 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
| 303 inner_scroll->SetBounds(content_size); | 306 inner_scroll->SetBounds(content_size); |
| 304 inner_scroll->SetPosition(gfx::PointF()); | 307 inner_scroll->SetPosition(gfx::PointF()); |
| 305 | 308 |
| 306 scoped_ptr<LayerImpl> outer_clip = | 309 scoped_ptr<LayerImpl> outer_clip = |
| 307 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 310 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
| 308 outer_clip->SetBounds(content_size); | 311 outer_clip->SetBounds(content_size); |
| 309 outer_clip->SetIsContainerForFixedPositionLayers(true); | 312 outer_clip->SetIsContainerForFixedPositionLayers(true); |
| 310 | 313 |
| 311 scoped_ptr<LayerImpl> outer_scroll = | 314 scoped_ptr<LayerImpl> outer_scroll = |
| 312 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 315 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
| 313 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 316 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
| 314 outer_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 317 outer_scroll->layer_tree_impl() |
| 318 ->property_trees() | |
| 319 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | |
| 320 gfx::ScrollOffset()); | |
| 315 outer_scroll->SetBounds(content_size); | 321 outer_scroll->SetBounds(content_size); |
| 316 outer_scroll->SetPosition(gfx::PointF()); | 322 outer_scroll->SetPosition(gfx::PointF()); |
| 317 | 323 |
| 318 scoped_ptr<LayerImpl> contents = | 324 scoped_ptr<LayerImpl> contents = |
| 319 LayerImpl::Create(layer_tree_impl, kContentLayerId); | 325 LayerImpl::Create(layer_tree_impl, kContentLayerId); |
| 320 contents->SetDrawsContent(true); | 326 contents->SetDrawsContent(true); |
| 321 contents->SetBounds(content_size); | 327 contents->SetBounds(content_size); |
| 322 contents->SetPosition(gfx::PointF()); | 328 contents->SetPosition(gfx::PointF()); |
| 323 | 329 |
| 324 outer_scroll->AddChild(std::move(contents)); | 330 outer_scroll->AddChild(std::move(contents)); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { | 458 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { |
| 453 return FakeOutputSurface::Create3d(); | 459 return FakeOutputSurface::Create3d(); |
| 454 } | 460 } |
| 455 | 461 |
| 456 void DrawOneFrame() { | 462 void DrawOneFrame() { |
| 457 LayerTreeHostImpl::FrameData frame_data; | 463 LayerTreeHostImpl::FrameData frame_data; |
| 458 PrepareToDrawFrame(&frame_data); | 464 PrepareToDrawFrame(&frame_data); |
| 459 host_impl_->DidDrawAllLayers(frame_data); | 465 host_impl_->DidDrawAllLayers(frame_data); |
| 460 } | 466 } |
| 461 | 467 |
| 468 void SetScrollOffsetDelta(LayerImpl* layer_impl, | |
|
ajuma
2016/03/07 19:10:19
This can be static.
sunxd
2016/03/09 01:51:20
Done.
| |
| 469 const gfx::Vector2dF& delta) { | |
| 470 layer_impl->SetCurrentScrollOffset( | |
| 471 layer_impl->synced_scroll_offset()->ActiveBase() + | |
| 472 gfx::ScrollOffset(delta)); | |
| 473 } | |
| 474 | |
| 462 FakeImplTaskRunnerProvider task_runner_provider_; | 475 FakeImplTaskRunnerProvider task_runner_provider_; |
| 463 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 476 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
| 464 | 477 |
| 465 TestSharedBitmapManager shared_bitmap_manager_; | 478 TestSharedBitmapManager shared_bitmap_manager_; |
| 466 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 479 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
| 467 TestTaskGraphRunner task_graph_runner_; | 480 TestTaskGraphRunner task_graph_runner_; |
| 468 scoped_ptr<OutputSurface> output_surface_; | 481 scoped_ptr<OutputSurface> output_surface_; |
| 469 scoped_ptr<LayerTreeHostImpl> host_impl_; | 482 scoped_ptr<LayerTreeHostImpl> host_impl_; |
| 470 FakeRenderingStatsInstrumentation stats_instrumentation_; | 483 FakeRenderingStatsInstrumentation stats_instrumentation_; |
| 471 bool on_can_draw_state_changed_called_; | 484 bool on_can_draw_state_changed_called_; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 { | 606 { |
| 594 scoped_ptr<LayerImpl> root_clip = | 607 scoped_ptr<LayerImpl> root_clip = |
| 595 LayerImpl::Create(host_impl_->active_tree(), 2); | 608 LayerImpl::Create(host_impl_->active_tree(), 2); |
| 596 scoped_ptr<LayerImpl> root = | 609 scoped_ptr<LayerImpl> root = |
| 597 LayerImpl::Create(host_impl_->active_tree(), 1); | 610 LayerImpl::Create(host_impl_->active_tree(), 1); |
| 598 root_clip->SetBounds(gfx::Size(10, 10)); | 611 root_clip->SetBounds(gfx::Size(10, 10)); |
| 599 LayerImpl* root_layer = root.get(); | 612 LayerImpl* root_layer = root.get(); |
| 600 root_clip->AddChild(std::move(root)); | 613 root_clip->AddChild(std::move(root)); |
| 601 root_layer->SetBounds(gfx::Size(110, 110)); | 614 root_layer->SetBounds(gfx::Size(110, 110)); |
| 602 root_layer->SetScrollClipLayer(root_clip->id()); | 615 root_layer->SetScrollClipLayer(root_clip->id()); |
| 603 root_layer->PushScrollOffsetFromMainThread(scroll_offset); | 616 root_layer->layer_tree_impl() |
| 617 ->property_trees() | |
| 618 ->scroll_tree.UpdateScrollOffsetBaseForTesting(root_layer->id(), | |
| 619 scroll_offset); | |
| 604 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); | 620 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); |
| 605 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 621 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 606 root_layer->ScrollBy(scroll_delta); | 622 root_layer->ScrollBy(scroll_delta); |
| 607 } | 623 } |
| 608 | 624 |
| 609 LayerImpl* root = | 625 LayerImpl* root = |
| 610 host_impl_->active_tree()->root_layer()->children()[0].get(); | 626 host_impl_->active_tree()->root_layer()->children()[0].get(); |
| 611 | 627 |
| 612 scoped_ptr<ScrollAndScaleSet> scroll_info; | 628 scoped_ptr<ScrollAndScaleSet> scroll_info; |
| 613 | 629 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1125 | 1141 |
| 1126 TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { | 1142 TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { |
| 1127 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 1143 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
| 1128 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 1144 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 1129 | 1145 |
| 1130 gfx::Size overflow_size(400, 400); | 1146 gfx::Size overflow_size(400, 400); |
| 1131 ASSERT_EQ(1u, scroll_layer->children().size()); | 1147 ASSERT_EQ(1u, scroll_layer->children().size()); |
| 1132 LayerImpl* overflow = scroll_layer->children()[0].get(); | 1148 LayerImpl* overflow = scroll_layer->children()[0].get(); |
| 1133 overflow->SetBounds(overflow_size); | 1149 overflow->SetBounds(overflow_size); |
| 1134 overflow->SetScrollClipLayer(scroll_layer->parent()->parent()->id()); | 1150 overflow->SetScrollClipLayer(scroll_layer->parent()->parent()->id()); |
| 1135 overflow->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 1151 overflow->layer_tree_impl() |
| 1152 ->property_trees() | |
| 1153 ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), | |
| 1154 gfx::ScrollOffset()); | |
| 1136 overflow->SetPosition(gfx::PointF()); | 1155 overflow->SetPosition(gfx::PointF()); |
| 1137 | 1156 |
| 1138 SetNeedsRebuildPropertyTrees(); | 1157 SetNeedsRebuildPropertyTrees(); |
| 1139 DrawFrame(); | 1158 DrawFrame(); |
| 1140 gfx::Point scroll_position(10, 10); | 1159 gfx::Point scroll_position(10, 10); |
| 1141 | 1160 |
| 1142 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 1161 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 1143 host_impl_->ScrollBegin(BeginState(scroll_position).get(), | 1162 host_impl_->ScrollBegin(BeginState(scroll_position).get(), |
| 1144 InputHandler::WHEEL) | 1163 InputHandler::WHEEL) |
| 1145 .thread); | 1164 .thread); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1471 EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); | 1490 EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); |
| 1472 | 1491 |
| 1473 float min_page_scale = 1.f, max_page_scale = 4.f; | 1492 float min_page_scale = 1.f, max_page_scale = 4.f; |
| 1474 float page_scale_factor = 1.f; | 1493 float page_scale_factor = 1.f; |
| 1475 | 1494 |
| 1476 // The impl-based pinch zoom should adjust the max scroll position. | 1495 // The impl-based pinch zoom should adjust the max scroll position. |
| 1477 { | 1496 { |
| 1478 host_impl_->active_tree()->PushPageScaleFromMainThread( | 1497 host_impl_->active_tree()->PushPageScaleFromMainThread( |
| 1479 page_scale_factor, min_page_scale, max_page_scale); | 1498 page_scale_factor, min_page_scale, max_page_scale); |
| 1480 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 1499 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 1481 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 1500 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 1482 | 1501 |
| 1483 float page_scale_delta = 2.f; | 1502 float page_scale_delta = 2.f; |
| 1484 | 1503 |
| 1485 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), | 1504 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), |
| 1486 InputHandler::GESTURE); | 1505 InputHandler::GESTURE); |
| 1487 host_impl_->PinchGestureBegin(); | 1506 host_impl_->PinchGestureBegin(); |
| 1488 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 1507 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
| 1489 host_impl_->PinchGestureEnd(); | 1508 host_impl_->PinchGestureEnd(); |
| 1490 host_impl_->ScrollEnd(EndState().get()); | 1509 host_impl_->ScrollEnd(EndState().get()); |
| 1491 EXPECT_FALSE(did_request_next_frame_); | 1510 EXPECT_FALSE(did_request_next_frame_); |
| 1492 EXPECT_TRUE(did_request_redraw_); | 1511 EXPECT_TRUE(did_request_redraw_); |
| 1493 EXPECT_TRUE(did_request_commit_); | 1512 EXPECT_TRUE(did_request_commit_); |
| 1494 EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); | 1513 EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); |
| 1495 | 1514 |
| 1496 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1515 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 1497 host_impl_->ProcessScrollDeltas(); | 1516 host_impl_->ProcessScrollDeltas(); |
| 1498 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 1517 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
| 1499 | 1518 |
| 1500 EXPECT_EQ(gfx::ScrollOffset(75.0, 75.0).ToString(), | 1519 EXPECT_EQ(gfx::ScrollOffset(75.0, 75.0).ToString(), |
| 1501 scroll_layer->MaxScrollOffset().ToString()); | 1520 scroll_layer->MaxScrollOffset().ToString()); |
| 1502 } | 1521 } |
| 1503 | 1522 |
| 1504 // Scrolling after a pinch gesture should always be in local space. The | 1523 // Scrolling after a pinch gesture should always be in local space. The |
| 1505 // scroll deltas have the page scale factor applied. | 1524 // scroll deltas have the page scale factor applied. |
| 1506 { | 1525 { |
| 1507 host_impl_->active_tree()->PushPageScaleFromMainThread( | 1526 host_impl_->active_tree()->PushPageScaleFromMainThread( |
| 1508 page_scale_factor, min_page_scale, max_page_scale); | 1527 page_scale_factor, min_page_scale, max_page_scale); |
| 1509 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 1528 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 1510 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 1529 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 1511 | 1530 |
| 1512 float page_scale_delta = 2.f; | 1531 float page_scale_delta = 2.f; |
| 1513 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 1532 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 1514 InputHandler::GESTURE); | 1533 InputHandler::GESTURE); |
| 1515 host_impl_->PinchGestureBegin(); | 1534 host_impl_->PinchGestureBegin(); |
| 1516 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); | 1535 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); |
| 1517 host_impl_->PinchGestureEnd(); | 1536 host_impl_->PinchGestureEnd(); |
| 1518 host_impl_->ScrollEnd(EndState().get()); | 1537 host_impl_->ScrollEnd(EndState().get()); |
| 1519 | 1538 |
| 1520 gfx::Vector2d scroll_delta(0, 10); | 1539 gfx::Vector2d scroll_delta(0, 10); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 host_impl_->PinchGestureUpdate(2, anchor); | 1758 host_impl_->PinchGestureUpdate(2, anchor); |
| 1740 host_impl_->PinchGestureEnd(); | 1759 host_impl_->PinchGestureEnd(); |
| 1741 host_impl_->ScrollEnd(EndState().get()); | 1760 host_impl_->ScrollEnd(EndState().get()); |
| 1742 | 1761 |
| 1743 EXPECT_VECTOR_EQ( | 1762 EXPECT_VECTOR_EQ( |
| 1744 gfx::Vector2dF(250, 250), | 1763 gfx::Vector2dF(250, 250), |
| 1745 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); | 1764 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); |
| 1746 | 1765 |
| 1747 // Reset. | 1766 // Reset. |
| 1748 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); | 1767 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); |
| 1749 host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1768 SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); |
| 1750 host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1769 SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); |
| 1751 | 1770 |
| 1752 // Pinch in within the margins. The scroll should stay exactly locked to the | 1771 // Pinch in within the margins. The scroll should stay exactly locked to the |
| 1753 // top and left. | 1772 // top and left. |
| 1754 anchor = gfx::Point(offsetFromEdge, offsetFromEdge); | 1773 anchor = gfx::Point(offsetFromEdge, offsetFromEdge); |
| 1755 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); | 1774 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); |
| 1756 host_impl_->PinchGestureBegin(); | 1775 host_impl_->PinchGestureBegin(); |
| 1757 host_impl_->PinchGestureUpdate(2, anchor); | 1776 host_impl_->PinchGestureUpdate(2, anchor); |
| 1758 host_impl_->PinchGestureEnd(); | 1777 host_impl_->PinchGestureEnd(); |
| 1759 host_impl_->ScrollEnd(EndState().get()); | 1778 host_impl_->ScrollEnd(EndState().get()); |
| 1760 | 1779 |
| 1761 EXPECT_VECTOR_EQ( | 1780 EXPECT_VECTOR_EQ( |
| 1762 gfx::Vector2dF(0, 0), | 1781 gfx::Vector2dF(0, 0), |
| 1763 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); | 1782 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); |
| 1764 | 1783 |
| 1765 // Reset. | 1784 // Reset. |
| 1766 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); | 1785 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); |
| 1767 host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1786 SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); |
| 1768 host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1787 SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); |
| 1769 | 1788 |
| 1770 // Pinch in just outside the margin. There should be no snapping. | 1789 // Pinch in just outside the margin. There should be no snapping. |
| 1771 offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; | 1790 offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; |
| 1772 anchor = gfx::Point(offsetFromEdge, offsetFromEdge); | 1791 anchor = gfx::Point(offsetFromEdge, offsetFromEdge); |
| 1773 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); | 1792 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); |
| 1774 host_impl_->PinchGestureBegin(); | 1793 host_impl_->PinchGestureBegin(); |
| 1775 host_impl_->PinchGestureUpdate(2, anchor); | 1794 host_impl_->PinchGestureUpdate(2, anchor); |
| 1776 host_impl_->PinchGestureEnd(); | 1795 host_impl_->PinchGestureEnd(); |
| 1777 host_impl_->ScrollEnd(EndState().get()); | 1796 host_impl_->ScrollEnd(EndState().get()); |
| 1778 | 1797 |
| 1779 EXPECT_VECTOR_EQ( | 1798 EXPECT_VECTOR_EQ( |
| 1780 gfx::Vector2dF(50, 50), | 1799 gfx::Vector2dF(50, 50), |
| 1781 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); | 1800 host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset()); |
| 1782 | 1801 |
| 1783 // Reset. | 1802 // Reset. |
| 1784 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); | 1803 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); |
| 1785 host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1804 SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); |
| 1786 host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); | 1805 SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); |
| 1787 | 1806 |
| 1788 // Pinch in just outside the margin. There should be no snapping. | 1807 // Pinch in just outside the margin. There should be no snapping. |
| 1789 offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; | 1808 offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; |
| 1790 anchor = gfx::Point(viewport_size.width() - offsetFromEdge, | 1809 anchor = gfx::Point(viewport_size.width() - offsetFromEdge, |
| 1791 viewport_size.height() - offsetFromEdge); | 1810 viewport_size.height() - offsetFromEdge); |
| 1792 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); | 1811 host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE); |
| 1793 host_impl_->PinchGestureBegin(); | 1812 host_impl_->PinchGestureBegin(); |
| 1794 host_impl_->PinchGestureUpdate(2, anchor); | 1813 host_impl_->PinchGestureUpdate(2, anchor); |
| 1795 host_impl_->PinchGestureEnd(); | 1814 host_impl_->PinchGestureEnd(); |
| 1796 host_impl_->ScrollEnd(EndState().get()); | 1815 host_impl_->ScrollEnd(EndState().get()); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1984 LayerImpl* scroll_layer = host_impl_->InnerViewportScrollLayer(); | 2003 LayerImpl* scroll_layer = host_impl_->InnerViewportScrollLayer(); |
| 1985 DCHECK(scroll_layer); | 2004 DCHECK(scroll_layer); |
| 1986 | 2005 |
| 1987 float min_page_scale = 1.f; | 2006 float min_page_scale = 1.f; |
| 1988 float max_page_scale = 4.f; | 2007 float max_page_scale = 4.f; |
| 1989 | 2008 |
| 1990 // Basic pinch zoom in gesture | 2009 // Basic pinch zoom in gesture |
| 1991 { | 2010 { |
| 1992 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2011 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 1993 max_page_scale); | 2012 max_page_scale); |
| 1994 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2013 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 1995 | 2014 |
| 1996 float page_scale_delta = 2.f; | 2015 float page_scale_delta = 2.f; |
| 1997 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), | 2016 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), |
| 1998 InputHandler::GESTURE); | 2017 InputHandler::GESTURE); |
| 1999 host_impl_->PinchGestureBegin(); | 2018 host_impl_->PinchGestureBegin(); |
| 2000 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 2019 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
| 2001 host_impl_->PinchGestureEnd(); | 2020 host_impl_->PinchGestureEnd(); |
| 2002 host_impl_->ScrollEnd(EndState().get()); | 2021 host_impl_->ScrollEnd(EndState().get()); |
| 2003 EXPECT_FALSE(did_request_next_frame_); | 2022 EXPECT_FALSE(did_request_next_frame_); |
| 2004 EXPECT_TRUE(did_request_redraw_); | 2023 EXPECT_TRUE(did_request_redraw_); |
| 2005 EXPECT_TRUE(did_request_commit_); | 2024 EXPECT_TRUE(did_request_commit_); |
| 2006 | 2025 |
| 2007 scoped_ptr<ScrollAndScaleSet> scroll_info = | 2026 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 2008 host_impl_->ProcessScrollDeltas(); | 2027 host_impl_->ProcessScrollDeltas(); |
| 2009 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 2028 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
| 2010 } | 2029 } |
| 2011 | 2030 |
| 2012 // Zoom-in clamping | 2031 // Zoom-in clamping |
| 2013 { | 2032 { |
| 2014 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2033 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2015 max_page_scale); | 2034 max_page_scale); |
| 2016 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2035 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 2017 float page_scale_delta = 10.f; | 2036 float page_scale_delta = 10.f; |
| 2018 | 2037 |
| 2019 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), | 2038 host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), |
| 2020 InputHandler::GESTURE); | 2039 InputHandler::GESTURE); |
| 2021 host_impl_->PinchGestureBegin(); | 2040 host_impl_->PinchGestureBegin(); |
| 2022 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); | 2041 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50)); |
| 2023 host_impl_->PinchGestureEnd(); | 2042 host_impl_->PinchGestureEnd(); |
| 2024 host_impl_->ScrollEnd(EndState().get()); | 2043 host_impl_->ScrollEnd(EndState().get()); |
| 2025 | 2044 |
| 2026 scoped_ptr<ScrollAndScaleSet> scroll_info = | 2045 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 2027 host_impl_->ProcessScrollDeltas(); | 2046 host_impl_->ProcessScrollDeltas(); |
| 2028 EXPECT_EQ(scroll_info->page_scale_delta, max_page_scale); | 2047 EXPECT_EQ(scroll_info->page_scale_delta, max_page_scale); |
| 2029 } | 2048 } |
| 2030 | 2049 |
| 2031 // Zoom-out clamping | 2050 // Zoom-out clamping |
| 2032 { | 2051 { |
| 2033 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2052 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2034 max_page_scale); | 2053 max_page_scale); |
| 2035 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2054 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 2036 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); | 2055 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); |
| 2037 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2056 scroll_layer->layer_tree_impl() |
| 2057 ->property_trees() | |
| 2058 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2059 scroll_layer->id(), gfx::ScrollOffset(50, 50)); | |
| 2038 | 2060 |
| 2039 float page_scale_delta = 0.1f; | 2061 float page_scale_delta = 0.1f; |
| 2040 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 2062 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 2041 InputHandler::GESTURE); | 2063 InputHandler::GESTURE); |
| 2042 host_impl_->PinchGestureBegin(); | 2064 host_impl_->PinchGestureBegin(); |
| 2043 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); | 2065 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); |
| 2044 host_impl_->PinchGestureEnd(); | 2066 host_impl_->PinchGestureEnd(); |
| 2045 host_impl_->ScrollEnd(EndState().get()); | 2067 host_impl_->ScrollEnd(EndState().get()); |
| 2046 | 2068 |
| 2047 scoped_ptr<ScrollAndScaleSet> scroll_info = | 2069 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 2048 host_impl_->ProcessScrollDeltas(); | 2070 host_impl_->ProcessScrollDeltas(); |
| 2049 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); | 2071 EXPECT_EQ(scroll_info->page_scale_delta, min_page_scale); |
| 2050 | 2072 |
| 2051 EXPECT_TRUE(scroll_info->scrolls.empty()); | 2073 EXPECT_TRUE(scroll_info->scrolls.empty()); |
| 2052 } | 2074 } |
| 2053 | 2075 |
| 2054 // Two-finger panning should not happen based on pinch events only | 2076 // Two-finger panning should not happen based on pinch events only |
| 2055 { | 2077 { |
| 2056 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2078 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2057 max_page_scale); | 2079 max_page_scale); |
| 2058 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2080 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 2059 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); | 2081 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); |
| 2060 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); | 2082 scroll_layer->layer_tree_impl() |
| 2083 ->property_trees() | |
| 2084 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2085 scroll_layer->id(), gfx::ScrollOffset(20, 20)); | |
| 2061 | 2086 |
| 2062 float page_scale_delta = 1.f; | 2087 float page_scale_delta = 1.f; |
| 2063 host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), | 2088 host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), |
| 2064 InputHandler::GESTURE); | 2089 InputHandler::GESTURE); |
| 2065 host_impl_->PinchGestureBegin(); | 2090 host_impl_->PinchGestureBegin(); |
| 2066 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); | 2091 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); |
| 2067 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); | 2092 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); |
| 2068 host_impl_->PinchGestureEnd(); | 2093 host_impl_->PinchGestureEnd(); |
| 2069 host_impl_->ScrollEnd(EndState().get()); | 2094 host_impl_->ScrollEnd(EndState().get()); |
| 2070 | 2095 |
| 2071 scoped_ptr<ScrollAndScaleSet> scroll_info = | 2096 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 2072 host_impl_->ProcessScrollDeltas(); | 2097 host_impl_->ProcessScrollDeltas(); |
| 2073 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 2098 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
| 2074 EXPECT_TRUE(scroll_info->scrolls.empty()); | 2099 EXPECT_TRUE(scroll_info->scrolls.empty()); |
| 2075 } | 2100 } |
| 2076 | 2101 |
| 2077 // Two-finger panning should work with interleaved scroll events | 2102 // Two-finger panning should work with interleaved scroll events |
| 2078 { | 2103 { |
| 2079 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2104 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2080 max_page_scale); | 2105 max_page_scale); |
| 2081 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2106 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 2082 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); | 2107 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); |
| 2083 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); | 2108 scroll_layer->layer_tree_impl() |
| 2109 ->property_trees() | |
| 2110 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2111 scroll_layer->id(), gfx::ScrollOffset(20, 20)); | |
| 2084 | 2112 |
| 2085 float page_scale_delta = 1.f; | 2113 float page_scale_delta = 1.f; |
| 2086 host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), | 2114 host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), |
| 2087 InputHandler::GESTURE); | 2115 InputHandler::GESTURE); |
| 2088 host_impl_->PinchGestureBegin(); | 2116 host_impl_->PinchGestureBegin(); |
| 2089 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); | 2117 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10)); |
| 2090 host_impl_->ScrollBy( | 2118 host_impl_->ScrollBy( |
| 2091 UpdateState(gfx::Point(10, 10), gfx::Vector2d(-10, -10)).get()); | 2119 UpdateState(gfx::Point(10, 10), gfx::Vector2d(-10, -10)).get()); |
| 2092 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); | 2120 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20)); |
| 2093 host_impl_->PinchGestureEnd(); | 2121 host_impl_->PinchGestureEnd(); |
| 2094 host_impl_->ScrollEnd(EndState().get()); | 2122 host_impl_->ScrollEnd(EndState().get()); |
| 2095 | 2123 |
| 2096 scoped_ptr<ScrollAndScaleSet> scroll_info = | 2124 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 2097 host_impl_->ProcessScrollDeltas(); | 2125 host_impl_->ProcessScrollDeltas(); |
| 2098 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); | 2126 EXPECT_EQ(scroll_info->page_scale_delta, page_scale_delta); |
| 2099 EXPECT_TRUE(ScrollInfoContains(*scroll_info, scroll_layer->id(), | 2127 EXPECT_TRUE(ScrollInfoContains(*scroll_info, scroll_layer->id(), |
| 2100 gfx::Vector2d(-10, -10))); | 2128 gfx::Vector2d(-10, -10))); |
| 2101 } | 2129 } |
| 2102 | 2130 |
| 2103 // Two-finger panning should work when starting fully zoomed out. | 2131 // Two-finger panning should work when starting fully zoomed out. |
| 2104 { | 2132 { |
| 2105 host_impl_->active_tree()->PushPageScaleFromMainThread(0.5f, 0.5f, 4.f); | 2133 host_impl_->active_tree()->PushPageScaleFromMainThread(0.5f, 0.5f, 4.f); |
| 2106 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 2134 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 2107 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); | 2135 scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); |
| 2108 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 0)); | 2136 scroll_layer->layer_tree_impl() |
| 2137 ->property_trees() | |
| 2138 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 2139 gfx::ScrollOffset(0, 0)); | |
| 2109 | 2140 |
| 2110 host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), | 2141 host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), |
| 2111 InputHandler::GESTURE); | 2142 InputHandler::GESTURE); |
| 2112 host_impl_->PinchGestureBegin(); | 2143 host_impl_->PinchGestureBegin(); |
| 2113 host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0)); | 2144 host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0)); |
| 2114 host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0)); | 2145 host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0)); |
| 2115 | 2146 |
| 2116 // Needed so layer transform includes page scale. | 2147 // Needed so layer transform includes page scale. |
| 2117 DrawFrame(); | 2148 DrawFrame(); |
| 2118 | 2149 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2146 base::TimeTicks halfway_through_animation = start_time + duration / 2; | 2177 base::TimeTicks halfway_through_animation = start_time + duration / 2; |
| 2147 base::TimeTicks end_time = start_time + duration; | 2178 base::TimeTicks end_time = start_time + duration; |
| 2148 | 2179 |
| 2149 BeginFrameArgs begin_frame_args = | 2180 BeginFrameArgs begin_frame_args = |
| 2150 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 2181 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 2151 | 2182 |
| 2152 // Non-anchor zoom-in | 2183 // Non-anchor zoom-in |
| 2153 { | 2184 { |
| 2154 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2185 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2155 max_page_scale); | 2186 max_page_scale); |
| 2156 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2187 scroll_layer->layer_tree_impl() |
| 2188 ->property_trees() | |
| 2189 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2190 scroll_layer->id(), gfx::ScrollOffset(50, 50)); | |
| 2157 | 2191 |
| 2158 did_request_redraw_ = false; | 2192 did_request_redraw_ = false; |
| 2159 did_request_next_frame_ = false; | 2193 did_request_next_frame_ = false; |
| 2160 host_impl_->active_tree()->SetPendingPageScaleAnimation( | 2194 host_impl_->active_tree()->SetPendingPageScaleAnimation( |
| 2161 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( | 2195 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( |
| 2162 gfx::Vector2d(), | 2196 gfx::Vector2d(), |
| 2163 false, | 2197 false, |
| 2164 2.f, | 2198 2.f, |
| 2165 duration))); | 2199 duration))); |
| 2166 host_impl_->ActivateSyncTree(); | 2200 host_impl_->ActivateSyncTree(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2203 } | 2237 } |
| 2204 | 2238 |
| 2205 start_time += base::TimeDelta::FromSeconds(10); | 2239 start_time += base::TimeDelta::FromSeconds(10); |
| 2206 halfway_through_animation += base::TimeDelta::FromSeconds(10); | 2240 halfway_through_animation += base::TimeDelta::FromSeconds(10); |
| 2207 end_time += base::TimeDelta::FromSeconds(10); | 2241 end_time += base::TimeDelta::FromSeconds(10); |
| 2208 | 2242 |
| 2209 // Anchor zoom-out | 2243 // Anchor zoom-out |
| 2210 { | 2244 { |
| 2211 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2245 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2212 max_page_scale); | 2246 max_page_scale); |
| 2213 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2247 scroll_layer->layer_tree_impl() |
| 2248 ->property_trees() | |
| 2249 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2250 scroll_layer->id(), gfx::ScrollOffset(50, 50)); | |
| 2214 | 2251 |
| 2215 did_request_redraw_ = false; | 2252 did_request_redraw_ = false; |
| 2216 did_request_next_frame_ = false; | 2253 did_request_next_frame_ = false; |
| 2217 host_impl_->active_tree()->SetPendingPageScaleAnimation( | 2254 host_impl_->active_tree()->SetPendingPageScaleAnimation( |
| 2218 scoped_ptr<PendingPageScaleAnimation> (new PendingPageScaleAnimation( | 2255 scoped_ptr<PendingPageScaleAnimation> (new PendingPageScaleAnimation( |
| 2219 gfx::Vector2d(25, 25), | 2256 gfx::Vector2d(25, 25), |
| 2220 true, | 2257 true, |
| 2221 min_page_scale, | 2258 min_page_scale, |
| 2222 duration))); | 2259 duration))); |
| 2223 host_impl_->ActivateSyncTree(); | 2260 host_impl_->ActivateSyncTree(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2269 base::TimeTicks halfway_through_animation = start_time + duration / 2; | 2306 base::TimeTicks halfway_through_animation = start_time + duration / 2; |
| 2270 base::TimeTicks end_time = start_time + duration; | 2307 base::TimeTicks end_time = start_time + duration; |
| 2271 | 2308 |
| 2272 BeginFrameArgs begin_frame_args = | 2309 BeginFrameArgs begin_frame_args = |
| 2273 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 2310 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 2274 | 2311 |
| 2275 // Anchor zoom with unchanged page scale should not change scroll or scale. | 2312 // Anchor zoom with unchanged page scale should not change scroll or scale. |
| 2276 { | 2313 { |
| 2277 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, | 2314 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, |
| 2278 max_page_scale); | 2315 max_page_scale); |
| 2279 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2316 scroll_layer->layer_tree_impl() |
| 2317 ->property_trees() | |
| 2318 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2319 scroll_layer->id(), gfx::ScrollOffset(50, 50)); | |
| 2280 | 2320 |
| 2281 host_impl_->active_tree()->SetPendingPageScaleAnimation( | 2321 host_impl_->active_tree()->SetPendingPageScaleAnimation( |
| 2282 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( | 2322 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( |
| 2283 gfx::Vector2d(), | 2323 gfx::Vector2d(), |
| 2284 true, | 2324 true, |
| 2285 1.f, | 2325 1.f, |
| 2286 duration))); | 2326 duration))); |
| 2287 host_impl_->ActivateSyncTree(); | 2327 host_impl_->ActivateSyncTree(); |
| 2288 begin_frame_args.frame_time = start_time; | 2328 begin_frame_args.frame_time = start_time; |
| 2289 host_impl_->WillBeginImplFrame(begin_frame_args); | 2329 host_impl_->WillBeginImplFrame(begin_frame_args); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2332 base::TimeDelta::FromSeconds(1); | 2372 base::TimeDelta::FromSeconds(1); |
| 2333 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); | 2373 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
| 2334 base::TimeTicks third_through_animation = start_time + duration / 3; | 2374 base::TimeTicks third_through_animation = start_time + duration / 3; |
| 2335 base::TimeTicks halfway_through_animation = start_time + duration / 2; | 2375 base::TimeTicks halfway_through_animation = start_time + duration / 2; |
| 2336 base::TimeTicks end_time = start_time + duration; | 2376 base::TimeTicks end_time = start_time + duration; |
| 2337 float target_scale = 2.f; | 2377 float target_scale = 2.f; |
| 2338 | 2378 |
| 2339 BeginFrameArgs begin_frame_args = | 2379 BeginFrameArgs begin_frame_args = |
| 2340 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 2380 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 2341 | 2381 |
| 2342 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2382 scroll_layer->layer_tree_impl() |
| 2383 ->property_trees() | |
| 2384 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 2385 gfx::ScrollOffset(50, 50)); | |
| 2343 | 2386 |
| 2344 // Make sure TakePageScaleAnimation works properly. | 2387 // Make sure TakePageScaleAnimation works properly. |
| 2345 | 2388 |
| 2346 host_impl_->sync_tree()->SetPendingPageScaleAnimation( | 2389 host_impl_->sync_tree()->SetPendingPageScaleAnimation( |
| 2347 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( | 2390 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( |
| 2348 gfx::Vector2d(), | 2391 gfx::Vector2d(), |
| 2349 false, | 2392 false, |
| 2350 target_scale, | 2393 target_scale, |
| 2351 duration))); | 2394 duration))); |
| 2352 scoped_ptr<PendingPageScaleAnimation> psa = | 2395 scoped_ptr<PendingPageScaleAnimation> psa = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2444 base::TimeTicks start_time = | 2487 base::TimeTicks start_time = |
| 2445 base::TimeTicks() + base::TimeDelta::FromSeconds(1); | 2488 base::TimeTicks() + base::TimeDelta::FromSeconds(1); |
| 2446 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); | 2489 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); |
| 2447 base::TimeTicks halfway_through_animation = start_time + duration / 2; | 2490 base::TimeTicks halfway_through_animation = start_time + duration / 2; |
| 2448 base::TimeTicks end_time = start_time + duration; | 2491 base::TimeTicks end_time = start_time + duration; |
| 2449 | 2492 |
| 2450 BeginFrameArgs begin_frame_args = | 2493 BeginFrameArgs begin_frame_args = |
| 2451 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 2494 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 2452 | 2495 |
| 2453 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); | 2496 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); |
| 2454 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); | 2497 scroll_layer->layer_tree_impl() |
| 2498 ->property_trees() | |
| 2499 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 2500 gfx::ScrollOffset(50, 50)); | |
| 2455 | 2501 |
| 2456 did_complete_page_scale_animation_ = false; | 2502 did_complete_page_scale_animation_ = false; |
| 2457 host_impl_->active_tree()->SetPendingPageScaleAnimation( | 2503 host_impl_->active_tree()->SetPendingPageScaleAnimation( |
| 2458 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( | 2504 scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( |
| 2459 gfx::Vector2d(), false, 2.f, duration))); | 2505 gfx::Vector2d(), false, 2.f, duration))); |
| 2460 host_impl_->ActivateSyncTree(); | 2506 host_impl_->ActivateSyncTree(); |
| 2461 begin_frame_args.frame_time = start_time; | 2507 begin_frame_args.frame_time = start_time; |
| 2462 host_impl_->WillBeginImplFrame(begin_frame_args); | 2508 host_impl_->WillBeginImplFrame(begin_frame_args); |
| 2463 host_impl_->Animate(); | 2509 host_impl_->Animate(); |
| 2464 EXPECT_FALSE(did_complete_page_scale_animation_); | 2510 EXPECT_FALSE(did_complete_page_scale_animation_); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2654 EXPECT_TRUE(did_request_next_frame_); | 2700 EXPECT_TRUE(did_request_next_frame_); |
| 2655 did_request_next_frame_ = false; | 2701 did_request_next_frame_ = false; |
| 2656 EXPECT_TRUE(did_request_redraw_); | 2702 EXPECT_TRUE(did_request_redraw_); |
| 2657 did_request_redraw_ = false; | 2703 did_request_redraw_ = false; |
| 2658 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); | 2704 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); |
| 2659 EXPECT_TRUE(animation_task_.Equals(base::Closure())); | 2705 EXPECT_TRUE(animation_task_.Equals(base::Closure())); |
| 2660 host_impl_->DidFinishImplFrame(); | 2706 host_impl_->DidFinishImplFrame(); |
| 2661 | 2707 |
| 2662 // Setting the scroll offset outside a scroll should also cause the | 2708 // Setting the scroll offset outside a scroll should also cause the |
| 2663 // scrollbar to appear and to schedule a scrollbar animation. | 2709 // scrollbar to appear and to schedule a scrollbar animation. |
| 2664 host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread( | 2710 if (host_impl_->active_tree() |
| 2665 gfx::ScrollOffset(5, 5)); | 2711 ->property_trees() |
| 2712 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 2713 host_impl_->InnerViewportScrollLayer()->id(), | |
| 2714 gfx::ScrollOffset(5, 5))) | |
| 2715 host_impl_->InnerViewportScrollLayer()->DidUpdateScrollOffset(); | |
| 2666 EXPECT_FALSE(did_request_next_frame_); | 2716 EXPECT_FALSE(did_request_next_frame_); |
| 2667 EXPECT_FALSE(did_request_redraw_); | 2717 EXPECT_FALSE(did_request_redraw_); |
| 2668 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), | 2718 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), |
| 2669 requested_animation_delay_); | 2719 requested_animation_delay_); |
| 2670 EXPECT_FALSE(animation_task_.Equals(base::Closure())); | 2720 EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
| 2671 requested_animation_delay_ = base::TimeDelta(); | 2721 requested_animation_delay_ = base::TimeDelta(); |
| 2672 animation_task_ = base::Closure(); | 2722 animation_task_ = base::Closure(); |
| 2673 | 2723 |
| 2674 // Scrolling should have stopped the animation, so we should not be getting | 2724 // Scrolling should have stopped the animation, so we should not be getting |
| 2675 // redraws. | 2725 // redraws. |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3685 gfx::Size(100, 100)); | 3735 gfx::Size(100, 100)); |
| 3686 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 3736 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
| 3687 host_impl_->ActivateSyncTree(); | 3737 host_impl_->ActivateSyncTree(); |
| 3688 | 3738 |
| 3689 host_impl_->CreatePendingTree(); | 3739 host_impl_->CreatePendingTree(); |
| 3690 const gfx::ScrollOffset pending_scroll = gfx::ScrollOffset(-100, -100); | 3740 const gfx::ScrollOffset pending_scroll = gfx::ScrollOffset(-100, -100); |
| 3691 LayerImpl* active_outer_layer = | 3741 LayerImpl* active_outer_layer = |
| 3692 host_impl_->active_tree()->OuterViewportScrollLayer(); | 3742 host_impl_->active_tree()->OuterViewportScrollLayer(); |
| 3693 LayerImpl* pending_outer_layer = | 3743 LayerImpl* pending_outer_layer = |
| 3694 host_impl_->pending_tree()->OuterViewportScrollLayer(); | 3744 host_impl_->pending_tree()->OuterViewportScrollLayer(); |
| 3695 pending_outer_layer->PushScrollOffsetFromMainThread(pending_scroll); | 3745 pending_outer_layer->layer_tree_impl() |
| 3746 ->property_trees() | |
| 3747 ->scroll_tree.UpdateScrollOffsetBaseForTesting(pending_outer_layer->id(), | |
| 3748 pending_scroll); | |
| 3696 | 3749 |
| 3697 host_impl_->ActivateSyncTree(); | 3750 host_impl_->ActivateSyncTree(); |
| 3698 // Scrolloffsets on the active tree will be clamped after activation. | 3751 // Scrolloffsets on the active tree will be clamped after activation. |
| 3699 EXPECT_EQ(active_outer_layer->CurrentScrollOffset(), gfx::ScrollOffset(0, 0)); | 3752 EXPECT_EQ(active_outer_layer->CurrentScrollOffset(), gfx::ScrollOffset(0, 0)); |
| 3700 } | 3753 } |
| 3701 | 3754 |
| 3702 class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest { | 3755 class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest { |
| 3703 public: | 3756 public: |
| 3704 LayerTreeHostImplTopControlsTest() | 3757 LayerTreeHostImplTopControlsTest() |
| 3705 // Make the clip size the same as the layer (content) size so the layer is | 3758 // Make the clip size the same as the layer (content) size so the layer is |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4066 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 4119 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
| 4067 | 4120 |
| 4068 child_clip->SetBounds(sub_content_layer_size); | 4121 child_clip->SetBounds(sub_content_layer_size); |
| 4069 child->SetScrollClipLayer(child_clip->id()); | 4122 child->SetScrollClipLayer(child_clip->id()); |
| 4070 child->SetBounds(sub_content_size); | 4123 child->SetBounds(sub_content_size); |
| 4071 child->SetPosition(gfx::PointF()); | 4124 child->SetPosition(gfx::PointF()); |
| 4072 child->SetDrawsContent(true); | 4125 child->SetDrawsContent(true); |
| 4073 child->SetIsContainerForFixedPositionLayers(true); | 4126 child->SetIsContainerForFixedPositionLayers(true); |
| 4074 | 4127 |
| 4075 // scroll child to limit | 4128 // scroll child to limit |
| 4076 child->SetScrollDelta(gfx::Vector2dF(0, 100.f)); | 4129 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); |
| 4077 child_clip->AddChild(std::move(child)); | 4130 child_clip->AddChild(std::move(child)); |
| 4078 outer_viewport_scroll_layer->AddChild(std::move(child_clip)); | 4131 outer_viewport_scroll_layer->AddChild(std::move(child_clip)); |
| 4079 | 4132 |
| 4080 // Scroll 25px to hide top controls | 4133 // Scroll 25px to hide top controls |
| 4081 gfx::Vector2dF scroll_delta(0.f, 25.f); | 4134 gfx::Vector2dF scroll_delta(0.f, 25.f); |
| 4082 host_impl_->active_tree()->property_trees()->needs_rebuild = true; | 4135 host_impl_->active_tree()->property_trees()->needs_rebuild = true; |
| 4083 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 4136 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| 4084 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 4137 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 4085 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 4138 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 4086 InputHandler::GESTURE) | 4139 InputHandler::GESTURE) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4226 SetupTopControlsAndScrollLayerWithVirtualViewport( | 4279 SetupTopControlsAndScrollLayerWithVirtualViewport( |
| 4227 gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); | 4280 gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); |
| 4228 DrawFrame(); | 4281 DrawFrame(); |
| 4229 | 4282 |
| 4230 EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio()); | 4283 EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio()); |
| 4231 | 4284 |
| 4232 LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer(); | 4285 LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer(); |
| 4233 LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer(); | 4286 LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer(); |
| 4234 | 4287 |
| 4235 // Scroll the viewports to max scroll offset. | 4288 // Scroll the viewports to max scroll offset. |
| 4236 outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); | 4289 SetScrollOffsetDelta(outer_scroll, gfx::Vector2dF(0, 200.f)); |
| 4237 inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); | 4290 SetScrollOffsetDelta(inner_scroll, gfx::Vector2dF(100, 100.f)); |
| 4238 | 4291 |
| 4239 gfx::ScrollOffset viewport_offset = | 4292 gfx::ScrollOffset viewport_offset = |
| 4240 host_impl_->active_tree()->TotalScrollOffset(); | 4293 host_impl_->active_tree()->TotalScrollOffset(); |
| 4241 EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), viewport_offset); | 4294 EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), viewport_offset); |
| 4242 | 4295 |
| 4243 // Hide the top controls by 25px. | 4296 // Hide the top controls by 25px. |
| 4244 gfx::Vector2dF scroll_delta(0.f, 25.f); | 4297 gfx::Vector2dF scroll_delta(0.f, 25.f); |
| 4245 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 4298 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 4246 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 4299 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 4247 InputHandler::GESTURE) | 4300 InputHandler::GESTURE) |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 4275 InputHandler::GESTURE) | 4328 InputHandler::GESTURE) |
| 4276 .thread); | 4329 .thread); |
| 4277 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 4330 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| 4278 host_impl_->ScrollEnd(EndState().get()); | 4331 host_impl_->ScrollEnd(EndState().get()); |
| 4279 | 4332 |
| 4280 // The viewport offset shouldn't have changed. | 4333 // The viewport offset shouldn't have changed. |
| 4281 EXPECT_EQ(viewport_offset, | 4334 EXPECT_EQ(viewport_offset, |
| 4282 host_impl_->active_tree()->TotalScrollOffset()); | 4335 host_impl_->active_tree()->TotalScrollOffset()); |
| 4283 | 4336 |
| 4284 // Scroll the viewports to max scroll offset. | 4337 // Scroll the viewports to max scroll offset. |
| 4285 outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); | 4338 SetScrollOffsetDelta(outer_scroll, gfx::Vector2dF(0, 200.f)); |
| 4286 inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); | 4339 SetScrollOffsetDelta(inner_scroll, gfx::Vector2dF(100, 100.f)); |
| 4287 EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), | 4340 EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), |
| 4288 host_impl_->active_tree()->TotalScrollOffset()); | 4341 host_impl_->active_tree()->TotalScrollOffset()); |
| 4289 } | 4342 } |
| 4290 | 4343 |
| 4291 // Test that the top controls coming in and out maintains the same aspect ratio | 4344 // Test that the top controls coming in and out maintains the same aspect ratio |
| 4292 // between the inner and outer viewports. | 4345 // between the inner and outer viewports. |
| 4293 TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) { | 4346 TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) { |
| 4294 SetupTopControlsAndScrollLayerWithVirtualViewport( | 4347 SetupTopControlsAndScrollLayerWithVirtualViewport( |
| 4295 gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); | 4348 gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); |
| 4296 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 2.f); | 4349 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 2.f); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4364 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 4417 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| 4365 | 4418 |
| 4366 EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset()); | 4419 EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset()); |
| 4367 EXPECT_EQ(host_impl_->InnerViewportScrollLayer(), | 4420 EXPECT_EQ(host_impl_->InnerViewportScrollLayer(), |
| 4368 host_impl_->CurrentlyScrollingLayer()); | 4421 host_impl_->CurrentlyScrollingLayer()); |
| 4369 | 4422 |
| 4370 host_impl_->ScrollEnd(EndState().get()); | 4423 host_impl_->ScrollEnd(EndState().get()); |
| 4371 | 4424 |
| 4372 // Position the viewports such that the inner viewport will be scrolled. | 4425 // Position the viewports such that the inner viewport will be scrolled. |
| 4373 gfx::Vector2dF inner_viewport_offset(0.f, 25.f); | 4426 gfx::Vector2dF inner_viewport_offset(0.f, 25.f); |
| 4374 host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2dF()); | 4427 SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), |
| 4375 host_impl_->InnerViewportScrollLayer()->SetScrollDelta(inner_viewport_offset); | 4428 gfx::Vector2dF()); |
| 4429 SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), | |
| 4430 inner_viewport_offset); | |
| 4376 | 4431 |
| 4377 scroll_delta = gfx::Vector2dF(0.f, -65.f); | 4432 scroll_delta = gfx::Vector2dF(0.f, -65.f); |
| 4378 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 4433 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 4379 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 4434 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 4380 InputHandler::GESTURE) | 4435 InputHandler::GESTURE) |
| 4381 .thread); | 4436 .thread); |
| 4382 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 4437 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| 4383 | 4438 |
| 4384 EXPECT_EQ(top_controls_height_, | 4439 EXPECT_EQ(top_controls_height_, |
| 4385 host_impl_->top_controls_manager()->ContentTopOffset()); | 4440 host_impl_->top_controls_manager()->ContentTopOffset()); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4803 scoped_ptr<LayerImpl> child = | 4858 scoped_ptr<LayerImpl> child = |
| 4804 CreateScrollableLayer(2, content_size, root.get()); | 4859 CreateScrollableLayer(2, content_size, root.get()); |
| 4805 LayerImpl* grand_child_layer = grand_child.get(); | 4860 LayerImpl* grand_child_layer = grand_child.get(); |
| 4806 child->AddChild(std::move(grand_child)); | 4861 child->AddChild(std::move(grand_child)); |
| 4807 | 4862 |
| 4808 LayerImpl* child_layer = child.get(); | 4863 LayerImpl* child_layer = child.get(); |
| 4809 root->AddChild(std::move(child)); | 4864 root->AddChild(std::move(child)); |
| 4810 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 4865 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
| 4811 host_impl_->active_tree()->DidBecomeActive(); | 4866 host_impl_->active_tree()->DidBecomeActive(); |
| 4812 host_impl_->SetViewportSize(surface_size); | 4867 host_impl_->SetViewportSize(surface_size); |
| 4813 grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 5)); | 4868 grand_child_layer->layer_tree_impl() |
| 4814 child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(3, 0)); | 4869 ->property_trees() |
| 4870 ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), | |
| 4871 gfx::ScrollOffset(0, 5)); | |
| 4872 child_layer->layer_tree_impl() | |
| 4873 ->property_trees() | |
| 4874 ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), | |
| 4875 gfx::ScrollOffset(3, 0)); | |
| 4815 | 4876 |
| 4816 SetNeedsRebuildPropertyTrees(); | 4877 SetNeedsRebuildPropertyTrees(); |
| 4817 DrawFrame(); | 4878 DrawFrame(); |
| 4818 { | 4879 { |
| 4819 gfx::Vector2d scroll_delta(-8, -7); | 4880 gfx::Vector2d scroll_delta(-8, -7); |
| 4820 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 4881 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 4821 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 4882 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 4822 InputHandler::WHEEL) | 4883 InputHandler::WHEEL) |
| 4823 .thread); | 4884 .thread); |
| 4824 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 4885 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4865 root_scrolling->AddChild(std::move(child)); | 4926 root_scrolling->AddChild(std::move(child)); |
| 4866 root_clip->AddChild(std::move(root_scrolling)); | 4927 root_clip->AddChild(std::move(root_scrolling)); |
| 4867 EXPECT_EQ(viewport_size, root_clip->bounds()); | 4928 EXPECT_EQ(viewport_size, root_clip->bounds()); |
| 4868 root_ptr->AddChild(std::move(root_clip)); | 4929 root_ptr->AddChild(std::move(root_clip)); |
| 4869 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); | 4930 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); |
| 4870 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, | 4931 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, |
| 4871 Layer::INVALID_ID); | 4932 Layer::INVALID_ID); |
| 4872 host_impl_->active_tree()->DidBecomeActive(); | 4933 host_impl_->active_tree()->DidBecomeActive(); |
| 4873 host_impl_->SetViewportSize(viewport_size); | 4934 host_impl_->SetViewportSize(viewport_size); |
| 4874 | 4935 |
| 4875 grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); | 4936 grand_child_layer->layer_tree_impl() |
| 4876 child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); | 4937 ->property_trees() |
| 4938 ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), | |
| 4939 gfx::ScrollOffset(0, 2)); | |
| 4940 child_layer->layer_tree_impl() | |
| 4941 ->property_trees() | |
| 4942 ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), | |
| 4943 gfx::ScrollOffset(0, 3)); | |
| 4877 | 4944 |
| 4878 SetNeedsRebuildPropertyTrees(); | 4945 SetNeedsRebuildPropertyTrees(); |
| 4879 DrawFrame(); | 4946 DrawFrame(); |
| 4880 { | 4947 { |
| 4881 gfx::Vector2d scroll_delta(0, -10); | 4948 gfx::Vector2d scroll_delta(0, -10); |
| 4882 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 4949 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 4883 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 4950 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 4884 InputHandler::NON_BUBBLING_GESTURE) | 4951 InputHandler::NON_BUBBLING_GESTURE) |
| 4885 .thread); | 4952 .thread); |
| 4886 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 4953 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5085 .thread); | 5152 .thread); |
| 5086 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); | 5153 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); |
| 5087 host_impl_->ScrollEnd(EndState().get()); | 5154 host_impl_->ScrollEnd(EndState().get()); |
| 5088 | 5155 |
| 5089 // The layer should have scrolled down in its local coordinates. | 5156 // The layer should have scrolled down in its local coordinates. |
| 5090 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); | 5157 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); |
| 5091 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), scroll_layer->id(), | 5158 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), scroll_layer->id(), |
| 5092 gfx::Vector2d(0, gesture_scroll_delta.x()))); | 5159 gfx::Vector2d(0, gesture_scroll_delta.x()))); |
| 5093 | 5160 |
| 5094 // Reset and scroll down with the wheel. | 5161 // Reset and scroll down with the wheel. |
| 5095 scroll_layer->SetScrollDelta(gfx::Vector2dF()); | 5162 SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); |
| 5096 gfx::Vector2d wheel_scroll_delta(0, 10); | 5163 gfx::Vector2d wheel_scroll_delta(0, 10); |
| 5097 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 5164 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 5098 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 5165 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 5099 InputHandler::WHEEL) | 5166 InputHandler::WHEEL) |
| 5100 .thread); | 5167 .thread); |
| 5101 host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get()); | 5168 host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get()); |
| 5102 host_impl_->ScrollEnd(EndState().get()); | 5169 host_impl_->ScrollEnd(EndState().get()); |
| 5103 | 5170 |
| 5104 // The layer should have scrolled down in its local coordinates. | 5171 // The layer should have scrolled down in its local coordinates. |
| 5105 scroll_info = host_impl_->ProcessScrollDeltas(); | 5172 scroll_info = host_impl_->ProcessScrollDeltas(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5159 host_impl_->ProcessScrollDeltas(); | 5226 host_impl_->ProcessScrollDeltas(); |
| 5160 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child_layer_id, | 5227 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child_layer_id, |
| 5161 expected_scroll_delta)); | 5228 expected_scroll_delta)); |
| 5162 | 5229 |
| 5163 // The root scroll layer should not have scrolled, because the input delta | 5230 // The root scroll layer should not have scrolled, because the input delta |
| 5164 // was close to the layer's axis of movement. | 5231 // was close to the layer's axis of movement. |
| 5165 EXPECT_EQ(scroll_info->scrolls.size(), 1u); | 5232 EXPECT_EQ(scroll_info->scrolls.size(), 1u); |
| 5166 } | 5233 } |
| 5167 { | 5234 { |
| 5168 // Now reset and scroll the same amount horizontally. | 5235 // Now reset and scroll the same amount horizontally. |
| 5169 child_ptr->SetScrollDelta(gfx::Vector2dF()); | 5236 SetScrollOffsetDelta(child_ptr, gfx::Vector2dF()); |
| 5170 gfx::Vector2d gesture_scroll_delta(10, 0); | 5237 gfx::Vector2d gesture_scroll_delta(10, 0); |
| 5171 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 5238 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 5172 host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), | 5239 host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), |
| 5173 InputHandler::GESTURE) | 5240 InputHandler::GESTURE) |
| 5174 .thread); | 5241 .thread); |
| 5175 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); | 5242 host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get()); |
| 5176 host_impl_->ScrollEnd(EndState().get()); | 5243 host_impl_->ScrollEnd(EndState().get()); |
| 5177 | 5244 |
| 5178 // The child layer shouldn't have scrolled. | 5245 // The child layer shouldn't have scrolled. |
| 5179 gfx::Vector2d expected_scroll_delta( | 5246 gfx::Vector2d expected_scroll_delta( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5240 expected_scroll_deltas[2] = gfx::Vector2d(4, 0); | 5307 expected_scroll_deltas[2] = gfx::Vector2d(4, 0); |
| 5241 expected_scroll_deltas[3] = gfx::Vector2d(4, 0); | 5308 expected_scroll_deltas[3] = gfx::Vector2d(4, 0); |
| 5242 | 5309 |
| 5243 gfx::Point viewport_point(1, 1); | 5310 gfx::Point viewport_point(1, 1); |
| 5244 | 5311 |
| 5245 SetNeedsRebuildPropertyTrees(); | 5312 SetNeedsRebuildPropertyTrees(); |
| 5246 // Scroll in screen coordinates with a gesture. Each scroll starts | 5313 // Scroll in screen coordinates with a gesture. Each scroll starts |
| 5247 // where the previous scroll ended, but the scroll position is reset | 5314 // where the previous scroll ended, but the scroll position is reset |
| 5248 // for each scroll. | 5315 // for each scroll. |
| 5249 for (int i = 0; i < 4; ++i) { | 5316 for (int i = 0; i < 4; ++i) { |
| 5250 child_ptr->SetScrollDelta(gfx::Vector2dF()); | 5317 SetScrollOffsetDelta(child_ptr, gfx::Vector2dF()); |
| 5251 DrawFrame(); | 5318 DrawFrame(); |
| 5252 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 5319 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 5253 host_impl_->ScrollBegin(BeginState(viewport_point).get(), | 5320 host_impl_->ScrollBegin(BeginState(viewport_point).get(), |
| 5254 InputHandler::GESTURE) | 5321 InputHandler::GESTURE) |
| 5255 .thread); | 5322 .thread); |
| 5256 host_impl_->ScrollBy( | 5323 host_impl_->ScrollBy( |
| 5257 UpdateState(viewport_point, gesture_scroll_deltas[i]).get()); | 5324 UpdateState(viewport_point, gesture_scroll_deltas[i]).get()); |
| 5258 viewport_point += gesture_scroll_deltas[i]; | 5325 viewport_point += gesture_scroll_deltas[i]; |
| 5259 host_impl_->ScrollEnd(EndState().get()); | 5326 host_impl_->ScrollEnd(EndState().get()); |
| 5260 | 5327 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5292 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); | 5359 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); |
| 5293 host_impl_->ScrollEnd(EndState().get()); | 5360 host_impl_->ScrollEnd(EndState().get()); |
| 5294 | 5361 |
| 5295 // The layer should have scrolled down in its local coordinates, but half the | 5362 // The layer should have scrolled down in its local coordinates, but half the |
| 5296 // amount. | 5363 // amount. |
| 5297 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); | 5364 scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); |
| 5298 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), scroll_layer->id(), | 5365 EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), scroll_layer->id(), |
| 5299 gfx::Vector2d(0, scroll_delta.y() / scale))); | 5366 gfx::Vector2d(0, scroll_delta.y() / scale))); |
| 5300 | 5367 |
| 5301 // Reset and scroll down with the wheel. | 5368 // Reset and scroll down with the wheel. |
| 5302 scroll_layer->SetScrollDelta(gfx::Vector2dF()); | 5369 SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); |
| 5303 gfx::Vector2d wheel_scroll_delta(0, 10); | 5370 gfx::Vector2d wheel_scroll_delta(0, 10); |
| 5304 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 5371 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 5305 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 5372 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 5306 InputHandler::WHEEL) | 5373 InputHandler::WHEEL) |
| 5307 .thread); | 5374 .thread); |
| 5308 host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get()); | 5375 host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get()); |
| 5309 host_impl_->ScrollEnd(EndState().get()); | 5376 host_impl_->ScrollEnd(EndState().get()); |
| 5310 | 5377 |
| 5311 // It should apply the scale factor to the scroll delta for the wheel event. | 5378 // It should apply the scale factor to the scroll delta for the wheel event. |
| 5312 scroll_info = host_impl_->ProcessScrollDeltas(); | 5379 scroll_info = host_impl_->ProcessScrollDeltas(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5400 host_impl_->SetViewportSize(gfx::Size(10, 20)); | 5467 host_impl_->SetViewportSize(gfx::Size(10, 20)); |
| 5401 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 5468 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 5402 LayerImpl* clip_layer = scroll_layer->parent()->parent(); | 5469 LayerImpl* clip_layer = scroll_layer->parent()->parent(); |
| 5403 SetNeedsRebuildPropertyTrees(); | 5470 SetNeedsRebuildPropertyTrees(); |
| 5404 clip_layer->SetBounds(gfx::Size(10, 20)); | 5471 clip_layer->SetBounds(gfx::Size(10, 20)); |
| 5405 RebuildPropertyTrees(); | 5472 RebuildPropertyTrees(); |
| 5406 | 5473 |
| 5407 host_impl_->BindToClient(&scroll_watcher); | 5474 host_impl_->BindToClient(&scroll_watcher); |
| 5408 | 5475 |
| 5409 gfx::Vector2dF initial_scroll_delta(10.f, 10.f); | 5476 gfx::Vector2dF initial_scroll_delta(10.f, 10.f); |
| 5410 scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 5477 scroll_layer->layer_tree_impl() |
| 5411 scroll_layer->SetScrollDelta(initial_scroll_delta); | 5478 ->property_trees() |
| 5479 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 5480 gfx::ScrollOffset()); | |
| 5481 SetScrollOffsetDelta(scroll_layer, initial_scroll_delta); | |
| 5412 | 5482 |
| 5413 EXPECT_EQ(gfx::ScrollOffset(), scroll_watcher.last_set_scroll_offset()); | 5483 EXPECT_EQ(gfx::ScrollOffset(), scroll_watcher.last_set_scroll_offset()); |
| 5414 | 5484 |
| 5415 // Requesting an update results in the current scroll offset being set. | 5485 // Requesting an update results in the current scroll offset being set. |
| 5416 host_impl_->RequestUpdateForSynchronousInputHandler(); | 5486 host_impl_->RequestUpdateForSynchronousInputHandler(); |
| 5417 EXPECT_EQ(gfx::ScrollOffset(initial_scroll_delta), | 5487 EXPECT_EQ(gfx::ScrollOffset(initial_scroll_delta), |
| 5418 scroll_watcher.last_set_scroll_offset()); | 5488 scroll_watcher.last_set_scroll_offset()); |
| 5419 | 5489 |
| 5420 // Setting the delegate results in the scrollable_size, max_scroll_offset, | 5490 // Setting the delegate results in the scrollable_size, max_scroll_offset, |
| 5421 // page_scale_factor and {min|max}_page_scale_factor being set. | 5491 // page_scale_factor and {min|max}_page_scale_factor being set. |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5672 CreateScrollableLayer(3, surface_size, root_clip.get()); | 5742 CreateScrollableLayer(3, surface_size, root_clip.get()); |
| 5673 | 5743 |
| 5674 scoped_ptr<LayerImpl> child = | 5744 scoped_ptr<LayerImpl> child = |
| 5675 CreateScrollableLayer(2, surface_size, root_clip.get()); | 5745 CreateScrollableLayer(2, surface_size, root_clip.get()); |
| 5676 LayerImpl* grand_child_layer = grand_child.get(); | 5746 LayerImpl* grand_child_layer = grand_child.get(); |
| 5677 child->AddChild(std::move(grand_child)); | 5747 child->AddChild(std::move(grand_child)); |
| 5678 | 5748 |
| 5679 LayerImpl* child_layer = child.get(); | 5749 LayerImpl* child_layer = child.get(); |
| 5680 root->AddChild(std::move(child)); | 5750 root->AddChild(std::move(child)); |
| 5681 root_clip->AddChild(std::move(root)); | 5751 root_clip->AddChild(std::move(root)); |
| 5682 child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); | 5752 child_layer->layer_tree_impl() |
| 5683 grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); | 5753 ->property_trees() |
| 5754 ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), | |
| 5755 gfx::ScrollOffset(0, 3)); | |
| 5756 grand_child_layer->layer_tree_impl() | |
| 5757 ->property_trees() | |
| 5758 ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), | |
| 5759 gfx::ScrollOffset(0, 2)); | |
| 5684 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); | 5760 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); |
| 5685 host_impl_->active_tree()->DidBecomeActive(); | 5761 host_impl_->active_tree()->DidBecomeActive(); |
| 5686 host_impl_->SetViewportSize(surface_size); | 5762 host_impl_->SetViewportSize(surface_size); |
| 5687 SetNeedsRebuildPropertyTrees(); | 5763 SetNeedsRebuildPropertyTrees(); |
| 5688 DrawFrame(); | 5764 DrawFrame(); |
| 5689 { | 5765 { |
| 5690 gfx::Vector2d scroll_delta(0, -10); | 5766 gfx::Vector2d scroll_delta(0, -10); |
| 5691 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 5767 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 5692 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 5768 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 5693 InputHandler::NON_BUBBLING_GESTURE) | 5769 InputHandler::NON_BUBBLING_GESTURE) |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7207 3, raster_source); | 7283 3, raster_source); |
| 7208 LayerImpl* content_layer = scoped_content_layer.get(); | 7284 LayerImpl* content_layer = scoped_content_layer.get(); |
| 7209 scrolling_layer->AddChild(std::move(scoped_content_layer)); | 7285 scrolling_layer->AddChild(std::move(scoped_content_layer)); |
| 7210 content_layer->SetBounds(content_layer_bounds); | 7286 content_layer->SetBounds(content_layer_bounds); |
| 7211 content_layer->SetDrawsContent(true); | 7287 content_layer->SetDrawsContent(true); |
| 7212 | 7288 |
| 7213 root->SetBounds(root_size); | 7289 root->SetBounds(root_size); |
| 7214 | 7290 |
| 7215 gfx::ScrollOffset scroll_offset(100000, 0); | 7291 gfx::ScrollOffset scroll_offset(100000, 0); |
| 7216 scrolling_layer->SetScrollClipLayer(root->id()); | 7292 scrolling_layer->SetScrollClipLayer(root->id()); |
| 7217 scrolling_layer->PushScrollOffsetFromMainThread(scroll_offset); | 7293 scrolling_layer->layer_tree_impl() |
| 7294 ->property_trees() | |
| 7295 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), | |
| 7296 scroll_offset); | |
| 7218 | 7297 |
| 7219 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 7298 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
| 7220 host_impl_->ActivateSyncTree(); | 7299 host_impl_->ActivateSyncTree(); |
| 7221 | 7300 |
| 7222 bool update_lcd_text = false; | 7301 bool update_lcd_text = false; |
| 7223 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); | 7302 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); |
| 7224 ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 7303 ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); |
| 7225 | 7304 |
| 7226 LayerTreeHostImpl::FrameData frame; | 7305 LayerTreeHostImpl::FrameData frame; |
| 7227 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 7306 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7608 // Scroll a child layer beyond its maximum scroll range and make sure the | 7687 // Scroll a child layer beyond its maximum scroll range and make sure the |
| 7609 // the scroll doesn't bubble up to the parent layer. | 7688 // the scroll doesn't bubble up to the parent layer. |
| 7610 gfx::Size surface_size(10, 10); | 7689 gfx::Size surface_size(10, 10); |
| 7611 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 7690 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
| 7612 root->SetForceRenderSurface(true); | 7691 root->SetForceRenderSurface(true); |
| 7613 scoped_ptr<LayerImpl> root_scrolling = | 7692 scoped_ptr<LayerImpl> root_scrolling = |
| 7614 CreateScrollableLayer(2, surface_size, root.get()); | 7693 CreateScrollableLayer(2, surface_size, root.get()); |
| 7615 | 7694 |
| 7616 scoped_ptr<LayerImpl> grand_child = | 7695 scoped_ptr<LayerImpl> grand_child = |
| 7617 CreateScrollableLayer(4, surface_size, root.get()); | 7696 CreateScrollableLayer(4, surface_size, root.get()); |
| 7618 grand_child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); | 7697 grand_child->layer_tree_impl() |
| 7698 ->property_trees() | |
| 7699 ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child->id(), | |
| 7700 gfx::ScrollOffset(0, 2)); | |
| 7619 | 7701 |
| 7620 scoped_ptr<LayerImpl> child = | 7702 scoped_ptr<LayerImpl> child = |
| 7621 CreateScrollableLayer(3, surface_size, root.get()); | 7703 CreateScrollableLayer(3, surface_size, root.get()); |
| 7622 child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 4)); | 7704 child->layer_tree_impl() |
| 7705 ->property_trees() | |
| 7706 ->scroll_tree.UpdateScrollOffsetBaseForTesting(child->id(), | |
| 7707 gfx::ScrollOffset(0, 4)); | |
| 7623 child->AddChild(std::move(grand_child)); | 7708 child->AddChild(std::move(grand_child)); |
| 7624 | 7709 |
| 7625 root_scrolling->AddChild(std::move(child)); | 7710 root_scrolling->AddChild(std::move(child)); |
| 7626 root->AddChild(std::move(root_scrolling)); | 7711 root->AddChild(std::move(root_scrolling)); |
| 7627 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 7712 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
| 7628 host_impl_->active_tree()->DidBecomeActive(); | 7713 host_impl_->active_tree()->DidBecomeActive(); |
| 7629 host_impl_->SetViewportSize(surface_size); | 7714 host_impl_->SetViewportSize(surface_size); |
| 7630 SetNeedsRebuildPropertyTrees(); | 7715 SetNeedsRebuildPropertyTrees(); |
| 7631 DrawFrame(); | 7716 DrawFrame(); |
| 7632 { | 7717 { |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8166 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); | 8251 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); |
| 8167 } | 8252 } |
| 8168 | 8253 |
| 8169 protected: | 8254 protected: |
| 8170 static const int top_controls_height_; | 8255 static const int top_controls_height_; |
| 8171 }; | 8256 }; |
| 8172 | 8257 |
| 8173 const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50; | 8258 const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50; |
| 8174 | 8259 |
| 8175 TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) { | 8260 TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) { |
| 8176 SetupScrollAndContentsLayers(gfx::Size(100, 100)) | 8261 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 8177 ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); | 8262 scroll_layer->layer_tree_impl() |
| 8263 ->property_trees() | |
| 8264 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 8265 gfx::ScrollOffset(0, 10)); | |
| 8178 BeginFrameArgs begin_frame_args = | 8266 BeginFrameArgs begin_frame_args = |
| 8179 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 8267 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 8180 host_impl_->WillBeginImplFrame(begin_frame_args); | 8268 host_impl_->WillBeginImplFrame(begin_frame_args); |
| 8181 host_impl_->Animate(); | 8269 host_impl_->Animate(); |
| 8182 EXPECT_FALSE(did_request_redraw_); | 8270 EXPECT_FALSE(did_request_redraw_); |
| 8183 host_impl_->DidFinishImplFrame(); | 8271 host_impl_->DidFinishImplFrame(); |
| 8184 } | 8272 } |
| 8185 | 8273 |
| 8186 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsHeightIsCommitted) { | 8274 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsHeightIsCommitted) { |
| 8187 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 8275 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 8202 host_impl_->ActivateSyncTree(); | 8290 host_impl_->ActivateSyncTree(); |
| 8203 EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset()); | 8291 EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 8204 | 8292 |
| 8205 host_impl_->CreatePendingTree(); | 8293 host_impl_->CreatePendingTree(); |
| 8206 host_impl_->sync_tree()->set_top_controls_height(50); | 8294 host_impl_->sync_tree()->set_top_controls_height(50); |
| 8207 host_impl_->ActivateSyncTree(); | 8295 host_impl_->ActivateSyncTree(); |
| 8208 EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset()); | 8296 EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 8209 } | 8297 } |
| 8210 | 8298 |
| 8211 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) { | 8299 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) { |
| 8212 SetupScrollAndContentsLayers(gfx::Size(100, 100)) | 8300 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 8213 ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); | 8301 scroll_layer->layer_tree_impl() |
| 8302 ->property_trees() | |
| 8303 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 8304 gfx::ScrollOffset(0, 10)); | |
| 8214 host_impl_->DidChangeTopControlsPosition(); | 8305 host_impl_->DidChangeTopControlsPosition(); |
| 8215 EXPECT_TRUE(did_request_next_frame_); | 8306 EXPECT_TRUE(did_request_next_frame_); |
| 8216 EXPECT_TRUE(did_request_redraw_); | 8307 EXPECT_TRUE(did_request_redraw_); |
| 8217 } | 8308 } |
| 8218 | 8309 |
| 8219 TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { | 8310 TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { |
| 8220 InputHandlerScrollResult result; | 8311 InputHandlerScrollResult result; |
| 8221 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); | 8312 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
| 8222 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 8313 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 8223 host_impl_->top_controls_manager()->UpdateTopControlsState( | 8314 host_impl_->top_controls_manager()->UpdateTopControlsState( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8400 } | 8491 } |
| 8401 EXPECT_FALSE(host_impl_->top_controls_manager()->has_animation()); | 8492 EXPECT_FALSE(host_impl_->top_controls_manager()->has_animation()); |
| 8402 } | 8493 } |
| 8403 | 8494 |
| 8404 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) { | 8495 TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) { |
| 8405 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); | 8496 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
| 8406 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 8497 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 8407 host_impl_->top_controls_manager()->UpdateTopControlsState( | 8498 host_impl_->top_controls_manager()->UpdateTopControlsState( |
| 8408 BOTH, SHOWN, false); | 8499 BOTH, SHOWN, false); |
| 8409 float initial_scroll_offset = 50; | 8500 float initial_scroll_offset = 50; |
| 8410 scroll_layer->PushScrollOffsetFromMainThread( | 8501 scroll_layer->layer_tree_impl() |
| 8411 gfx::ScrollOffset(0, initial_scroll_offset)); | 8502 ->property_trees() |
| 8503 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 8504 scroll_layer->id(), gfx::ScrollOffset(0, initial_scroll_offset)); | |
| 8412 DrawFrame(); | 8505 DrawFrame(); |
| 8413 | 8506 |
| 8414 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 8507 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 8415 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 8508 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 8416 InputHandler::GESTURE) | 8509 InputHandler::GESTURE) |
| 8417 .thread); | 8510 .thread); |
| 8418 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); | 8511 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 8419 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), | 8512 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), |
| 8420 scroll_layer->CurrentScrollOffset().ToString()); | 8513 scroll_layer->CurrentScrollOffset().ToString()); |
| 8421 | 8514 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8471 host_impl_->top_controls_manager()->ControlsTopOffset()); | 8564 host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 8472 } | 8565 } |
| 8473 | 8566 |
| 8474 TEST_F(LayerTreeHostImplWithTopControlsTest, | 8567 TEST_F(LayerTreeHostImplWithTopControlsTest, |
| 8475 TopControlsAnimationAfterMainThreadFlingStopped) { | 8568 TopControlsAnimationAfterMainThreadFlingStopped) { |
| 8476 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); | 8569 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200)); |
| 8477 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 8570 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 8478 host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, | 8571 host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, |
| 8479 false); | 8572 false); |
| 8480 float initial_scroll_offset = 50; | 8573 float initial_scroll_offset = 50; |
| 8481 scroll_layer->PushScrollOffsetFromMainThread( | 8574 scroll_layer->layer_tree_impl() |
| 8482 gfx::ScrollOffset(0, initial_scroll_offset)); | 8575 ->property_trees() |
| 8576 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | |
| 8577 scroll_layer->id(), gfx::ScrollOffset(0, initial_scroll_offset)); | |
| 8483 DrawFrame(); | 8578 DrawFrame(); |
| 8484 | 8579 |
| 8485 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, | 8580 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, |
| 8486 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 8581 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 8487 InputHandler::GESTURE) | 8582 InputHandler::GESTURE) |
| 8488 .thread); | 8583 .thread); |
| 8489 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); | 8584 EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); |
| 8490 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), | 8585 EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), |
| 8491 scroll_layer->CurrentScrollOffset().ToString()); | 8586 scroll_layer->CurrentScrollOffset().ToString()); |
| 8492 | 8587 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8624 LayerTreeImpl* layer_tree_impl = host_impl_->active_tree(); | 8719 LayerTreeImpl* layer_tree_impl = host_impl_->active_tree(); |
| 8625 const int kOuterViewportClipLayerId = 6; | 8720 const int kOuterViewportClipLayerId = 6; |
| 8626 const int kOuterViewportScrollLayerId = 7; | 8721 const int kOuterViewportScrollLayerId = 7; |
| 8627 const int kInnerViewportScrollLayerId = 2; | 8722 const int kInnerViewportScrollLayerId = 2; |
| 8628 const int kInnerViewportClipLayerId = 4; | 8723 const int kInnerViewportClipLayerId = 4; |
| 8629 const int kPageScaleLayerId = 5; | 8724 const int kPageScaleLayerId = 5; |
| 8630 | 8725 |
| 8631 scoped_ptr<LayerImpl> inner_scroll = | 8726 scoped_ptr<LayerImpl> inner_scroll = |
| 8632 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 8727 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
| 8633 inner_scroll->SetIsContainerForFixedPositionLayers(true); | 8728 inner_scroll->SetIsContainerForFixedPositionLayers(true); |
| 8634 inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 8729 inner_scroll->layer_tree_impl() |
| 8730 ->property_trees() | |
| 8731 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), | |
| 8732 gfx::ScrollOffset()); | |
| 8635 | 8733 |
| 8636 scoped_ptr<LayerImpl> inner_clip = | 8734 scoped_ptr<LayerImpl> inner_clip = |
| 8637 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 8735 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
| 8638 inner_clip->SetBounds(inner_viewport); | 8736 inner_clip->SetBounds(inner_viewport); |
| 8639 | 8737 |
| 8640 scoped_ptr<LayerImpl> page_scale = | 8738 scoped_ptr<LayerImpl> page_scale = |
| 8641 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 8739 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
| 8642 | 8740 |
| 8643 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 8741 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
| 8644 inner_scroll->SetBounds(outer_viewport); | 8742 inner_scroll->SetBounds(outer_viewport); |
| 8645 inner_scroll->SetPosition(gfx::PointF()); | 8743 inner_scroll->SetPosition(gfx::PointF()); |
| 8646 | 8744 |
| 8647 scoped_ptr<LayerImpl> outer_clip = | 8745 scoped_ptr<LayerImpl> outer_clip = |
| 8648 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 8746 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
| 8649 outer_clip->SetBounds(outer_viewport); | 8747 outer_clip->SetBounds(outer_viewport); |
| 8650 outer_clip->SetIsContainerForFixedPositionLayers(true); | 8748 outer_clip->SetIsContainerForFixedPositionLayers(true); |
| 8651 | 8749 |
| 8652 scoped_ptr<LayerImpl> outer_scroll = | 8750 scoped_ptr<LayerImpl> outer_scroll = |
| 8653 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 8751 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
| 8654 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 8752 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
| 8655 outer_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 8753 outer_scroll->layer_tree_impl() |
| 8754 ->property_trees() | |
| 8755 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | |
| 8756 gfx::ScrollOffset()); | |
| 8656 outer_scroll->SetBounds(content_size); | 8757 outer_scroll->SetBounds(content_size); |
| 8657 outer_scroll->SetPosition(gfx::PointF()); | 8758 outer_scroll->SetPosition(gfx::PointF()); |
| 8658 | 8759 |
| 8659 scoped_ptr<LayerImpl> contents = | 8760 scoped_ptr<LayerImpl> contents = |
| 8660 LayerImpl::Create(layer_tree_impl, 8); | 8761 LayerImpl::Create(layer_tree_impl, 8); |
| 8661 contents->SetDrawsContent(true); | 8762 contents->SetDrawsContent(true); |
| 8662 contents->SetBounds(content_size); | 8763 contents->SetBounds(content_size); |
| 8663 contents->SetPosition(gfx::PointF()); | 8764 contents->SetPosition(gfx::PointF()); |
| 8664 | 8765 |
| 8665 outer_scroll->AddChild(std::move(contents)); | 8766 outer_scroll->AddChild(std::move(contents)); |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9745 EXPECT_EQ(scroll_layer, host_impl_->InnerViewportScrollLayer()); | 9846 EXPECT_EQ(scroll_layer, host_impl_->InnerViewportScrollLayer()); |
| 9746 | 9847 |
| 9747 float min_page_scale = 1.f, max_page_scale = 4.f; | 9848 float min_page_scale = 1.f, max_page_scale = 4.f; |
| 9748 float page_scale_factor = 1.f; | 9849 float page_scale_factor = 1.f; |
| 9749 | 9850 |
| 9750 // The scroll deltas should have the page scale factor applied. | 9851 // The scroll deltas should have the page scale factor applied. |
| 9751 { | 9852 { |
| 9752 host_impl_->active_tree()->PushPageScaleFromMainThread( | 9853 host_impl_->active_tree()->PushPageScaleFromMainThread( |
| 9753 page_scale_factor, min_page_scale, max_page_scale); | 9854 page_scale_factor, min_page_scale, max_page_scale); |
| 9754 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 9855 host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 9755 scroll_layer->SetScrollDelta(gfx::Vector2d()); | 9856 SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); |
| 9756 | 9857 |
| 9757 float page_scale_delta = 2.f; | 9858 float page_scale_delta = 2.f; |
| 9758 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), | 9859 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), |
| 9759 InputHandler::GESTURE); | 9860 InputHandler::GESTURE); |
| 9760 host_impl_->PinchGestureBegin(); | 9861 host_impl_->PinchGestureBegin(); |
| 9761 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); | 9862 host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point()); |
| 9762 host_impl_->PinchGestureEnd(); | 9863 host_impl_->PinchGestureEnd(); |
| 9763 host_impl_->ScrollEnd(EndState().get()); | 9864 host_impl_->ScrollEnd(EndState().get()); |
| 9764 | 9865 |
| 9765 gfx::Vector2dF scroll_delta(0, 5); | 9866 gfx::Vector2dF scroll_delta(0, 5); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10218 // There should not be any jitter measured till we hit the fixed point hits | 10319 // There should not be any jitter measured till we hit the fixed point hits |
| 10219 // threshold. | 10320 // threshold. |
| 10220 float expected_jitter = | 10321 float expected_jitter = |
| 10221 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10322 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10222 EXPECT_EQ(jitter, expected_jitter); | 10323 EXPECT_EQ(jitter, expected_jitter); |
| 10223 } | 10324 } |
| 10224 } | 10325 } |
| 10225 | 10326 |
| 10226 } // namespace | 10327 } // namespace |
| 10227 } // namespace cc | 10328 } // namespace cc |
| OLD | NEW |