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

Unified Diff: third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp

Issue 1603983002: Fix partial painting with render pipeline throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo changes to LayerTreeAsText. Created 4 years, 11 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/paint/PaintLayerPainter.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/web/tests/FrameThrottlingTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
index beca4dd5faba0d8e57f0e39b2aa12e710fb4f5f1..3abba531aa294a7551677efcb89e801e0d5cd4f8 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -211,7 +211,7 @@ TEST_F(FrameThrottlingTest, MutatingThrottledFrameDoesNotCauseAnimation)
frameElement->contentDocument()->documentElement()->setAttribute(styleAttr, "background: green");
EXPECT_FALSE(compositor().needsAnimate());
- // Moving the frame back on screen to unthrottle it.
+ // Move the frame back on screen to unthrottle it.
frameElement->setAttribute(styleAttr, "");
EXPECT_TRUE(compositor().needsAnimate());
@@ -251,6 +251,65 @@ TEST_F(FrameThrottlingTest, SynchronousLayoutInThrottledFrame)
EXPECT_EQ(50, divElement->clientWidth());
}
+TEST_F(FrameThrottlingTest, UnthrottlingTriggersRepaint)
+{
+ // Create a hidden frame which is throttled.
+ SimRequest mainResource("https://example.com/", "text/html");
+ SimRequest frameResource("https://example.com/iframe.html", "text/html");
+
+ loadURL("https://example.com/");
+ mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>");
+ frameResource.complete("<style> html { background: green; } </style>");
+
+ // Move the frame offscreen to throttle it.
+ auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
+ frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
+ EXPECT_FALSE(frameElement->contentDocument()->view()->shouldThrottleRendering());
+ compositeFrame();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->shouldThrottleRendering());
+
+ // Scroll down to unthrottle the frame. The first frame we composite after
+ // scrolling won't contain the frame yet, but will schedule another repaint.
+ webView().mainFrameImpl()->frameView()->setScrollPosition(DoublePoint(0, 480), ProgrammaticScroll);
+ auto displayItems = compositeFrame();
+ EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
+
+ // Now the frame contents should be visible again.
+ auto displayItems2 = compositeFrame();
+ EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
+}
+
+TEST_F(FrameThrottlingTest, ChangeStyleInThrottledFrame)
+{
+ // Create a hidden frame which is throttled.
+ SimRequest mainResource("https://example.com/", "text/html");
+ SimRequest frameResource("https://example.com/iframe.html", "text/html");
+
+ loadURL("https://example.com/");
+ mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>");
+ frameResource.complete("<style> html { background: red; } </style>");
+
+ // Move the frame offscreen to throttle it.
+ auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
+ frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
+ EXPECT_FALSE(frameElement->contentDocument()->view()->shouldThrottleRendering());
+ compositeFrame();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->shouldThrottleRendering());
+
+ // Change the background color of the frame's contents from red to green.
+ frameElement->contentDocument()->body()->setAttribute(styleAttr, "background: green");
+
+ // Scroll down to unthrottle the frame.
+ webView().mainFrameImpl()->frameView()->setScrollPosition(DoublePoint(0, 480), ProgrammaticScroll);
+ auto displayItems = compositeFrame();
+ EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "red"));
+ EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
+
+ // Make sure the new style shows up instead of the old one.
+ auto displayItems2 = compositeFrame();
+ EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
+}
+
TEST(RemoteFrameThrottlingTest, ThrottledLocalRoot)
{
FrameTestHelpers::TestWebViewClient viewClient;
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698