Commit 510e13d1 authored by wkorman's avatar wkorman Committed by Commit bot

Don't composite layers with an invisible FrameView.

Required setting parent/self visible for the FrameView associated
with a WebPagePopupImpl. Previously these defaulted to invisible.

BUG=569643

Review URL: https://codereview.chromium.org/1616183002

Cr-Commit-Position: refs/heads/master@{#372109}
parent 4abea28b
......@@ -1110,6 +1110,8 @@ crbug.com/509025 [ Mac10.10 ] fast/text/large-text-composed-char.html [ Failure
crbug.com/509025 [ Mac10.10 ] http/tests/navigation/navigation-redirect-schedule-crash.html [ Failure ]
crbug.com/509025 [ Mac10.10 ] http/tests/security/contentTypeOptions/nosniff-script-without-content-type-blocked.html [ Failure ]
crbug.com/569643 compositing/iframes/invisible-nested-iframe-hide.html [ NeedsRebaseline ]
crbug.com/545140 [ Mac10.10 ] fast/encoding/denormalised-voiced-japanese-chars.html [ Failure ]
crbug.com/545141 [ Mac10.10 ] fast/writing-mode/text-orientation-basic.html [ Failure ]
......
<!DOCTYPE html>
<div style="visibility: hidden;"><iframe></iframe></div>
<p>This test passes if there is no assert failure in debug builds and there is no visible
content in the iframe above after the page fully settles.
<!DOCTYPE html>
<script src="../resources/run-after-layout-and-paint.js"></script>
<div id="frameContainer">
<iframe src="./resources/composited-iframe-hidden-subframe.html"></iframe>
</div>
<p>This test passes if there is no assert failure in debug builds and there is no visible
content in the iframe above after the page fully settles.
<script>
function hideFrameContainer() {
frameContainer.style.visibility = 'hidden';
}
function showFrameContainer() {
frameContainer.style.visibility = 'visible';
}
// We were seeing assert failure when we hid and then re-showed the iframe due
// to a stale graphics layer with an old invalidation posted by the animated
// element. To prevent regression we hide and re-show the iframe, and hide again
// to ensure the content is actually hidden.
if (window.testRunner)
testRunner.waitUntilDone();
runAfterLayoutAndPaint(function() {
hideFrameContainer();
runAfterLayoutAndPaint(function() {
showFrameContainer();
runAfterLayoutAndPaint(function() {
hideFrameContainer();
if (window.testRunner)
runAfterLayoutAndPaint(function() {
testRunner.notifyDone();
});
});
});
});
</script>
......@@ -48,7 +48,7 @@
</head>
<body>
<!-- The nested iframe should appear when we remove "diplay:none". -->
<!-- The nested iframe should appear when we remove "display:none". -->
<div id="invisible" style="display:none;">
<iframe src="resources/intermediate-frame.html"></iframe>
</div>
......
<!DOCTYPE html>
<style>
.animatedBackground {
width: 70px;
height: 80px;
position: absolute;
background: url("./square-blue-100x100.png") no-repeat 0 0 transparent;
animation: anim 4s steps(6) infinite;
}
.transformedItem {
transform: translate3d(42px, 43px, 0);
width: 40px;
height: 50px;
background-color: green;
}
@keyframes anim {
100% {
background-position: 9px 10px
}
}
</style>
<div class="animatedBackground"></div>
<div class="transformedItem"></div>
......@@ -3801,6 +3801,10 @@ void FrameView::setParentVisible(bool visible)
if (isParentVisible() == visible)
return;
// As parent visibility changes, we may need to recomposite this frame view and potentially child frame views.
if (PaintLayerCompositor* compositor = layoutView() ? layoutView()->compositor() : nullptr)
compositor->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
Widget::setParentVisible(visible);
if (!isSelfVisible())
......
......@@ -90,6 +90,8 @@ protected:
{
RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
FrameViewTestBase::SetUp();
document().view()->setParentVisible(true);
document().view()->setSelfVisible(true);
}
void TearDown() override
......
......@@ -67,6 +67,8 @@ Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c
m_subframe = LocalFrame::create(m_frameLoaderClient.get(), document().frame()->host(), &iframe);
m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500)));
m_subframe->init();
m_subframe->view()->setParentVisible(true);
m_subframe->view()->setSelfVisible(true);
static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(m_subframe.get());
document().frame()->host()->incrementSubframeCount();
Document& frameDocument = *iframe.contentDocument();
......
......@@ -45,6 +45,8 @@ protected:
void enableCompositing()
{
m_pageHolder->page().settings().setAcceleratedCompositingEnabled(true);
document().view()->setParentVisible(true);
document().view()->setSelfVisible(true);
document().view()->updateAllLifecyclePhases();
}
......
......@@ -767,6 +767,11 @@ void PaintLayerCompositor::updateDirectCompositingReasons(PaintLayer* layer)
bool PaintLayerCompositor::canBeComposited(const PaintLayer* layer) const
{
FrameView* frameView = layer->layoutObject()->frameView();
// Elements within an invisible frame must not be composited because they are not drawn.
if (frameView && !frameView->isVisible())
return false;
const bool hasCompositorAnimation = m_compositingReasonFinder.requiresCompositingForAnimation(*layer->layoutObject()->style());
return m_hasAcceleratedCompositing && (hasCompositorAnimation || !layer->subtreeIsInvisible()) && layer->isSelfPaintingLayer() && !layer->layoutObject()->isLayoutFlowThread();
}
......
......@@ -259,6 +259,8 @@ bool WebPagePopupImpl::initializePage()
frame->setPagePopupOwner(m_popupClient->ownerElement());
frame->setView(FrameView::create(frame.get()));
frame->init();
frame->view()->setParentVisible(true);
frame->view()->setSelfVisible(true);
frame->view()->setTransparent(false);
if (AXObjectCache* cache = m_popupClient->ownerElement().document().existingAXObjectCache())
cache->childrenChanged(&m_popupClient->ownerElement());
......
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