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

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

Issue 2521613003: Add flag for tracking descendant paint property updates (Closed)
Patch Set: Address Xianzhu's comments Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/layout/LayoutTestHelper.h" 5 #include "core/layout/LayoutTestHelper.h"
6 #include "core/layout/LayoutTreeAsText.h" 6 #include "core/layout/LayoutTreeAsText.h"
7 #include "core/layout/api/LayoutViewItem.h" 7 #include "core/layout/api/LayoutViewItem.h"
8 #include "core/paint/ObjectPaintProperties.h" 8 #include "core/paint/ObjectPaintProperties.h"
9 #include "core/paint/PaintPropertyTreePrinter.h" 9 #include "core/paint/PaintPropertyTreePrinter.h"
10 #include "platform/graphics/paint/GeometryMapper.h" 10 #include "platform/graphics/paint/GeometryMapper.h"
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 childProperties->localBorderBoxProperties()->propertyTreeState; 2882 childProperties->localBorderBoxProperties()->propertyTreeState;
2883 EXPECT_EQ(framePreTranslation(), 2883 EXPECT_EQ(framePreTranslation(),
2884 childProperties->paintOffsetTranslation()->parent()); 2884 childProperties->paintOffsetTranslation()->parent());
2885 EXPECT_EQ(childProperties->paintOffsetTranslation(), 2885 EXPECT_EQ(childProperties->paintOffsetTranslation(),
2886 childPaintState.transform()); 2886 childPaintState.transform());
2887 // This will change once we added clip expansion node. 2887 // This will change once we added clip expansion node.
2888 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); 2888 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip());
2889 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); 2889 EXPECT_EQ(filterProperties->effect(), childPaintState.effect());
2890 } 2890 }
2891 2891
2892 TEST_P(PaintPropertyTreeBuilderTest, DescendantNeedsUpdateAcrossFrames) {
2893 setBodyInnerHTML(
2894 "<style>body { margin: 0; }</style>"
2895 "<div id='divWithTransform' style='transform: translate3d(1px,2px,3px);'>"
2896 " <iframe style='border: 7px solid black'></iframe>"
2897 "</div>");
2898 setChildFrameHTML(
2899 "<style>body { margin: 0; }</style><div id='transform' style='transform: "
2900 "translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>");
2901
2902 FrameView* frameView = document().view();
2903 frameView->updateAllLifecyclePhases();
2904
2905 LayoutObject* divWithTransform =
2906 document().getElementById("divWithTransform")->layoutObject();
2907 LayoutObject* childLayoutView = childDocument().layoutView();
2908 LayoutObject* innerDivWithTransform =
2909 childDocument().getElementById("transform")->layoutObject();
2910
2911 // Initially, no objects should need a descendant update.
2912 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2913 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2914 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2915 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2916
2917 // Marking the child div as needing a paint property update should propagate
2918 // up the tree and across frames.
2919 innerDivWithTransform->setNeedsPaintPropertyUpdate();
2920 EXPECT_TRUE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2921 EXPECT_TRUE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2922 EXPECT_TRUE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2923 EXPECT_TRUE(innerDivWithTransform->needsPaintPropertyUpdate());
2924 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2925
2926 // After a lifecycle update, no nodes should need a descendant update.
2927 frameView->updateAllLifecyclePhases();
2928 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2929 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2930 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2931 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2932 }
2933
2892 } // namespace blink 2934 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698