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

Unified Diff: third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp

Issue 2791933003: setMayNeedPaintInvalidation in setNeedsOverflowRecalcAfterStyleChange() (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
index fec7da7f3dc64a230c15e546ae03d570470a330b..4030e56a4dc85e3ded2a1ddbb7791ea2b1d74b4f 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
@@ -5,6 +5,7 @@
#include "core/frame/FrameView.h"
#include "core/layout/LayoutTestHelper.h"
#include "core/layout/LayoutView.h"
+#include "core/paint/PaintLayer.h"
#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -83,6 +84,41 @@ TEST_P(PaintInvalidationTest, UpdateVisualRectOnFrameBorderWidthChange) {
EXPECT_EQ(LayoutRect(30, 30, 100, 100), childLayoutView->visualRect());
};
+// 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.
+TEST_P(PaintInvalidationTest, InvisibleTransformUnderFixedOnScroll) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<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
+ "<div id='fixed' style='position: fixed; top: 0; left: 0; width: 100px;"
+ " height: 100px; visibility: hidden'>"
+ " <div id='transform' style='will-change: transform'></div>"
+ "</div>");
+
+ auto& fixed = *document().getElementById("fixed");
+ auto& transform = *document().getElementById("transform");
+ const auto& fixedObject = *fixed.layoutObject();
+ const auto& fixedLayer = *toLayoutBoxModelObject(fixedObject).layer();
+ EXPECT_TRUE(fixedLayer.subtreeIsInvisible());
+
+ document().domWindow()->scrollTo(0, 100);
+ transform.setAttribute(HTMLNames::styleAttr,
+ "transform: translate3d(10px, 20px, 30px)");
+ document().view()->updateLifecycleToCompositingCleanPlusScrolling();
+
+ EXPECT_TRUE(fixedLayer.subtreeIsInvisible());
+ // We skip invisible layers when setting non-composited fixed-position
+ // needing paint invalidation when the frame is scrolled.
+ EXPECT_FALSE(fixedObject.shouldDoFullPaintInvalidation());
+ // This was set when fixedObject is marked needsOverflowRecaldAfterStyleChange
+ // when child changed transform.
+ EXPECT_TRUE(fixedObject.mayNeedPaintInvalidation());
+
+ // We should not repaint anything because all contents are invisible.
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+ EXPECT_FALSE(fixedLayer.needsRepaint());
+ document().view()->updateAllLifecyclePhases();
+}
+
} // namespace
} // namespace blink
« 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