| 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_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 7359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7370 | 7370 |
| 7371 SetLayerPropertiesForTesting(grand_child_raw, identity_matrix, gfx::Point3F(), | 7371 SetLayerPropertiesForTesting(grand_child_raw, identity_matrix, gfx::Point3F(), |
| 7372 gfx::PointF(), gfx::Size(1, 2), true, false, | 7372 gfx::PointF(), gfx::Size(1, 2), true, false, |
| 7373 false); | 7373 false); |
| 7374 | 7374 |
| 7375 host_impl.active_tree()->SetRootLayerForTesting(std::move(grand_parent)); | 7375 host_impl.active_tree()->SetRootLayerForTesting(std::move(grand_parent)); |
| 7376 | 7376 |
| 7377 ExecuteCalculateDrawProperties(grand_parent_raw); | 7377 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7378 | 7378 |
| 7379 // No layers have animations. | 7379 // No layers have animations. |
| 7380 EXPECT_EQ( | 7380 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7381 0.f, | 7381 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7382 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7382 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7383 EXPECT_EQ(0.f, | 7383 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7384 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7385 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7386 EXPECT_EQ( | |
| 7387 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7388 | 7384 |
| 7389 EXPECT_EQ( | 7385 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7390 0.f, | 7386 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7391 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7387 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7392 EXPECT_EQ(0.f, | 7388 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7393 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7394 EXPECT_EQ(0.f, | |
| 7395 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7396 EXPECT_EQ( | |
| 7397 0.f, | |
| 7398 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7399 | 7389 |
| 7400 TransformOperations translation; | 7390 TransformOperations translation; |
| 7401 translation.AppendTranslate(1.f, 2.f, 3.f); | 7391 translation.AppendTranslate(1.f, 2.f, 3.f); |
| 7402 | 7392 |
| 7403 scoped_refptr<AnimationTimeline> timeline; | 7393 scoped_refptr<AnimationTimeline> timeline; |
| 7404 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 7394 timeline = AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 7405 host_impl.animation_host()->AddAnimationTimeline(timeline); | 7395 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 7406 | 7396 |
| 7407 host_impl.active_tree()->SetElementIdsForTesting(); | 7397 host_impl.active_tree()->SetElementIdsForTesting(); |
| 7408 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, | 7398 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7409 1.0, TransformOperations(), | 7399 1.0, TransformOperations(), |
| 7410 translation); | 7400 translation); |
| 7411 | 7401 |
| 7412 // No layers have scale-affecting animations. | 7402 // No layers have scale-affecting animations. |
| 7413 EXPECT_EQ( | 7403 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7414 0.f, | 7404 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7415 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7405 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7416 EXPECT_EQ(0.f, | 7406 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7417 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7418 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7419 EXPECT_EQ( | |
| 7420 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7421 | 7407 |
| 7422 EXPECT_EQ( | 7408 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7423 0.f, | 7409 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7424 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7410 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7425 EXPECT_EQ(0.f, | 7411 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7426 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7427 EXPECT_EQ(0.f, | |
| 7428 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7429 EXPECT_EQ( | |
| 7430 0.f, | |
| 7431 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7432 | 7412 |
| 7433 TransformOperations scale; | 7413 TransformOperations scale; |
| 7434 scale.AppendScale(5.f, 4.f, 3.f); | 7414 scale.AppendScale(5.f, 4.f, 3.f); |
| 7435 | 7415 |
| 7436 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, | 7416 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| 7437 1.0, TransformOperations(), scale); | 7417 1.0, TransformOperations(), scale); |
| 7438 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7418 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7439 ExecuteCalculateDrawProperties(grand_parent_raw); | 7419 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7440 | 7420 |
| 7441 // Only |child| has a scale-affecting animation. | 7421 // Only |child| has a scale-affecting animation. |
| 7442 EXPECT_EQ( | 7422 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7443 0.f, | 7423 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7444 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7424 EXPECT_EQ(5.f, GetMaximumAnimationScale(child_raw)); |
| 7445 EXPECT_EQ(0.f, | 7425 EXPECT_EQ(5.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7446 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7447 EXPECT_EQ(5.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7448 EXPECT_EQ( | |
| 7449 5.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7450 | 7426 |
| 7451 EXPECT_EQ( | 7427 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7452 0.f, | 7428 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7453 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7429 EXPECT_EQ(1.f, GetStartingAnimationScale(child_raw)); |
| 7454 EXPECT_EQ(0.f, | 7430 EXPECT_EQ(1.f, GetStartingAnimationScale(grand_child_raw)); |
| 7455 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7456 EXPECT_EQ(1.f, | |
| 7457 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7458 EXPECT_EQ( | |
| 7459 1.f, | |
| 7460 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7461 | 7431 |
| 7462 AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(), | 7432 AddAnimatedTransformToElementWithPlayer(grand_parent_raw->element_id(), |
| 7463 timeline, 1.0, TransformOperations(), | 7433 timeline, 1.0, TransformOperations(), |
| 7464 scale); | 7434 scale); |
| 7465 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7435 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7466 ExecuteCalculateDrawProperties(grand_parent_raw); | 7436 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7467 | 7437 |
| 7468 // |grand_parent| and |child| have scale-affecting animations. | 7438 // |grand_parent| and |child| have scale-affecting animations. |
| 7469 EXPECT_EQ( | 7439 EXPECT_EQ(5.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7470 5.f, | 7440 EXPECT_EQ(5.f, GetMaximumAnimationScale(parent_raw)); |
| 7471 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7472 EXPECT_EQ(5.f, | |
| 7473 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7474 // We don't support combining animated scales from two nodes; 0.f means | 7441 // We don't support combining animated scales from two nodes; 0.f means |
| 7475 // that the maximum scale could not be computed. | 7442 // that the maximum scale could not be computed. |
| 7476 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7443 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7477 EXPECT_EQ( | 7444 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7478 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7479 | 7445 |
| 7480 EXPECT_EQ( | 7446 EXPECT_EQ(1.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7481 1.f, | 7447 EXPECT_EQ(1.f, GetStartingAnimationScale(parent_raw)); |
| 7482 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7448 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7483 EXPECT_EQ(1.f, | 7449 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7484 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7485 EXPECT_EQ(0.f, | |
| 7486 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7487 EXPECT_EQ( | |
| 7488 0.f, | |
| 7489 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7490 | 7450 |
| 7491 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, | 7451 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7492 1.0, TransformOperations(), scale); | 7452 1.0, TransformOperations(), scale); |
| 7493 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7453 parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7494 ExecuteCalculateDrawProperties(grand_parent_raw); | 7454 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7495 | 7455 |
| 7496 // |grand_parent|, |parent|, and |child| have scale-affecting animations. | 7456 // |grand_parent|, |parent|, and |child| have scale-affecting animations. |
| 7497 EXPECT_EQ( | 7457 EXPECT_EQ(5.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7498 5.f, | 7458 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7499 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7459 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7500 EXPECT_EQ(0.f, | 7460 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7501 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7502 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7503 EXPECT_EQ( | |
| 7504 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7505 | 7461 |
| 7506 EXPECT_EQ( | 7462 EXPECT_EQ(1.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7507 1.f, | 7463 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7508 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7464 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7509 EXPECT_EQ(0.f, | 7465 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7510 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7511 EXPECT_EQ(0.f, | |
| 7512 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7513 EXPECT_EQ( | |
| 7514 0.f, | |
| 7515 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7516 | 7466 |
| 7517 AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline, | 7467 AbortAnimationsOnElementWithPlayer(grand_parent_raw->element_id(), timeline, |
| 7518 TargetProperty::TRANSFORM); | 7468 TargetProperty::TRANSFORM); |
| 7519 AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline, | 7469 AbortAnimationsOnElementWithPlayer(parent_raw->element_id(), timeline, |
| 7520 TargetProperty::TRANSFORM); | 7470 TargetProperty::TRANSFORM); |
| 7521 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, | 7471 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| 7522 TargetProperty::TRANSFORM); | 7472 TargetProperty::TRANSFORM); |
| 7523 | 7473 |
| 7524 TransformOperations perspective; | 7474 TransformOperations perspective; |
| 7525 perspective.AppendPerspective(10.f); | 7475 perspective.AppendPerspective(10.f); |
| 7526 | 7476 |
| 7527 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, | 7477 AddAnimatedTransformToElementWithPlayer(child_raw->element_id(), timeline, |
| 7528 1.0, TransformOperations(), | 7478 1.0, TransformOperations(), |
| 7529 perspective); | 7479 perspective); |
| 7530 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7480 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7531 ExecuteCalculateDrawProperties(grand_parent_raw); | 7481 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7532 | 7482 |
| 7533 // |child| has a scale-affecting animation but computing the maximum of this | 7483 // |child| has a scale-affecting animation but computing the maximum of this |
| 7534 // animation is not supported. | 7484 // animation is not supported. |
| 7535 EXPECT_EQ( | 7485 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7536 0.f, | 7486 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7537 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7487 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7538 EXPECT_EQ(0.f, | 7488 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7539 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7540 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7541 EXPECT_EQ( | |
| 7542 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7543 | 7489 |
| 7544 EXPECT_EQ( | 7490 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7545 0.f, | 7491 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7546 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7492 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7547 EXPECT_EQ(0.f, | 7493 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7548 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7549 EXPECT_EQ(0.f, | |
| 7550 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7551 EXPECT_EQ( | |
| 7552 0.f, | |
| 7553 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7554 | 7494 |
| 7555 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, | 7495 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, |
| 7556 TargetProperty::TRANSFORM); | 7496 TargetProperty::TRANSFORM); |
| 7557 gfx::Transform scale_matrix; | 7497 gfx::Transform scale_matrix; |
| 7558 scale_matrix.Scale(1.f, 2.f); | 7498 scale_matrix.Scale(1.f, 2.f); |
| 7559 grand_parent_raw->SetTransform(scale_matrix); | 7499 grand_parent_raw->SetTransform(scale_matrix); |
| 7560 parent_raw->SetTransform(scale_matrix); | 7500 parent_raw->SetTransform(scale_matrix); |
| 7561 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7501 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7562 | 7502 |
| 7563 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, | 7503 AddAnimatedTransformToElementWithPlayer(parent_raw->element_id(), timeline, |
| 7564 1.0, TransformOperations(), scale); | 7504 1.0, TransformOperations(), scale); |
| 7565 ExecuteCalculateDrawProperties(grand_parent_raw); | 7505 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7566 | 7506 |
| 7567 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale | 7507 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale |
| 7568 // animation with maximum scale 5.f. | 7508 // animation with maximum scale 5.f. |
| 7569 EXPECT_EQ( | 7509 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7570 0.f, | 7510 EXPECT_EQ(10.f, GetMaximumAnimationScale(parent_raw)); |
| 7571 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7511 EXPECT_EQ(10.f, GetMaximumAnimationScale(child_raw)); |
| 7572 EXPECT_EQ(10.f, | 7512 EXPECT_EQ(10.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7573 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7574 EXPECT_EQ(10.f, | |
| 7575 child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7576 EXPECT_EQ( | |
| 7577 10.f, | |
| 7578 grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7579 | 7513 |
| 7580 EXPECT_EQ( | 7514 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7581 0.f, | 7515 EXPECT_EQ(2.f, GetStartingAnimationScale(parent_raw)); |
| 7582 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7516 EXPECT_EQ(2.f, GetStartingAnimationScale(child_raw)); |
| 7583 EXPECT_EQ(2.f, | 7517 EXPECT_EQ(2.f, GetStartingAnimationScale(grand_child_raw)); |
| 7584 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7585 EXPECT_EQ(2.f, | |
| 7586 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7587 EXPECT_EQ( | |
| 7588 2.f, | |
| 7589 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7590 | 7518 |
| 7591 gfx::Transform perspective_matrix; | 7519 gfx::Transform perspective_matrix; |
| 7592 perspective_matrix.ApplyPerspectiveDepth(2.f); | 7520 perspective_matrix.ApplyPerspectiveDepth(2.f); |
| 7593 child_raw->SetTransform(perspective_matrix); | 7521 child_raw->SetTransform(perspective_matrix); |
| 7594 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7522 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7595 ExecuteCalculateDrawProperties(grand_parent_raw); | 7523 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7596 | 7524 |
| 7597 // |child| has a transform that's neither a translation nor a scale. | 7525 // |child| has a transform that's neither a translation nor a scale. |
| 7598 EXPECT_EQ( | 7526 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7599 0.f, | 7527 EXPECT_EQ(10.f, GetMaximumAnimationScale(parent_raw)); |
| 7600 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7528 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7601 EXPECT_EQ(10.f, | 7529 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7602 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7603 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7604 EXPECT_EQ( | |
| 7605 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7606 | 7530 |
| 7607 EXPECT_EQ( | 7531 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7608 0.f, | 7532 EXPECT_EQ(2.f, GetStartingAnimationScale(parent_raw)); |
| 7609 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7533 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7610 EXPECT_EQ(2.f, | 7534 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7611 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7612 EXPECT_EQ(0.f, | |
| 7613 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7614 EXPECT_EQ( | |
| 7615 0.f, | |
| 7616 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7617 | 7535 |
| 7618 parent_raw->SetTransform(perspective_matrix); | 7536 parent_raw->SetTransform(perspective_matrix); |
| 7619 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7537 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7620 ExecuteCalculateDrawProperties(grand_parent_raw); | 7538 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7621 | 7539 |
| 7622 // |parent| and |child| have transforms that are neither translations nor | 7540 // |parent| and |child| have transforms that are neither translations nor |
| 7623 // scales. | 7541 // scales. |
| 7624 EXPECT_EQ( | 7542 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7625 0.f, | 7543 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7626 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7544 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7627 EXPECT_EQ(0.f, | 7545 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7628 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7629 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7630 EXPECT_EQ( | |
| 7631 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7632 | 7546 |
| 7633 EXPECT_EQ( | 7547 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7634 0.f, | 7548 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7635 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7549 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7636 EXPECT_EQ(0.f, | 7550 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7637 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7638 EXPECT_EQ(0.f, | |
| 7639 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7640 EXPECT_EQ( | |
| 7641 0.f, | |
| 7642 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7643 | 7551 |
| 7644 parent_raw->SetTransform(identity_matrix); | 7552 parent_raw->SetTransform(identity_matrix); |
| 7645 child_raw->SetTransform(identity_matrix); | 7553 child_raw->SetTransform(identity_matrix); |
| 7646 grand_parent_raw->SetTransform(perspective_matrix); | 7554 grand_parent_raw->SetTransform(perspective_matrix); |
| 7647 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7555 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7648 | 7556 |
| 7649 ExecuteCalculateDrawProperties(grand_parent_raw); | 7557 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7650 | 7558 |
| 7651 // |grand_parent| has a transform that's neither a translation nor a scale. | 7559 // |grand_parent| has a transform that's neither a translation nor a scale. |
| 7652 EXPECT_EQ( | 7560 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7653 0.f, | 7561 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7654 grand_parent_raw->draw_properties().maximum_animation_contents_scale); | 7562 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7655 EXPECT_EQ(0.f, | 7563 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7656 parent_raw->draw_properties().maximum_animation_contents_scale); | |
| 7657 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7658 EXPECT_EQ( | |
| 7659 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | |
| 7660 | 7564 |
| 7661 EXPECT_EQ( | 7565 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7662 0.f, | 7566 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7663 grand_parent_raw->draw_properties().starting_animation_contents_scale); | 7567 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7664 EXPECT_EQ(0.f, | 7568 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7665 parent_raw->draw_properties().starting_animation_contents_scale); | |
| 7666 EXPECT_EQ(0.f, | |
| 7667 child_raw->draw_properties().starting_animation_contents_scale); | |
| 7668 EXPECT_EQ( | |
| 7669 0.f, | |
| 7670 grand_child_raw->draw_properties().starting_animation_contents_scale); | |
| 7671 } | 7569 } |
| 7672 | 7570 |
| 7673 static void GatherDrawnLayers(LayerImplList* rsll, | 7571 static void GatherDrawnLayers(LayerImplList* rsll, |
| 7674 std::set<LayerImpl*>* drawn_layers) { | 7572 std::set<LayerImpl*>* drawn_layers) { |
| 7675 for (LayerIterator it = LayerIterator::Begin(rsll), | 7573 for (LayerIterator it = LayerIterator::Begin(rsll), |
| 7676 end = LayerIterator::End(rsll); | 7574 end = LayerIterator::End(rsll); |
| 7677 it != end; ++it) { | 7575 it != end; ++it) { |
| 7678 LayerImpl* layer = *it; | 7576 LayerImpl* layer = *it; |
| 7679 if (it.represents_itself()) | 7577 if (it.represents_itself()) |
| 7680 drawn_layers->insert(layer); | 7578 drawn_layers->insert(layer); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8014 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7912 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8015 ExecuteCalculateDrawProperties(root_layer); | 7913 ExecuteCalculateDrawProperties(root_layer); |
| 8016 | 7914 |
| 8017 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); | 7915 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); |
| 8018 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); | 7916 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); |
| 8019 EXPECT_FLOAT_EQ( | 7917 EXPECT_FLOAT_EQ( |
| 8020 3.f, | 7918 3.f, |
| 8021 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); | 7919 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); |
| 8022 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); | 7920 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); |
| 8023 | 7921 |
| 8024 EXPECT_FLOAT_EQ( | 7922 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8025 0.f, root_layer->draw_properties().maximum_animation_contents_scale); | 7923 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
| 8026 EXPECT_FLOAT_EQ( | 7924 EXPECT_FLOAT_EQ(8.f, GetMaximumAnimationScale(child2_layer)); |
| 8027 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); | |
| 8028 EXPECT_FLOAT_EQ( | |
| 8029 8.f, child2_layer->draw_properties().maximum_animation_contents_scale); | |
| 8030 | 7925 |
| 8031 // Changing page-scale would affect ideal_contents_scale and | 7926 // Changing page-scale would affect ideal_contents_scale and |
| 8032 // maximum_animation_contents_scale. | 7927 // maximum_animation_contents_scale. |
| 8033 | 7928 |
| 8034 float page_scale_factor = 3.f; | 7929 float page_scale_factor = 3.f; |
| 8035 float device_scale_factor = 1.0f; | 7930 float device_scale_factor = 1.0f; |
| 8036 std::vector<LayerImpl*> render_surface_layer_list; | 7931 std::vector<LayerImpl*> render_surface_layer_list; |
| 8037 gfx::Size device_viewport_size = | 7932 gfx::Size device_viewport_size = |
| 8038 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 7933 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| 8039 root_layer->bounds().height() * device_scale_factor); | 7934 root_layer->bounds().height() * device_scale_factor); |
| 8040 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7935 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 8041 root_layer, device_viewport_size, &render_surface_layer_list); | 7936 root_layer, device_viewport_size, &render_surface_layer_list); |
| 8042 | 7937 |
| 8043 inputs.page_scale_factor = page_scale_factor; | 7938 inputs.page_scale_factor = page_scale_factor; |
| 8044 inputs.can_adjust_raster_scales = true; | 7939 inputs.can_adjust_raster_scales = true; |
| 8045 inputs.page_scale_layer = root_layer; | 7940 inputs.page_scale_layer = root_layer; |
| 8046 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 7941 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
| 8047 | 7942 |
| 8048 EXPECT_FLOAT_EQ(3.f, root_layer->GetIdealContentsScale()); | 7943 EXPECT_FLOAT_EQ(3.f, root_layer->GetIdealContentsScale()); |
| 8049 EXPECT_FLOAT_EQ(9.f, child1_layer->GetIdealContentsScale()); | 7944 EXPECT_FLOAT_EQ(9.f, child1_layer->GetIdealContentsScale()); |
| 8050 EXPECT_FLOAT_EQ( | 7945 EXPECT_FLOAT_EQ( |
| 8051 9.f, | 7946 9.f, |
| 8052 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); | 7947 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); |
| 8053 EXPECT_FLOAT_EQ(9.f, child1_layer->test_properties() | 7948 EXPECT_FLOAT_EQ(9.f, child1_layer->test_properties() |
| 8054 ->replica_layer->test_properties() | 7949 ->replica_layer->test_properties() |
| 8055 ->mask_layer->GetIdealContentsScale()); | 7950 ->mask_layer->GetIdealContentsScale()); |
| 8056 EXPECT_FLOAT_EQ(15.f, child2_layer->GetIdealContentsScale()); | 7951 EXPECT_FLOAT_EQ(15.f, child2_layer->GetIdealContentsScale()); |
| 8057 | 7952 |
| 8058 EXPECT_FLOAT_EQ( | 7953 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8059 0.f, root_layer->draw_properties().maximum_animation_contents_scale); | 7954 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
| 8060 EXPECT_FLOAT_EQ( | 7955 EXPECT_FLOAT_EQ(24.f, GetMaximumAnimationScale(child2_layer)); |
| 8061 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); | |
| 8062 EXPECT_FLOAT_EQ( | |
| 8063 24.f, child2_layer->draw_properties().maximum_animation_contents_scale); | |
| 8064 | 7956 |
| 8065 // Changing device-scale would affect ideal_contents_scale and | 7957 // Changing device-scale would affect ideal_contents_scale and |
| 8066 // maximum_animation_contents_scale. | 7958 // maximum_animation_contents_scale. |
| 8067 | 7959 |
| 8068 device_scale_factor = 4.0f; | 7960 device_scale_factor = 4.0f; |
| 8069 inputs.device_scale_factor = device_scale_factor; | 7961 inputs.device_scale_factor = device_scale_factor; |
| 8070 inputs.can_adjust_raster_scales = true; | 7962 inputs.can_adjust_raster_scales = true; |
| 8071 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7963 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8072 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 7964 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
| 8073 | 7965 |
| 8074 EXPECT_FLOAT_EQ(12.f, root_layer->GetIdealContentsScale()); | 7966 EXPECT_FLOAT_EQ(12.f, root_layer->GetIdealContentsScale()); |
| 8075 EXPECT_FLOAT_EQ(36.f, child1_layer->GetIdealContentsScale()); | 7967 EXPECT_FLOAT_EQ(36.f, child1_layer->GetIdealContentsScale()); |
| 8076 EXPECT_FLOAT_EQ( | 7968 EXPECT_FLOAT_EQ( |
| 8077 36.f, | 7969 36.f, |
| 8078 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); | 7970 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); |
| 8079 EXPECT_FLOAT_EQ(36.f, child1_layer->test_properties() | 7971 EXPECT_FLOAT_EQ(36.f, child1_layer->test_properties() |
| 8080 ->replica_layer->test_properties() | 7972 ->replica_layer->test_properties() |
| 8081 ->mask_layer->GetIdealContentsScale()); | 7973 ->mask_layer->GetIdealContentsScale()); |
| 8082 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); | 7974 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); |
| 8083 | 7975 |
| 8084 EXPECT_FLOAT_EQ( | 7976 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8085 0.f, root_layer->draw_properties().maximum_animation_contents_scale); | 7977 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
| 8086 EXPECT_FLOAT_EQ( | 7978 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); |
| 8087 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); | 7979 } |
| 8088 EXPECT_FLOAT_EQ( | 7980 |
| 8089 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); | 7981 TEST_F(LayerTreeHostCommonTest, AnimationScales) { |
| 7982 FakeImplTaskRunnerProvider task_runner_provider; |
| 7983 TestSharedBitmapManager shared_bitmap_manager; |
| 7984 TestTaskGraphRunner task_graph_runner; |
| 7985 LayerTreeSettings settings = host()->settings(); |
| 7986 settings.layer_transforms_should_scale_layer_contents = true; |
| 7987 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 7988 &shared_bitmap_manager, &task_graph_runner); |
| 7989 |
| 7990 std::unique_ptr<LayerImpl> root = |
| 7991 LayerImpl::Create(host_impl.active_tree(), 1); |
| 7992 LayerImpl* root_layer = root.get(); |
| 7993 std::unique_ptr<LayerImpl> child1 = |
| 7994 LayerImpl::Create(host_impl.active_tree(), 2); |
| 7995 LayerImpl* child1_layer = child1.get(); |
| 7996 std::unique_ptr<LayerImpl> child2 = |
| 7997 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7998 LayerImpl* child2_layer = child2.get(); |
| 7999 |
| 8000 root->test_properties()->AddChild(std::move(child1)); |
| 8001 child1_layer->test_properties()->AddChild(std::move(child2)); |
| 8002 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); |
| 8003 |
| 8004 host_impl.active_tree()->SetElementIdsForTesting(); |
| 8005 |
| 8006 gfx::Transform identity_matrix, scale_transform_child1, |
| 8007 scale_transform_child2; |
| 8008 scale_transform_child1.Scale(2, 3); |
| 8009 scale_transform_child2.Scale(4, 5); |
| 8010 |
| 8011 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), |
| 8012 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 8013 true); |
| 8014 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, |
| 8015 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| 8016 true, false, false); |
| 8017 |
| 8018 TransformOperations scale; |
| 8019 scale.AppendScale(5.f, 8.f, 3.f); |
| 8020 |
| 8021 scoped_refptr<AnimationTimeline> timeline = |
| 8022 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 8023 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 8024 |
| 8025 AddAnimatedTransformToElementWithPlayer(child2_layer->element_id(), timeline, |
| 8026 1.0, TransformOperations(), scale); |
| 8027 |
| 8028 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, |
| 8029 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| 8030 true, false, false); |
| 8031 |
| 8032 // Correctly computes animation scale when rebuilding property trees. |
| 8033 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8034 ExecuteCalculateDrawProperties(root_layer); |
| 8035 |
| 8036 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8037 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
| 8038 EXPECT_FLOAT_EQ(24.f, GetMaximumAnimationScale(child2_layer)); |
| 8039 |
| 8040 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(root_layer)); |
| 8041 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(child1_layer)); |
| 8042 EXPECT_FLOAT_EQ(3.f, GetStartingAnimationScale(child2_layer)); |
| 8043 |
| 8044 // Correctly updates animation scale when layer property changes. |
| 8045 child1_layer->SetTransform(identity_matrix); |
| 8046 child1_layer->UpdatePropertyTreeTransform(); |
| 8047 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = false; |
| 8048 ExecuteCalculateDrawProperties(root_layer); |
| 8049 EXPECT_FLOAT_EQ(8.f, GetMaximumAnimationScale(child2_layer)); |
| 8050 EXPECT_FLOAT_EQ(1.f, GetStartingAnimationScale(child2_layer)); |
| 8051 |
| 8052 // Do not update animation scale if already updated. |
| 8053 host_impl.active_tree()->property_trees()->SetAnimationScalesForTesting( |
| 8054 child2_layer->transform_tree_index(), 100.f, 100.f); |
| 8055 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); |
| 8056 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); |
| 8057 } |
| 8058 |
| 8059 TEST_F(LayerTreeHostCommonTest, |
| 8060 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { |
| 8061 // Returns empty scale if layer_transforms_should_scale_layer_contents is |
| 8062 // false. |
| 8063 FakeImplTaskRunnerProvider task_runner_provider; |
| 8064 TestSharedBitmapManager shared_bitmap_manager; |
| 8065 TestTaskGraphRunner task_graph_runner; |
| 8066 LayerTreeSettings settings = host()->settings(); |
| 8067 settings.layer_transforms_should_scale_layer_contents = false; |
| 8068 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 8069 &shared_bitmap_manager, &task_graph_runner); |
| 8070 |
| 8071 std::unique_ptr<LayerImpl> root = |
| 8072 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8073 LayerImpl* root_layer = root.get(); |
| 8074 std::unique_ptr<LayerImpl> child = |
| 8075 LayerImpl::Create(host_impl.active_tree(), 2); |
| 8076 LayerImpl* child_layer = child.get(); |
| 8077 |
| 8078 root->test_properties()->AddChild(std::move(child)); |
| 8079 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); |
| 8080 |
| 8081 host_impl.active_tree()->SetElementIdsForTesting(); |
| 8082 |
| 8083 gfx::Transform identity_matrix, scale_transform_child; |
| 8084 scale_transform_child.Scale(4, 5); |
| 8085 |
| 8086 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), |
| 8087 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 8088 true); |
| 8089 TransformOperations scale; |
| 8090 scale.AppendScale(5.f, 8.f, 3.f); |
| 8091 |
| 8092 scoped_refptr<AnimationTimeline> timeline = |
| 8093 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 8094 host_impl.animation_host()->AddAnimationTimeline(timeline); |
| 8095 |
| 8096 AddAnimatedTransformToElementWithPlayer(child_layer->element_id(), timeline, |
| 8097 1.0, TransformOperations(), scale); |
| 8098 |
| 8099 SetLayerPropertiesForTesting(child_layer, scale_transform_child, |
| 8100 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
| 8101 true, false, false); |
| 8102 |
| 8103 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8104 ExecuteCalculateDrawProperties(root_layer); |
| 8105 |
| 8106 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8107 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child_layer)); |
| 8108 |
| 8109 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(root_layer)); |
| 8110 EXPECT_FLOAT_EQ(0.f, GetStartingAnimationScale(child_layer)); |
| 8090 } | 8111 } |
| 8091 | 8112 |
| 8092 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { | 8113 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8093 LayerImpl* root = root_layer_for_testing(); | 8114 LayerImpl* root = root_layer_for_testing(); |
| 8094 LayerImpl* clip = AddChild<LayerImpl>(root); | 8115 LayerImpl* clip = AddChild<LayerImpl>(root); |
| 8095 LayerImpl* content = AddChild<LayerImpl>(clip); | 8116 LayerImpl* content = AddChild<LayerImpl>(clip); |
| 8096 | 8117 |
| 8097 const gfx::Transform identity_matrix; | 8118 const gfx::Transform identity_matrix; |
| 8098 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 8119 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| 8099 gfx::PointF(), gfx::Size(768 / 2, 3000), true, | 8120 gfx::PointF(), gfx::Size(768 / 2, 3000), true, |
| (...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10395 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10416 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10396 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10417 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10397 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10418 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10398 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10419 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10399 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10420 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10400 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10421 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10401 } | 10422 } |
| 10402 | 10423 |
| 10403 } // namespace | 10424 } // namespace |
| 10404 } // namespace cc | 10425 } // namespace cc |
| OLD | NEW |