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

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: 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 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled()); 2608 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled());
2609 EXPECT_FALSE(overflowA->layoutObject() 2609 EXPECT_FALSE(overflowA->layoutObject()
2610 ->paintProperties() 2610 ->paintProperties()
2611 ->scroll() 2611 ->scroll()
2612 ->threadedScrollingDisabled()); 2612 ->threadedScrollingDisabled());
2613 2613
2614 document().settings()->setThreadedScrollingEnabled(false); 2614 document().settings()->setThreadedScrollingEnabled(false);
2615 // TODO(pdr): The main thread scrolling setting should invalidate properties. 2615 // TODO(pdr): The main thread scrolling setting should invalidate properties.
2616 document().view()->setNeedsPaintPropertyUpdate(); 2616 document().view()->setNeedsPaintPropertyUpdate();
2617 overflowA->layoutObject()->setNeedsPaintPropertyUpdate(); 2617 overflowA->layoutObject()->setNeedsPaintPropertyUpdate();
2618 overflowA->layoutObject()->setAllAncestorsNeedPaintPropertyUpdate();
Xianzhu 2016/11/21 19:41:34 Isn't the above call redundant?
pdr. 2016/11/22 02:55:35 This is not needed yet so I have removed it from t
2618 document().view()->updateAllLifecyclePhases(); 2619 document().view()->updateAllLifecyclePhases();
2619 2620
2620 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled()); 2621 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled());
2621 EXPECT_TRUE(overflowA->layoutObject() 2622 EXPECT_TRUE(overflowA->layoutObject()
2622 ->paintProperties() 2623 ->paintProperties()
2623 ->scroll() 2624 ->scroll()
2624 ->threadedScrollingDisabled()); 2625 ->threadedScrollingDisabled());
2625 } 2626 }
2626 2627
2627 TEST_P(PaintPropertyTreeBuilderTest, 2628 TEST_P(PaintPropertyTreeBuilderTest,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 childProperties->localBorderBoxProperties()->propertyTreeState; 2883 childProperties->localBorderBoxProperties()->propertyTreeState;
2883 EXPECT_EQ(framePreTranslation(), 2884 EXPECT_EQ(framePreTranslation(),
2884 childProperties->paintOffsetTranslation()->parent()); 2885 childProperties->paintOffsetTranslation()->parent());
2885 EXPECT_EQ(childProperties->paintOffsetTranslation(), 2886 EXPECT_EQ(childProperties->paintOffsetTranslation(),
2886 childPaintState.transform()); 2887 childPaintState.transform());
2887 // This will change once we added clip expansion node. 2888 // This will change once we added clip expansion node.
2888 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); 2889 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip());
2889 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); 2890 EXPECT_EQ(filterProperties->effect(), childPaintState.effect());
2890 } 2891 }
2891 2892
2893 TEST_P(PaintPropertyTreeBuilderTest, DescendantNeedsUpdateAcrossFrames) {
2894 setBodyInnerHTML(
2895 "<style>body { margin: 0; }</style>"
2896 "<div id='divWithTransform' style='transform: translate3d(1px,2px,3px);'>"
2897 " <iframe style='border: 7px solid black'></iframe>"
2898 "</div>");
2899 setChildFrameHTML(
2900 "<style>body { margin: 0; }</style><div id='transform' style='transform: "
2901 "translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>");
2902
2903 FrameView* frameView = document().view();
2904 frameView->updateAllLifecyclePhases();
2905
2906 LayoutObject* divWithTransform =
2907 document().getElementById("divWithTransform")->layoutObject();
2908 LayoutObject* childLayoutView = childDocument().layoutView();
2909 LayoutObject* innerDivWithTransform =
2910 childDocument().getElementById("transform")->layoutObject();
2911
2912 // Initially, no objects should need a descendant update.
2913 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2914 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2915 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2916 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2917
2918 // Marking the child div as needing a paint property update should propagate
2919 // up the tree and across frames.
2920 innerDivWithTransform->setNeedsPaintPropertyUpdate();
2921 EXPECT_TRUE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2922 EXPECT_TRUE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2923 EXPECT_TRUE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2924 EXPECT_TRUE(innerDivWithTransform->needsPaintPropertyUpdate());
2925 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2926
2927 // After a lifecycle update, no nodes should need a descendant update.
2928 frameView->updateAllLifecyclePhases();
2929 EXPECT_FALSE(document().layoutView()->descendantNeedsPaintPropertyUpdate());
2930 EXPECT_FALSE(divWithTransform->descendantNeedsPaintPropertyUpdate());
2931 EXPECT_FALSE(childLayoutView->descendantNeedsPaintPropertyUpdate());
2932 EXPECT_FALSE(innerDivWithTransform->descendantNeedsPaintPropertyUpdate());
2933 }
2934
2892 } // namespace blink 2935 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698