OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/html/HTMLIFrameElement.h" | 5 #include "core/html/HTMLIFrameElement.h" |
6 #include "core/paint/PaintPropertyTreeBuilderTest.h" | 6 #include "core/paint/PaintPropertyTreeBuilderTest.h" |
7 #include "core/paint/PaintPropertyTreePrinter.h" | 7 #include "core/paint/PaintPropertyTreePrinter.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 TransformNodeWithAnimationLosesNodeWhenAnimationRemoved) { | 545 TransformNodeWithAnimationLosesNodeWhenAnimationRemoved) { |
546 LoadTestData("transform-animation.html"); | 546 LoadTestData("transform-animation.html"); |
547 Element* target = GetDocument().GetElementById("target"); | 547 Element* target = GetDocument().GetElementById("target"); |
548 const ObjectPaintProperties* properties = | 548 const ObjectPaintProperties* properties = |
549 target->GetLayoutObject()->PaintProperties(); | 549 target->GetLayoutObject()->PaintProperties(); |
550 EXPECT_TRUE(properties->Transform()->HasDirectCompositingReasons()); | 550 EXPECT_TRUE(properties->Transform()->HasDirectCompositingReasons()); |
551 | 551 |
552 // Removing the animation should remove the transform node. | 552 // Removing the animation should remove the transform node. |
553 target->removeAttribute(HTMLNames::classAttr); | 553 target->removeAttribute(HTMLNames::classAttr); |
554 GetDocument().View()->UpdateAllLifecyclePhases(); | 554 GetDocument().View()->UpdateAllLifecyclePhases(); |
555 EXPECT_EQ(nullptr, properties->Transform()); | 555 // Ensure the paint properties object was cleared as it is no longer needed. |
| 556 EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties()); |
556 } | 557 } |
557 | 558 |
558 TEST_P(PaintPropertyTreeUpdateTest, | 559 TEST_P(PaintPropertyTreeUpdateTest, |
559 EffectNodeWithAnimationLosesNodeWhenAnimationRemoved) { | 560 EffectNodeWithAnimationLosesNodeWhenAnimationRemoved) { |
560 LoadTestData("opacity-animation.html"); | 561 LoadTestData("opacity-animation.html"); |
561 Element* target = GetDocument().GetElementById("target"); | 562 Element* target = GetDocument().GetElementById("target"); |
562 const ObjectPaintProperties* properties = | 563 const ObjectPaintProperties* properties = |
563 target->GetLayoutObject()->PaintProperties(); | 564 target->GetLayoutObject()->PaintProperties(); |
564 EXPECT_TRUE(properties->Effect()->HasDirectCompositingReasons()); | 565 EXPECT_TRUE(properties->Effect()->HasDirectCompositingReasons()); |
565 | 566 |
566 // Removing the animation should remove the effect node. | 567 // Removing the animation should remove the effect node. |
567 target->removeAttribute(HTMLNames::classAttr); | 568 target->removeAttribute(HTMLNames::classAttr); |
568 GetDocument().View()->UpdateAllLifecyclePhases(); | 569 GetDocument().View()->UpdateAllLifecyclePhases(); |
569 EXPECT_EQ(nullptr, properties->Effect()); | 570 EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties()); |
570 } | 571 } |
571 | 572 |
572 TEST_P(PaintPropertyTreeUpdateTest, | 573 TEST_P(PaintPropertyTreeUpdateTest, |
573 TransformNodeLosesCompositorElementIdWhenAnimationRemoved) { | 574 TransformNodeLosesCompositorElementIdWhenAnimationRemoved) { |
574 LoadTestData("transform-animation.html"); | 575 LoadTestData("transform-animation.html"); |
575 | 576 |
576 Element* target = GetDocument().GetElementById("target"); | 577 Element* target = GetDocument().GetElementById("target"); |
577 target->setAttribute(HTMLNames::styleAttr, "transform: translateX(2em)"); | 578 target->setAttribute(HTMLNames::styleAttr, "transform: translateX(2em)"); |
578 GetDocument().View()->UpdateAllLifecyclePhases(); | 579 GetDocument().View()->UpdateAllLifecyclePhases(); |
579 | 580 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 EXPECT_TRUE(transform->FlattensInheritedTransform()); | 746 EXPECT_TRUE(transform->FlattensInheritedTransform()); |
746 | 747 |
747 GetDocument().GetElementById("parent")->setAttribute( | 748 GetDocument().GetElementById("parent")->setAttribute( |
748 HTMLNames::styleAttr, "transform-style: preserve-3d"); | 749 HTMLNames::styleAttr, "transform-style: preserve-3d"); |
749 GetDocument().View()->UpdateAllLifecyclePhases(); | 750 GetDocument().View()->UpdateAllLifecyclePhases(); |
750 EXPECT_EQ(transform, child->PaintProperties()->Transform()); | 751 EXPECT_EQ(transform, child->PaintProperties()->Transform()); |
751 EXPECT_FALSE(transform->FlattensInheritedTransform()); | 752 EXPECT_FALSE(transform->FlattensInheritedTransform()); |
752 } | 753 } |
753 | 754 |
754 } // namespace blink | 755 } // namespace blink |
OLD | NEW |