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

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

Issue 1890913005: Update widget geometries when transforming a layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.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 d0637d01cd2e79e7dc3ae407256fc298659d031a..f24b8b79bbb59505c7b24579af1b2c07e0dec803 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -6,9 +6,12 @@
#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"
+#include "public/web/WebSettings.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebRemoteFrameImpl.h"
@@ -349,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/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698