Commit 84724ccd authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Enable kCompositeCrossOriginIframes by default

This feature is required for isInputPending.

The change to compositing_inputs_updater.cc fixes a bug that snuck in
via this CL while the feature was disabled:

https://chromium-review.googlesource.com/c/chromium/src/+/2283630

The web_test changes are mostly cases where a test has a cross-origin
iframe which was not previously composited, and making the iframe
composited caused anti-aliasing differences. The mhtml/ test changes
are needed because chromium treats the iframes in the encoded-html
test files as cross-origin; to ensure consistent text rendering, this
CL forces everything in both the test files and the ref test
expectations to be composited.

BUG=930987

Change-Id: I8f54eeacd333e46f394c08e9bf8366f0e9e2e57e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443630
Commit-Queue: Stefan Zager <szager@chromium.org>
Auto-Submit: Stefan Zager <szager@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815300}
parent b32ae119
...@@ -465,7 +465,7 @@ const base::Feature kSubresourceRedirect{"SubresourceRedirect", ...@@ -465,7 +465,7 @@ const base::Feature kSubresourceRedirect{"SubresourceRedirect",
// When 'enabled', all cross-origin iframes will get a compositing layer. // When 'enabled', all cross-origin iframes will get a compositing layer.
const base::Feature kCompositeCrossOriginIframes{ const base::Feature kCompositeCrossOriginIframes{
"CompositeCrossOriginIframes", base::FEATURE_DISABLED_BY_DEFAULT}; "CompositeCrossOriginIframes", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, enforces new interoperable semantics for 3D transforms. // When enabled, enforces new interoperable semantics for 3D transforms.
// See crbug.com/1008483. // See crbug.com/1008483.
......
...@@ -38,6 +38,10 @@ CompositingInputsUpdater::~CompositingInputsUpdater() = default; ...@@ -38,6 +38,10 @@ CompositingInputsUpdater::~CompositingInputsUpdater() = default;
bool CompositingInputsUpdater::LayerOrDescendantShouldBeComposited( bool CompositingInputsUpdater::LayerOrDescendantShouldBeComposited(
PaintLayer* layer) { PaintLayer* layer) {
if (layer->GetLayoutObject().IsLayoutView() &&
layer->GetLayoutObject().AdditionalCompositingReasons()) {
return true;
}
PaintLayerCompositor* compositor = PaintLayerCompositor* compositor =
layer->GetLayoutObject().View()->Compositor(); layer->GetLayoutObject().View()->Compositor();
return layer->DescendantHasDirectOrScrollingCompositingReason() || return layer->DescendantHasDirectOrScrollingCompositingReason() ||
...@@ -199,13 +203,11 @@ void CompositingInputsUpdater::UpdateSelfAndDescendantsRecursively( ...@@ -199,13 +203,11 @@ void CompositingInputsUpdater::UpdateSelfAndDescendantsRecursively(
} }
if (!descendant_has_direct_compositing_reason && if (!descendant_has_direct_compositing_reason &&
layer->GetLayoutObject().IsLayoutEmbeddedContent()) { layer->GetLayoutObject().IsLayoutEmbeddedContent()) {
if (LayoutView* root_of_child = if (LayoutView* embedded_layout_view =
ToLayoutEmbeddedContent(layer->GetLayoutObject()) ToLayoutEmbeddedContent(layer->GetLayoutObject())
.ChildLayoutView()) { .ChildLayoutView()) {
if (CompositingInputsUpdater(root_of_child->Layer(), descendant_has_direct_compositing_reason |=
root_of_child->Layer()) LayerOrDescendantShouldBeComposited(embedded_layout_view->Layer());
.LayerOrDescendantShouldBeComposited(root_of_child->Layer()))
descendant_has_direct_compositing_reason = true;
} }
} }
layer->SetDescendantHasDirectOrScrollingCompositingReason( layer->SetDescendantHasDirectOrScrollingCompositingReason(
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "cc/layers/picture_layer.h" #include "cc/layers/picture_layer.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/web/web_frame_content_dumper.h" #include "third_party/blink/public/web/web_frame_content_dumper.h"
#include "third_party/blink/public/web/web_hit_test_result.h" #include "third_party/blink/public/web/web_hit_test_result.h"
#include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/public/web/web_settings.h"
...@@ -980,6 +981,12 @@ TEST_P(FrameThrottlingTest, ThrottledTopLevelEventHandlerIgnored) { ...@@ -980,6 +981,12 @@ TEST_P(FrameThrottlingTest, ThrottledTopLevelEventHandlerIgnored) {
WebView().GetSettings()->SetJavaScriptEnabled(true); WebView().GetSettings()->SetJavaScriptEnabled(true);
EXPECT_EQ(0u, TouchHandlerRegionSize()); EXPECT_EQ(0u, TouchHandlerRegionSize());
// This test covers the case where a non-composited iframe is throttled. With
// this flag enabled, that is impossible, because only cross-origin iframes
// can be throttled.
if (base::FeatureList::IsEnabled(features::kCompositeCrossOriginIframes))
return;
// Create a frame which is throttled and has two different types of // Create a frame which is throttled and has two different types of
// top-level touchstart handlers. // top-level touchstart handlers.
SimRequest main_resource("https://example.com/", "text/html"); SimRequest main_resource("https://example.com/", "text/html");
...@@ -1027,6 +1034,12 @@ TEST_P(FrameThrottlingTest, ThrottledEventHandlerIgnored) { ...@@ -1027,6 +1034,12 @@ TEST_P(FrameThrottlingTest, ThrottledEventHandlerIgnored) {
WebView().GetSettings()->SetJavaScriptEnabled(true); WebView().GetSettings()->SetJavaScriptEnabled(true);
EXPECT_EQ(0u, TouchHandlerRegionSize()); EXPECT_EQ(0u, TouchHandlerRegionSize());
// This test covers the case where a non-composited iframe is throttled. With
// this flag enabled, that is impossible, because only cross-origin iframes
// can be throttled.
if (base::FeatureList::IsEnabled(features::kCompositeCrossOriginIframes))
return;
// Create a frame which is throttled and has a non-top-level touchstart // Create a frame which is throttled and has a non-top-level touchstart
// handler. // handler.
SimRequest main_resource("https://example.com/", "text/html"); SimRequest main_resource("https://example.com/", "text/html");
...@@ -1130,8 +1143,12 @@ TEST_P(FrameThrottlingTest, PaintingViaGraphicsLayerIsThrottled) { ...@@ -1130,8 +1143,12 @@ TEST_P(FrameThrottlingTest, PaintingViaGraphicsLayerIsThrottled) {
EXPECT_TRUE(frame_element->contentDocument()->View()->CanThrottleRendering()); EXPECT_TRUE(frame_element->contentDocument()->View()->CanThrottleRendering());
// If painting of the iframe is throttled, we should only receive drawing // If painting of the iframe is throttled, we should only receive drawing
// commands for the main frame. // commands for the main frame. We have to explicitly schedule a frame here
auto commands_throttled = Compositor().PaintFrame(); // because the iframe becoming throttled will affect the painted output;
// but it will not by itself schedule an animation frame, because it doesn't
// need display.
GetDocument().View()->ScheduleAnimation();
auto commands_throttled = CompositeFrame();
EXPECT_EQ(5u, commands_throttled.DrawCount()); EXPECT_EQ(5u, commands_throttled.DrawCount());
EXPECT_FALSE(Compositor().NeedsBeginFrame()); EXPECT_FALSE(Compositor().NeedsBeginFrame());
} }
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
"contentsOpaque": true, "contentsOpaque": true,
"backgroundColor": "#FFFFFF" "backgroundColor": "#FFFFFF"
}, },
{
"name": "LayoutView #document",
"bounds": [300, 100],
"contentsOpaque": true,
"backgroundColor": "#FFFF00"
},
{ {
"name": "LayoutNGBlockFlow BODY", "name": "LayoutNGBlockFlow BODY",
"bounds": [284, 84], "bounds": [284, 84],
......
<!DOCTYPE html> <!DOCTYPE html>
<body style="will-change:transform">
<a href='#'>anchor</a> <a href='#'>anchor</a>
<a id='dummy' href='dummy'>dummy</a> <a id='dummy' href='dummy'>dummy</a>
<div style='width:10px;height:2000px;background:white'></div> <div style='width:10px;height:2000px;background:white'></div>
...@@ -10,3 +11,4 @@ window.onmousedown = function() { ...@@ -10,3 +11,4 @@ window.onmousedown = function() {
}); });
} }
</script> </script>
</body>
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
<title>A page that contains multiple nested frames</title> <title>A page that contains multiple nested frames</title>
<script>
if (window.internals) {
internals.settings.setPreferCompositingToLCDTextEnabled(true);
}
</script>
</head><body> </head><body>
This page contains several frames.<br> This page contains several frames.<br>
<iframe src="resources/frame_0.html"></iframe><br> <iframe sandbox src="resources/frame_0.html"></iframe><br>
<iframe src="resources/frame_1.html"></iframe><br> <iframe sandbox src="resources/frame_1.html"></iframe><br>
<iframe src="resources/frame_2.html"></iframe><br> <iframe src="resources/frame_2.html"></iframe><br>
And a red square:<br> <div style="will-change:transform">And a red square:<br>
<img src="resources/red_square.png"> <img src="resources/red_square.png"></div>
</body></html> </body></html>
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
<title>A page that contains multiple nested frames</title> <title>A page that contains multiple nested frames</title>
<script>
if (window.internals) {
internals.settings.setPreferCompositingToLCDTextEnabled(true);
}
</script>
</head><body> </head><body>
This page contains several frames.<br> This page contains several frames.<br>
<iframe src="resources/frame_0.html"></iframe><br> <iframe sandbox src="resources/frame_0.html"></iframe><br>
<iframe src="resources/frame_1.html"></iframe><br> <iframe sandbox src="resources/frame_1.html"></iframe><br>
<iframe src="resources/frame_2.html"></iframe><br> <iframe src="resources/frame_2.html"></iframe><br>
And a red square:<br> <div style="will-change:transform">And a red square:<br>
<img src="resources/red_square.png"> <img src="resources/red_square.png"></div>
</body></html> </body></html>
...@@ -21,8 +21,8 @@ This page contains several frames.<br> ...@@ -21,8 +21,8 @@ This page contains several frames.<br>
<iframe src=3D"cid:frame0@foo.bar"></iframe><br> <iframe src=3D"cid:frame0@foo.bar"></iframe><br>
<iframe src=3D"cid:frame1@foo.bar"></iframe><br> <iframe src=3D"cid:frame1@foo.bar"></iframe><br>
<iframe src=3D"cid:frame2@foo.bar"></iframe><br> <iframe src=3D"cid:frame2@foo.bar"></iframe><br>
And a red square:<br> <div style=3D"will-change:transform">And a red square:<br>
<img src=3D"cid:redsquare@foo.bar"> <img src=3D"cid:redsquare@foo.bar"></div>
</body></html> </body></html>
------=_NextPart_000_0000_58874EE0.2096A571 ------=_NextPart_000_0000_58874EE0.2096A571
Content-Type: text/html; charset="ISO-8859-1" Content-Type: text/html; charset="ISO-8859-1"
......
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
<title>A page that contains multiple nested frames</title> <title>A page that contains multiple nested frames</title>
<script>
if (window.internals) {
internals.settings.setPreferCompositingToLCDTextEnabled(true);
}
</script>
</head><body> </head><body>
This page contains several frames.<br> This page contains several frames.<br>
<iframe src="resources/frame_0.html"></iframe><br> <iframe sandbox src="resources/frame_0.html"></iframe><br>
<iframe src="resources/frame_1.html"></iframe><br> <iframe sandbox src="resources/frame_1.html"></iframe><br>
<iframe src="resources/frame_2.html"></iframe><br> <iframe src="resources/frame_2.html"></iframe><br>
And a red square:<br> <div style="will-change:transform">And a red square:<br>
<img src="resources/red_square.png"> <img src="resources/red_square.png"></div>
</body></html> </body></html>
...@@ -40,9 +40,10 @@ http-equiv=3DContent-Type> ...@@ -40,9 +40,10 @@ http-equiv=3DContent-Type>
<BODY>This page contains several frames.<BR><IFRAME=20 <BODY>This page contains several frames.<BR><IFRAME=20
src=3D"http://localhost/frame_0.html"></IFRAME><BR><IFRAME=20 src=3D"http://localhost/frame_0.html"></IFRAME><BR><IFRAME=20
src=3D"http://localhost/frame_1.html"></IFRAME><BR><IFRAME=20 src=3D"http://localhost/frame_1.html"></IFRAME><BR><IFRAME=20
src=3D"http://localhost/frame_2.html"></IFRAME><BR>And a red = src=3D"http://localhost/frame_2.html"></IFRAME><BR><DIV=20
style=3D"will-change:transform">And a red =
square:<BR><IMG=20 square:<BR><IMG=20
src=3D"http://localhost/resources/red_square.png">=20 src=3D"http://localhost/resources/red_square.png"></DIV>=20
</BODY></HTML> </BODY></HTML>
------=_NextPart_001_0023_01CC157B.AAC41680 ------=_NextPart_001_0023_01CC157B.AAC41680
......
...@@ -3,11 +3,16 @@ ...@@ -3,11 +3,16 @@
<title>A page that contains multiple nested frames</title> <title>A page that contains multiple nested frames</title>
<script>
if (window.internals) {
internals.settings.setPreferCompositingToLCDTextEnabled(true);
}
</script>
</head><body> </head><body>
This page contains several frames.<br> This page contains several frames.<br>
<iframe src="resources/frame_0.html"></iframe><br> <iframe sandbox src="resources/frame_0.html"></iframe><br>
<iframe src="resources/frame_1.html"></iframe><br> <iframe sandbox src="resources/frame_1.html"></iframe><br>
<iframe src="resources/frame_2.html"></iframe><br> <iframe src="resources/frame_2.html"></iframe><br>
And a red square:<br> <div style="will-change:transform">And a red square:<br>
<img src="resources/red_square.png"> <img src="resources/red_square.png"></div>
</body></html> </body></html>
...@@ -21,8 +21,8 @@ This page contains several frames.<br> ...@@ -21,8 +21,8 @@ This page contains several frames.<br>
<iframe src=3D"http://localhost/frame_0.html"></iframe><br> <iframe src=3D"http://localhost/frame_0.html"></iframe><br>
<iframe src=3D"http://localhost/frame_1.html"></iframe><br> <iframe src=3D"http://localhost/frame_1.html"></iframe><br>
<iframe src=3D"http://localhost/frame_2.html"></iframe><br> <iframe src=3D"http://localhost/frame_2.html"></iframe><br>
And a red square:<br> <div style=3D"will-change:transform">And a red square:<br>
<img src=3D"resources/red_square.png"> <img src=3D"resources/red_square.png"></div>
</body></html> </body></html>
------=_NextPart_000_0000_58874EE0.2096A571 ------=_NextPart_000_0000_58874EE0.2096A571
Content-Type: text/html; charset="ISO-8859-1" Content-Type: text/html; charset="ISO-8859-1"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
internals.settings.setPreferCompositingToLCDTextEnabled(false); internals.settings.setPreferCompositingToLCDTextEnabled(false);
</script> </script>
<iframe src="data:text/html;charset=utf-8,<html><body style='width:1000px;height:1000px;'>Should be covered by a green overlay.</body></html>"></iframe> <iframe src="resources/large-body.html"></iframe>
<div id="console"></div> <div id="console"></div>
<div class="spacer"></div> <div class="spacer"></div>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<div class="to-show container"> <div class="to-show container">
</div> </div>
<div class="to-hide container"> <div class="to-hide container">
<iframe src="data:text/html;charset=utf-8,<div style='height:1000px; width:1000px; background: linear-gradient(to bottom, red, white);'>"> <iframe src="resources/large-div-background-gradient.html">
This should not be visible. This should not be visible.
</iframe> </iframe>
</div> </div>
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
break; break;
case 'iframe': case 'iframe':
window.nextStep = nextStep; window.nextStep = nextStep;
inner = '<iframe id="iframe" onload="runAfterLayoutAndPaint(window.nextStep)" src="data:text/html;charset=utf-8,<div style=\'height:1000px; width:1000px; background: linear-gradient(to bottom, red, white);\'>This should be covered by a green overlay.</div>"></iframe>'; inner = '<iframe id="iframe" onload="runAfterLayoutAndPaint(window.nextStep)" src="resources/large-div-background-gradient.html"></iframe>';
break; break;
} }
container.innerHTML = inner; container.innerHTML = inner;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</div> </div>
</section> </section>
<section> <section>
<iframe src="data:text/html;charset=utf-8,<style>body {height:1000px; width:1000px; background: linear-gradient(to bottom, red, white);}</style>"></iframe> <iframe src="large-body-background-gradient.html"></iframe>
</section> </section>
<section> <section>
<embed type="application/x-webkit-test-webplugin"></embed> <embed type="application/x-webkit-test-webplugin"></embed>
......
<!DOCTYPE html>
<style>
body {
height:1000px;
width:1000px;
background: linear-gradient(to bottom, red, white);
}
</style>
<body></body>
<!DOCTYPE html>
<style>
body {
height:1000px;
width:1000px;
}
</style>
<body>Should be covered by a green overlay.</body>
<!DOCTYPE html>
<style>
div {
height:1000px;
width:1000px;
background: linear-gradient(to bottom, red, white);
}
</style>
<body><div>Should be covered by a green overlay.</div></body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment