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

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

Issue 2706193003: FrameView: Remove redundant tree walk when unthrottling display:none frames (Closed)
Patch Set: Enums ftw 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/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 74d6575ade2187649b3f4d54e2ef4e59aba9e6d4..bbc356ffc47dab984665558f4d7ec54ca639f0a1 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -1051,4 +1051,36 @@ TEST_P(FrameThrottlingTest, DisplayNoneNotThrottled) {
EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
}
+TEST_P(FrameThrottlingTest, DisplayNoneChildrenRemainThrottled) {
+ // Create two nested frames which are throttled.
+ SimRequest mainResource("https://example.com/", "text/html");
+ SimRequest frameResource("https://example.com/iframe.html", "text/html");
+ SimRequest childFrameResource("https://example.com/child-iframe.html",
+ "text/html");
+
+ loadURL("https://example.com/");
+ mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>");
+ frameResource.complete(
+ "<iframe id=child-frame sandbox src=child-iframe.html></iframe>");
+ childFrameResource.complete("");
+
+ // Move both frames offscreen to make them throttled.
+ auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
+ auto* childFrameElement = toHTMLIFrameElement(
+ frameElement->contentDocument()->getElementById("child-frame"));
+ frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
+ compositeFrame();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
+ EXPECT_TRUE(
+ childFrameElement->contentDocument()->view()->canThrottleRendering());
+
+ // Setting display:none for the parent frame unthrottles the parent but not
+ // the child. This behavior matches Safari.
+ frameElement->setAttribute(styleAttr, "display: none");
+ compositeFrame();
+ EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
+ EXPECT_TRUE(
+ childFrameElement->contentDocument()->view()->canThrottleRendering());
+}
+
} // 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