Chromium Code Reviews| 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 |