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

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

Issue 1891453002: Don't try to render composited selection in throttled frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 73fdb7a20d2691f44a11151b6d97d4362385b084..942c1c7ef165f60eebc6f25c304259bba9bd1f76 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -6,6 +6,8 @@
#include "core/dom/Element.h"
#include "core/frame/FrameView.h"
#include "core/html/HTMLIFrameElement.h"
+#include "core/page/FocusController.h"
+#include "core/page/Page.h"
#include "platform/testing/URLTestHelpers.h"
#include "platform/testing/UnitTestHelpers.h"
#include "public/web/WebHitTestResult.h"
@@ -350,6 +352,42 @@ TEST_F(FrameThrottlingTest, ChangeStyleInThrottledFrame)
EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
}
+TEST_F(FrameThrottlingTest, ThrottledFrameWithFocus)
+{
+ webView().settings()->setJavaScriptEnabled(true);
+ webView().settings()->setAcceleratedCompositingEnabled(true);
+ RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true);
+
+ // Create a hidden frame which is throttled and has a text selection.
+ 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=allow-scripts src=iframe.html></iframe>");
+ frameResource.complete(
+ "some text to select\n"
+ "<script>\n"
+ "var range = document.createRange();\n"
+ "range.selectNode(document.body);\n"
+ "window.getSelection().addRange(range);\n"
+ "</script>\n");
+
+ // Move the frame offscreen to throttle it.
+ auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
+ frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
+ EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
+ compositeFrame();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
+
+ // Give the frame focus and do another composite. The selection in the
+ // compositor should be cleared because the frame is throttled.
+ EXPECT_FALSE(compositor().hasSelection());
+ document().page()->focusController().setFocusedFrame(frameElement->contentDocument()->frame());
+ document().body()->setAttribute(styleAttr, "background: green");
+ compositeFrame();
+ EXPECT_FALSE(compositor().hasSelection());
+}
+
TEST(RemoteFrameThrottlingTest, ThrottledLocalRoot)
{
FrameTestHelpers::TestWebViewClient viewClient;
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/web/tests/sim/SimCompositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698