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

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

Issue 2733773004: Add check for missing visual rect updates and fix failures (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 5743de1bcad50ecfccb442d6d6bfd859ae7a6ba5..fec7da7f3dc64a230c15e546ae03d570470a330b 100644
--- a/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
@@ -5,22 +5,28 @@
#include "core/frame/FrameView.h"
#include "core/layout/LayoutTestHelper.h"
#include "core/layout/LayoutView.h"
+#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
namespace {
-class PaintInvalidationTest : public RenderingTest {
+class PaintInvalidationTest : public ::testing::WithParamInterface<bool>,
+ private ScopedRootLayerScrollingForTest,
+ public RenderingTest {
public:
PaintInvalidationTest()
- : RenderingTest(SingleChildLocalFrameClient::create()) {}
+ : ScopedRootLayerScrollingForTest(GetParam()),
+ RenderingTest(SingleChildLocalFrameClient::create()) {}
};
+INSTANTIATE_TEST_CASE_P(All, PaintInvalidationTest, ::testing::Bool());
+
// Changing style in a way that changes overflow without layout should cause
// the layout view to possibly need a paint invalidation since we may have
// revealed additional background that can be scrolled into view.
-TEST_F(PaintInvalidationTest, RecalcOverflowInvalidatesBackground) {
+TEST_P(PaintInvalidationTest, RecalcOverflowInvalidatesBackground) {
document().page()->settings().setViewportEnabled(true);
setBodyInnerHTML(
"<!DOCTYPE html>"
@@ -52,6 +58,31 @@ TEST_F(PaintInvalidationTest, RecalcOverflowInvalidatesBackground) {
EXPECT_TRUE(document().layoutView()->mayNeedPaintInvalidation());
}
+TEST_P(PaintInvalidationTest, UpdateVisualRectOnFrameBorderWidthChange) {
+ // TODO(wangxianzhu): enable for SPv2.
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
+
+ setBodyInnerHTML(
+ "<style>"
+ " body { margin: 10px }"
+ " iframe { width: 100px; height: 100px; border: none; }"
+ "</style>"
+ "<iframe id='iframe'></iframe>");
+
+ Element* iframe = document().getElementById("iframe");
+ LayoutView* childLayoutView = childDocument().layoutView();
+ EXPECT_EQ(document().layoutView(),
+ &childLayoutView->containerForPaintInvalidation());
+ EXPECT_EQ(LayoutRect(10, 10, 100, 100), childLayoutView->visualRect());
+
+ iframe->setAttribute(HTMLNames::styleAttr, "border: 20px solid blue");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(document().layoutView(),
+ &childLayoutView->containerForPaintInvalidation());
+ EXPECT_EQ(LayoutRect(30, 30, 100, 100), childLayoutView->visualRect());
+};
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.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