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

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

Issue 2658063002: FrameView: Don't throttle display:none frames (Closed)
Patch Set: Created 3 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
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 585b1e8b770cdd16cd13057670d708ef477ca809..c9c898fa1d927b9dbacf4893b17f21ca47ef56dd 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -977,4 +977,25 @@ TEST_F(FrameThrottlingTest, UpdatePaintPropertiesOnUnthrottling) {
innerDiv->layoutObject()->paintProperties()->transform()->matrix());
}
+TEST_F(FrameThrottlingTest, DisplayNoneNotThrottled) {
+ SimRequest mainResource("https://example.com/", "text/html");
+
+ loadURL("https://example.com/");
+ mainResource.complete(
+ "<style>iframe { transform: translateY(480px); }</style>"
+ "<iframe sandbox id=frame></iframe>");
+
+ auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
+ auto* frameDocument = frameElement->contentDocument();
+
+ // Initially the frame is throttled as it is offscreen.
+ compositeFrame();
+ EXPECT_TRUE(frameDocument->view()->canThrottleRendering());
+
+ // Setting display:none unthrottles the frame.
+ frameElement->setAttribute(styleAttr, "display: none");
+ compositeFrame();
+ EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698