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

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

Issue 2713773003: Add test for paint underinvalidation fix with animated transform overflow. (Closed)
Patch Set: Set style attribute in test Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..5743de1bcad50ecfccb442d6d6bfd859ae7a6ba5
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidationTest.cpp
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/frame/FrameView.h"
+#include "core/layout/LayoutTestHelper.h"
+#include "core/layout/LayoutView.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+namespace {
+
+class PaintInvalidationTest : public RenderingTest {
+ public:
+ PaintInvalidationTest()
+ : RenderingTest(SingleChildLocalFrameClient::create()) {}
+};
+
+// 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) {
+ document().page()->settings().setViewportEnabled(true);
+ setBodyInnerHTML(
+ "<!DOCTYPE html>"
+ "<style type='text/css'>"
+ " body, html {"
+ " width: 100%;"
+ " height: 100%;"
+ " margin: 0px;"
+ " }"
+ " #container {"
+ " width: 100%;"
+ " height: 100%;"
+ " }"
+ "</style>"
+ "<div id='container'></div>");
+
+ document().view()->updateAllLifecyclePhases();
+
+ ScrollableArea* scrollableArea = document().view();
+ ASSERT_EQ(scrollableArea->maximumScrollOffset().height(), 0);
+ EXPECT_FALSE(document().layoutView()->mayNeedPaintInvalidation());
+
+ Element* container = document().getElementById("container");
+ container->setAttribute(HTMLNames::styleAttr,
+ "transform: translateY(1000px);");
+ document().updateStyleAndLayoutTree();
+
+ EXPECT_EQ(scrollableArea->maximumScrollOffset().height(), 1000);
+ EXPECT_TRUE(document().layoutView()->mayNeedPaintInvalidation());
+}
+
+} // namespace
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698