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

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

Issue 2791933003: setMayNeedPaintInvalidation in setNeedsOverflowRecalcAfterStyleChange() (Closed)
Patch Set: 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/frame/FrameView.h" 5 #include "core/frame/FrameView.h"
6 #include "core/layout/LayoutTestHelper.h" 6 #include "core/layout/LayoutTestHelper.h"
7 #include "core/layout/LayoutView.h" 7 #include "core/layout/LayoutView.h"
8 #include "core/paint/PaintLayer.h"
8 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 namespace { 14 namespace {
14 15
15 class PaintInvalidationTest : public ::testing::WithParamInterface<bool>, 16 class PaintInvalidationTest : public ::testing::WithParamInterface<bool>,
16 private ScopedRootLayerScrollingForTest, 17 private ScopedRootLayerScrollingForTest,
17 public RenderingTest { 18 public RenderingTest {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 &childLayoutView->containerForPaintInvalidation()); 77 &childLayoutView->containerForPaintInvalidation());
77 EXPECT_EQ(LayoutRect(10, 10, 100, 100), childLayoutView->visualRect()); 78 EXPECT_EQ(LayoutRect(10, 10, 100, 100), childLayoutView->visualRect());
78 79
79 iframe->setAttribute(HTMLNames::styleAttr, "border: 20px solid blue"); 80 iframe->setAttribute(HTMLNames::styleAttr, "border: 20px solid blue");
80 document().view()->updateAllLifecyclePhases(); 81 document().view()->updateAllLifecyclePhases();
81 EXPECT_EQ(document().layoutView(), 82 EXPECT_EQ(document().layoutView(),
82 &childLayoutView->containerForPaintInvalidation()); 83 &childLayoutView->containerForPaintInvalidation());
83 EXPECT_EQ(LayoutRect(30, 30, 100, 100), childLayoutView->visualRect()); 84 EXPECT_EQ(LayoutRect(30, 30, 100, 100), childLayoutView->visualRect());
84 }; 85 };
85 86
87 // This is a simlified test case for crbug.com/704182.
chrishtr 2017/04/04 16:26:05 nit: simplified
Xianzhu 2017/04/04 16:58:31 Done.
88 TEST_P(PaintInvalidationTest, InvisibleTransformUnderFixedOnScroll) {
89 enableCompositing();
90 setBodyInnerHTML(
91 "<div style='height: 2000px'></div>"
chrishtr 2017/04/04 16:26:05 This test doesn't seem to result in a user-visible
Xianzhu 2017/04/04 16:58:31 This test case ensures no paint time regression fo
92 "<div id='fixed' style='position: fixed; top: 0; left: 0; width: 100px;"
93 " height: 100px; visibility: hidden'>"
94 " <div id='transform' style='will-change: transform'></div>"
95 "</div>");
96
97 auto& fixed = *document().getElementById("fixed");
98 auto& transform = *document().getElementById("transform");
99 const auto& fixedObject = *fixed.layoutObject();
100 const auto& fixedLayer = *toLayoutBoxModelObject(fixedObject).layer();
101 EXPECT_TRUE(fixedLayer.subtreeIsInvisible());
102
103 document().domWindow()->scrollTo(0, 100);
104 transform.setAttribute(HTMLNames::styleAttr,
105 "transform: translate3d(10px, 20px, 30px)");
106 document().view()->updateLifecycleToCompositingCleanPlusScrolling();
107
108 EXPECT_TRUE(fixedLayer.subtreeIsInvisible());
109 // We skip invisible layers when setting non-composited fixed-position
110 // needing paint invalidation when the frame is scrolled.
111 EXPECT_FALSE(fixedObject.shouldDoFullPaintInvalidation());
112 // This was set when fixedObject is marked needsOverflowRecaldAfterStyleChange
113 // when child changed transform.
114 EXPECT_TRUE(fixedObject.mayNeedPaintInvalidation());
115
116 // We should not repaint anything because all contents are invisible.
117 document().view()->updateAllLifecyclePhasesExceptPaint();
118 EXPECT_FALSE(fixedLayer.needsRepaint());
119 document().view()->updateAllLifecyclePhases();
120 }
121
86 } // namespace 122 } // namespace
87 123
88 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/paint/PaintInvalidator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698