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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 LayerImpl* outer_clip = host_impl_->OuterViewportScrollLayer()->parent(); | 372 LayerImpl* outer_clip = host_impl_->OuterViewportScrollLayer()->parent(); |
373 outer_clip->SetBounds(viewport_size); | 373 outer_clip->SetBounds(viewport_size); |
374 | 374 |
375 LayerImpl* inner_clip_layer = | 375 LayerImpl* inner_clip_layer = |
376 host_impl_->InnerViewportScrollLayer()->parent()->parent(); | 376 host_impl_->InnerViewportScrollLayer()->parent()->parent(); |
377 inner_clip_layer->SetBounds(viewport_size); | 377 inner_clip_layer->SetBounds(viewport_size); |
378 host_impl_->InnerViewportScrollLayer()->SetBounds(viewport_size); | 378 host_impl_->InnerViewportScrollLayer()->SetBounds(viewport_size); |
379 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 379 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
380 | 380 |
| 381 host_impl_->active_tree()->SetElementIdsForTesting(); |
| 382 |
381 host_impl_->SetViewportSize(viewport_size); | 383 host_impl_->SetViewportSize(viewport_size); |
382 host_impl_->active_tree()->DidBecomeActive(); | 384 host_impl_->active_tree()->DidBecomeActive(); |
383 | 385 |
384 return content_layer; | 386 return content_layer; |
385 } | 387 } |
386 | 388 |
387 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, | 389 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, |
388 const gfx::Size& size, | 390 const gfx::Size& size, |
389 LayerImpl* clip_layer) { | 391 LayerImpl* clip_layer) { |
390 DCHECK(clip_layer); | 392 DCHECK(clip_layer); |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 LayerImpl::Create(host_impl_->pending_tree(), 1)); | 1309 LayerImpl::Create(host_impl_->pending_tree(), 1)); |
1308 LayerImpl* root = host_impl_->pending_tree()->root_layer(); | 1310 LayerImpl* root = host_impl_->pending_tree()->root_layer(); |
1309 root->SetBounds(gfx::Size(50, 50)); | 1311 root->SetBounds(gfx::Size(50, 50)); |
1310 root->test_properties()->force_render_surface = true; | 1312 root->test_properties()->force_render_surface = true; |
1311 | 1313 |
1312 root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2)); | 1314 root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2)); |
1313 LayerImpl* child = root->children()[0]; | 1315 LayerImpl* child = root->children()[0]; |
1314 child->SetBounds(gfx::Size(10, 10)); | 1316 child->SetBounds(gfx::Size(10, 10)); |
1315 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1317 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1316 child->SetDrawsContent(true); | 1318 child->SetDrawsContent(true); |
1317 AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 10.0, 3, 0); | 1319 |
| 1320 host_impl_->pending_tree()->SetElementIdsForTesting(); |
| 1321 |
| 1322 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0, |
| 1323 3, 0); |
1318 | 1324 |
1319 EXPECT_FALSE(did_request_next_frame_); | 1325 EXPECT_FALSE(did_request_next_frame_); |
1320 EXPECT_FALSE(did_request_redraw_); | 1326 EXPECT_FALSE(did_request_redraw_); |
1321 EXPECT_FALSE(did_request_commit_); | 1327 EXPECT_FALSE(did_request_commit_); |
1322 | 1328 |
1323 host_impl_->AnimatePendingTreeAfterCommit(); | 1329 host_impl_->AnimatePendingTreeAfterCommit(); |
1324 | 1330 |
1325 // An animation exists on the pending layer. Doing | 1331 // An animation exists on the pending layer. Doing |
1326 // AnimatePendingTreeAfterCommit() requests another frame. | 1332 // AnimatePendingTreeAfterCommit() requests another frame. |
1327 // In reality, animations without has_set_start_time() == true do not need to | 1333 // In reality, animations without has_set_start_time() == true do not need to |
(...skipping 30 matching lines...) Expand all Loading... |
1358 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 1364 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
1359 root->SetBounds(gfx::Size(50, 50)); | 1365 root->SetBounds(gfx::Size(50, 50)); |
1360 root->test_properties()->force_render_surface = true; | 1366 root->test_properties()->force_render_surface = true; |
1361 | 1367 |
1362 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); | 1368 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); |
1363 LayerImpl* child = root->children()[0]; | 1369 LayerImpl* child = root->children()[0]; |
1364 child->SetBounds(gfx::Size(10, 10)); | 1370 child->SetBounds(gfx::Size(10, 10)); |
1365 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1371 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1366 child->SetDrawsContent(true); | 1372 child->SetDrawsContent(true); |
1367 | 1373 |
| 1374 host_impl_->active_tree()->SetElementIdsForTesting(); |
| 1375 |
1368 // Add a translate from 6,7 to 8,9. | 1376 // Add a translate from 6,7 to 8,9. |
1369 TransformOperations start; | 1377 TransformOperations start; |
1370 start.AppendTranslate(6.f, 7.f, 0.f); | 1378 start.AppendTranslate(6.f, 7.f, 0.f); |
1371 TransformOperations end; | 1379 TransformOperations end; |
1372 end.AppendTranslate(8.f, 9.f, 0.f); | 1380 end.AppendTranslate(8.f, 9.f, 0.f); |
1373 AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 4.0, start, | 1381 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0, |
1374 end); | 1382 start, end); |
1375 | 1383 |
1376 base::TimeTicks now = base::TimeTicks::Now(); | 1384 base::TimeTicks now = base::TimeTicks::Now(); |
1377 host_impl_->WillBeginImplFrame( | 1385 host_impl_->WillBeginImplFrame( |
1378 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); | 1386 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); |
1379 | 1387 |
1380 // TODO(crbug.com/551134): We always request a new frame and a draw for | 1388 // TODO(crbug.com/551134): We always request a new frame and a draw for |
1381 // animations that are on the pending tree, but we don't need to do that | 1389 // animations that are on the pending tree, but we don't need to do that |
1382 // unless they are waiting for some future time to start. | 1390 // unless they are waiting for some future time to start. |
1383 EXPECT_TRUE(did_request_next_frame_); | 1391 EXPECT_TRUE(did_request_next_frame_); |
1384 EXPECT_TRUE(did_request_redraw_); | 1392 EXPECT_TRUE(did_request_redraw_); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 LayerImpl::Create(host_impl_->active_tree(), 1)); | 1429 LayerImpl::Create(host_impl_->active_tree(), 1)); |
1422 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 1430 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
1423 root->SetBounds(gfx::Size(50, 50)); | 1431 root->SetBounds(gfx::Size(50, 50)); |
1424 root->SetHasRenderSurface(true); | 1432 root->SetHasRenderSurface(true); |
1425 | 1433 |
1426 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); | 1434 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); |
1427 LayerImpl* child = root->children()[0]; | 1435 LayerImpl* child = root->children()[0]; |
1428 child->SetBounds(gfx::Size(10, 10)); | 1436 child->SetBounds(gfx::Size(10, 10)); |
1429 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1437 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1430 child->SetDrawsContent(true); | 1438 child->SetDrawsContent(true); |
1431 AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 10.0, 3, 0); | 1439 |
| 1440 host_impl_->active_tree()->SetElementIdsForTesting(); |
| 1441 |
| 1442 AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0, |
| 1443 3, 0); |
1432 | 1444 |
1433 // Set up the property trees so that UpdateDrawProperties will work in | 1445 // Set up the property trees so that UpdateDrawProperties will work in |
1434 // CommitComplete below. | 1446 // CommitComplete below. |
1435 LayerImplList list; | 1447 LayerImplList list; |
1436 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 1448 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
1437 root, gfx::Size(50, 50), &list); | 1449 root, gfx::Size(50, 50), &list); |
1438 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 1450 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
1439 | 1451 |
1440 EXPECT_FALSE(did_request_next_frame_); | 1452 EXPECT_FALSE(did_request_next_frame_); |
1441 EXPECT_FALSE(did_request_redraw_); | 1453 EXPECT_FALSE(did_request_redraw_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 root->SetHasRenderSurface(true); | 1493 root->SetHasRenderSurface(true); |
1482 | 1494 |
1483 root->AddChild(std::unique_ptr<MissingTilesLayer>( | 1495 root->AddChild(std::unique_ptr<MissingTilesLayer>( |
1484 new MissingTilesLayer(host_impl_->active_tree(), 2))); | 1496 new MissingTilesLayer(host_impl_->active_tree(), 2))); |
1485 MissingTilesLayer* child = | 1497 MissingTilesLayer* child = |
1486 static_cast<MissingTilesLayer*>(root->children()[0]); | 1498 static_cast<MissingTilesLayer*>(root->children()[0]); |
1487 child->SetBounds(gfx::Size(10, 10)); | 1499 child->SetBounds(gfx::Size(10, 10)); |
1488 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1500 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1489 child->SetDrawsContent(true); | 1501 child->SetDrawsContent(true); |
1490 | 1502 |
| 1503 host_impl_->active_tree()->SetElementIdsForTesting(); |
| 1504 |
1491 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); | 1505 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); |
1492 | 1506 |
1493 // Add a translate from 6,7 to 8,9. | 1507 // Add a translate from 6,7 to 8,9. |
1494 TransformOperations start; | 1508 TransformOperations start; |
1495 start.AppendTranslate(6.f, 7.f, 0.f); | 1509 start.AppendTranslate(6.f, 7.f, 0.f); |
1496 TransformOperations end; | 1510 TransformOperations end; |
1497 end.AppendTranslate(8.f, 9.f, 0.f); | 1511 end.AppendTranslate(8.f, 9.f, 0.f); |
1498 int animation_id = AddAnimatedTransformToLayerWithPlayer( | 1512 int animation_id = AddAnimatedTransformToElementWithPlayer( |
1499 child->id(), timeline(), 4.0, start, end); | 1513 child->element_id(), timeline(), 4.0, start, end); |
1500 | 1514 |
1501 base::TimeTicks now = base::TimeTicks::Now(); | 1515 base::TimeTicks now = base::TimeTicks::Now(); |
1502 host_impl_->WillBeginImplFrame( | 1516 host_impl_->WillBeginImplFrame( |
1503 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); | 1517 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now)); |
1504 | 1518 |
1505 host_impl_->ActivateAnimations(); | 1519 host_impl_->ActivateAnimations(); |
1506 host_impl_->Animate(); | 1520 host_impl_->Animate(); |
1507 | 1521 |
1508 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); | 1522 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); |
1509 | 1523 |
(...skipping 10 matching lines...) Expand all Loading... |
1520 child->set_has_missing_tiles(false); | 1534 child->set_has_missing_tiles(false); |
1521 | 1535 |
1522 // Child layer has an animating and no missing tiles. | 1536 // Child layer has an animating and no missing tiles. |
1523 result = host_impl_->PrepareToDraw(&frame); | 1537 result = host_impl_->PrepareToDraw(&frame); |
1524 EXPECT_EQ(DRAW_SUCCESS, result); | 1538 EXPECT_EQ(DRAW_SUCCESS, result); |
1525 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); | 1539 EXPECT_TRUE(child->was_ever_ready_since_last_transform_animation()); |
1526 host_impl_->DidDrawAllLayers(frame); | 1540 host_impl_->DidDrawAllLayers(frame); |
1527 | 1541 |
1528 // Remove the animation. | 1542 // Remove the animation. |
1529 child->set_has_missing_tiles(true); | 1543 child->set_has_missing_tiles(true); |
1530 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), | 1544 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
1531 animation_id); | 1545 animation_id); |
1532 child->draw_properties().screen_space_transform_is_animating = false; | 1546 child->draw_properties().screen_space_transform_is_animating = false; |
1533 | 1547 |
1534 // Child layer doesn't have an animation, but was never ready since the last | 1548 // Child layer doesn't have an animation, but was never ready since the last |
1535 // time it animated (and has missing tiles). | 1549 // time it animated (and has missing tiles). |
1536 result = host_impl_->PrepareToDraw(&frame); | 1550 result = host_impl_->PrepareToDraw(&frame); |
1537 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, result); | 1551 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, result); |
1538 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); | 1552 EXPECT_FALSE(child->was_ever_ready_since_last_transform_animation()); |
1539 host_impl_->DidDrawAllLayers(frame); | 1553 host_impl_->DidDrawAllLayers(frame); |
1540 | 1554 |
1541 child->set_has_missing_tiles(false); | 1555 child->set_has_missing_tiles(false); |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, | 3534 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
3521 int id, | 3535 int id, |
3522 bool tile_missing, | 3536 bool tile_missing, |
3523 bool had_incomplete_tile, | 3537 bool had_incomplete_tile, |
3524 bool animating, | 3538 bool animating, |
3525 ResourceProvider* resource_provider, | 3539 ResourceProvider* resource_provider, |
3526 scoped_refptr<AnimationTimeline> timeline) | 3540 scoped_refptr<AnimationTimeline> timeline) |
3527 : DidDrawCheckLayer(tree_impl, id), | 3541 : DidDrawCheckLayer(tree_impl, id), |
3528 tile_missing_(tile_missing), | 3542 tile_missing_(tile_missing), |
3529 had_incomplete_tile_(had_incomplete_tile) { | 3543 had_incomplete_tile_(had_incomplete_tile) { |
3530 if (animating) | 3544 if (animating) { |
3531 AddAnimatedTransformToLayerWithPlayer(this->id(), timeline, 10.0, 3, 0); | 3545 this->SetElementId(LayerIdToElementIdForTesting(id)); |
| 3546 AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline, |
| 3547 10.0, 3, 0); |
| 3548 } |
3532 } | 3549 } |
3533 | 3550 |
3534 bool tile_missing_; | 3551 bool tile_missing_; |
3535 bool had_incomplete_tile_; | 3552 bool had_incomplete_tile_; |
3536 }; | 3553 }; |
3537 | 3554 |
3538 struct PrepareToDrawSuccessTestCase { | 3555 struct PrepareToDrawSuccessTestCase { |
3539 struct State { | 3556 struct State { |
3540 bool has_missing_tile = false; | 3557 bool has_missing_tile = false; |
3541 bool has_incomplete_tile = false; | 3558 bool has_incomplete_tile = false; |
(...skipping 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9685 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)).thread); | 9702 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)).thread); |
9686 | 9703 |
9687 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); | 9704 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
9688 | 9705 |
9689 begin_frame_args.frame_time = start_time; | 9706 begin_frame_args.frame_time = start_time; |
9690 host_impl_->WillBeginImplFrame(begin_frame_args); | 9707 host_impl_->WillBeginImplFrame(begin_frame_args); |
9691 host_impl_->Animate(); | 9708 host_impl_->Animate(); |
9692 host_impl_->UpdateAnimationState(true); | 9709 host_impl_->UpdateAnimationState(true); |
9693 | 9710 |
9694 EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty( | 9711 EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty( |
9695 scrolling_layer->id(), TargetProperty::SCROLL_OFFSET)); | 9712 scrolling_layer->element_id(), TargetProperty::SCROLL_OFFSET)); |
9696 | 9713 |
9697 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); | 9714 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); |
9698 host_impl_->DidFinishImplFrame(); | 9715 host_impl_->DidFinishImplFrame(); |
9699 | 9716 |
9700 begin_frame_args.frame_time = | 9717 begin_frame_args.frame_time = |
9701 start_time + base::TimeDelta::FromMilliseconds(50); | 9718 start_time + base::TimeDelta::FromMilliseconds(50); |
9702 host_impl_->WillBeginImplFrame(begin_frame_args); | 9719 host_impl_->WillBeginImplFrame(begin_frame_args); |
9703 host_impl_->Animate(); | 9720 host_impl_->Animate(); |
9704 host_impl_->UpdateAnimationState(true); | 9721 host_impl_->UpdateAnimationState(true); |
9705 | 9722 |
(...skipping 12 matching lines...) Expand all Loading... |
9718 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), | 9735 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), |
9719 InputHandler::WHEEL)); | 9736 InputHandler::WHEEL)); |
9720 std::unique_ptr<ScrollState> scroll_state_end = EndState(); | 9737 std::unique_ptr<ScrollState> scroll_state_end = EndState(); |
9721 host_impl_->ScrollEnd(scroll_state_end.get()); | 9738 host_impl_->ScrollEnd(scroll_state_end.get()); |
9722 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), | 9739 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), |
9723 InputHandler::WHEEL)); | 9740 InputHandler::WHEEL)); |
9724 | 9741 |
9725 // The instant scroll should have marked the smooth scroll animation as | 9742 // The instant scroll should have marked the smooth scroll animation as |
9726 // aborted. | 9743 // aborted. |
9727 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( | 9744 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( |
9728 scrolling_layer->id())); | 9745 scrolling_layer->element_id())); |
9729 | 9746 |
9730 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), | 9747 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), |
9731 scrolling_layer->CurrentScrollOffset()); | 9748 scrolling_layer->CurrentScrollOffset()); |
9732 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 9749 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
9733 host_impl_->DidFinishImplFrame(); | 9750 host_impl_->DidFinishImplFrame(); |
9734 } | 9751 } |
9735 | 9752 |
9736 // Test that a smooth scroll offset animation is marked finished when aborted | 9753 // Test that a smooth scroll offset animation is marked finished when aborted |
9737 // with the needs_completion flag. The animation is then finished on the | 9754 // with the needs_completion flag. The animation is then finished on the |
9738 // main thread. | 9755 // main thread. |
(...skipping 17 matching lines...) Expand all Loading... |
9756 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 100)).thread); | 9773 host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 100)).thread); |
9757 | 9774 |
9758 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); | 9775 LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
9759 | 9776 |
9760 begin_frame_args.frame_time = start_time; | 9777 begin_frame_args.frame_time = start_time; |
9761 host_impl_->WillBeginImplFrame(begin_frame_args); | 9778 host_impl_->WillBeginImplFrame(begin_frame_args); |
9762 host_impl_->Animate(); | 9779 host_impl_->Animate(); |
9763 host_impl_->UpdateAnimationState(true); | 9780 host_impl_->UpdateAnimationState(true); |
9764 | 9781 |
9765 EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty( | 9782 EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty( |
9766 scrolling_layer->id(), TargetProperty::SCROLL_OFFSET)); | 9783 scrolling_layer->element_id(), TargetProperty::SCROLL_OFFSET)); |
9767 | 9784 |
9768 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); | 9785 EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); |
9769 host_impl_->DidFinishImplFrame(); | 9786 host_impl_->DidFinishImplFrame(); |
9770 | 9787 |
9771 begin_frame_args.frame_time = | 9788 begin_frame_args.frame_time = |
9772 start_time + base::TimeDelta::FromMilliseconds(50); | 9789 start_time + base::TimeDelta::FromMilliseconds(50); |
9773 host_impl_->WillBeginImplFrame(begin_frame_args); | 9790 host_impl_->WillBeginImplFrame(begin_frame_args); |
9774 host_impl_->Animate(); | 9791 host_impl_->Animate(); |
9775 host_impl_->UpdateAnimationState(true); | 9792 host_impl_->UpdateAnimationState(true); |
9776 | 9793 |
9777 float y = scrolling_layer->CurrentScrollOffset().y(); | 9794 float y = scrolling_layer->CurrentScrollOffset().y(); |
9778 EXPECT_TRUE(y > 1 && y < 49); | 9795 EXPECT_TRUE(y > 1 && y < 49); |
9779 | 9796 |
9780 // Abort animation. | 9797 // Abort animation. |
9781 host_impl_->animation_host()->ScrollAnimationAbort(true /*needs_completion*/); | 9798 host_impl_->animation_host()->ScrollAnimationAbort(true /*needs_completion*/); |
9782 host_impl_->UpdateAnimationState(true); | 9799 host_impl_->UpdateAnimationState(true); |
9783 | 9800 |
9784 // Aborting with the needs completion param should have marked the smooth | 9801 // Aborting with the needs completion param should have marked the smooth |
9785 // scroll animation as finished. | 9802 // scroll animation as finished. |
9786 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( | 9803 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( |
9787 scrolling_layer->id())); | 9804 scrolling_layer->element_id())); |
9788 EXPECT_TRUE(y > 1 && y < 49); | 9805 EXPECT_TRUE(y > 1 && y < 49); |
9789 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 9806 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
9790 host_impl_->DidFinishImplFrame(); | 9807 host_impl_->DidFinishImplFrame(); |
9791 } | 9808 } |
9792 | 9809 |
9793 // Evolved from LayerTreeHostImplTest.ScrollAnimated. | 9810 // Evolved from LayerTreeHostImplTest.ScrollAnimated. |
9794 TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) { | 9811 TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimated) { |
9795 const gfx::Size content_size(1000, 1000); | 9812 const gfx::Size content_size(1000, 1000); |
9796 const gfx::Size viewport_size(500, 500); | 9813 const gfx::Size viewport_size(500, 500); |
9797 CreateBasicVirtualViewportLayers(viewport_size, content_size); | 9814 CreateBasicVirtualViewportLayers(viewport_size, content_size); |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10746 | 10763 |
10747 // Re-initialize with a software output surface. | 10764 // Re-initialize with a software output surface. |
10748 output_surface_ = FakeOutputSurface::CreateSoftware( | 10765 output_surface_ = FakeOutputSurface::CreateSoftware( |
10749 base::WrapUnique(new SoftwareOutputDevice)); | 10766 base::WrapUnique(new SoftwareOutputDevice)); |
10750 host_impl_->InitializeRenderer(output_surface_.get()); | 10767 host_impl_->InitializeRenderer(output_surface_.get()); |
10751 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 10768 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
10752 } | 10769 } |
10753 | 10770 |
10754 } // namespace | 10771 } // namespace |
10755 } // namespace cc | 10772 } // namespace cc |
OLD | NEW |