Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp

Issue 2831683003: Refactor to centralize code which decides whether ObjectPaintProperties are needed. (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties());
pdr. 2017/04/20 22:56:28 Can you add a comment here so we don't accidentall
chrishtr 2017/04/21 01:20:02 Added comment.
556 } 556 }
557 557
558 TEST_P(PaintPropertyTreeUpdateTest, 558 TEST_P(PaintPropertyTreeUpdateTest,
559 EffectNodeWithAnimationLosesNodeWhenAnimationRemoved) { 559 EffectNodeWithAnimationLosesNodeWhenAnimationRemoved) {
560 LoadTestData("opacity-animation.html"); 560 LoadTestData("opacity-animation.html");
561 Element* target = GetDocument().GetElementById("target"); 561 Element* target = GetDocument().GetElementById("target");
562 const ObjectPaintProperties* properties = 562 const ObjectPaintProperties* properties =
563 target->GetLayoutObject()->PaintProperties(); 563 target->GetLayoutObject()->PaintProperties();
564 EXPECT_TRUE(properties->Effect()->HasDirectCompositingReasons()); 564 EXPECT_TRUE(properties->Effect()->HasDirectCompositingReasons());
565 565
566 // Removing the animation should remove the effect node. 566 // Removing the animation should remove the effect node.
567 target->removeAttribute(HTMLNames::classAttr); 567 target->removeAttribute(HTMLNames::classAttr);
568 GetDocument().View()->UpdateAllLifecyclePhases(); 568 GetDocument().View()->UpdateAllLifecyclePhases();
569 EXPECT_EQ(nullptr, properties->Effect()); 569 EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties());
570 } 570 }
571 571
572 TEST_P(PaintPropertyTreeUpdateTest, 572 TEST_P(PaintPropertyTreeUpdateTest,
573 TransformNodeLosesCompositorElementIdWhenAnimationRemoved) { 573 TransformNodeLosesCompositorElementIdWhenAnimationRemoved) {
574 LoadTestData("transform-animation.html"); 574 LoadTestData("transform-animation.html");
575 575
576 Element* target = GetDocument().GetElementById("target"); 576 Element* target = GetDocument().GetElementById("target");
577 target->setAttribute(HTMLNames::styleAttr, "transform: translateX(2em)"); 577 target->setAttribute(HTMLNames::styleAttr, "transform: translateX(2em)");
578 GetDocument().View()->UpdateAllLifecyclePhases(); 578 GetDocument().View()->UpdateAllLifecyclePhases();
579 579
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 EXPECT_TRUE(transform->FlattensInheritedTransform()); 745 EXPECT_TRUE(transform->FlattensInheritedTransform());
746 746
747 GetDocument().GetElementById("parent")->setAttribute( 747 GetDocument().GetElementById("parent")->setAttribute(
748 HTMLNames::styleAttr, "transform-style: preserve-3d"); 748 HTMLNames::styleAttr, "transform-style: preserve-3d");
749 GetDocument().View()->UpdateAllLifecyclePhases(); 749 GetDocument().View()->UpdateAllLifecyclePhases();
750 EXPECT_EQ(transform, child->PaintProperties()->Transform()); 750 EXPECT_EQ(transform, child->PaintProperties()->Transform());
751 EXPECT_FALSE(transform->FlattensInheritedTransform()); 751 EXPECT_FALSE(transform->FlattensInheritedTransform());
752 } 752 }
753 753
754 } // namespace blink 754 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698