haikuwebkit/LayoutTests/compositing/visibility/visibility-image-layers.html

69 lines
1.6 KiB
HTML
Raw Permalink Normal View History

Source/WebCore: The HTML5 video element in Safari does not respect "visibility:hidden" CSS property https://bugs.webkit.org/show_bug.cgi?id=38829 Reviewed by James Robinson. Make compositing and CSS visibility play nicely together. The main issue was that an old optimization (see bug 4377) caused visibility:hidden layers to not appear in the z-order lists, but those layers could still become composited, but would remain detached. In addition, composited layers which were visibility:hidden would become visible sometimes. With this fix, the z-order lists always contain all layers when the page is in compositing mode. GraphicsLayer is changed to ensure that visibility:hidden layers show no content, and visible descendants of hidden layers work correctly. Tests: compositing/visibility/visibility-composited-transforms.html compositing/visibility/visibility-composited.html compositing/visibility/visibility-image-layers-dynamic.html compositing/visibility/visibility-image-layers.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): Init m_contentsVisible to true. (WebCore::GraphicsLayer::dumpProperties): Dump m_contentsVisible if not true. * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::contentsAreVisible): Getter for m_contentsVisible. (WebCore::GraphicsLayer::setContentsVisible): Setter for m_contentsVisible. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsVisible): Override setContentsVisible. (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Handle ContentsVisibilityChanged flag (WebCore::GraphicsLayerCA::updateSublayerList): Only parent the m_contentsLayer if the layer has visible contents. (WebCore::GraphicsLayerCA::updateContentsVisibility): For bits painted into the layer itself, we hide it by clearing the backing store. * platform/graphics/ca/GraphicsLayerCA.h: Removed obsolete comment on the DrawsContentChanged flag, added ContentsVisibilityChanged flag. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateZOrderLists): If we're in compositing mode, include all layers in the z-order lists. (WebCore::RenderLayer::collectLayers): New param to specify whether we need to collect all layers. * rendering/RenderLayer.h: (WebCore::RenderLayer::hasVisibleDescendant): Add comment about the need for an assertion in hasVisibleContent() , and assertion in hasVisibleDescendant(). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Call setContentsVisible() on the GraphicsLayer. (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): We can use simple container layers in cases where visibility:hidden causes layer content to not be drawn. (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendants): Renamed from hasNonCompositingDescendants() because it now also looks at visibility to decide when things are visible. * rendering/RenderLayerBacking.h: hasNonCompositingDescendants() renamed to hasVisibleNonCompositingDescendants(). LayoutTests: The HTML5 video element in Safari does not respect "visibility:hidden" CSS property https://bugs.webkit.org/show_bug.cgi?id=38829 Test various configurations of compositing layers and visibility. Reviewed by James Robinson. * compositing/visibility/visibility-composited-expected.png: Added. * compositing/visibility/visibility-composited-transforms-expected.png: Added. * compositing/visibility/visibility-composited-transforms.html: Added. * compositing/visibility/visibility-composited.html: Added. * compositing/visibility/visibility-image-layers-dynamic-expected.txt: Added. * compositing/visibility/visibility-image-layers-dynamic.html: Added. * compositing/visibility/visibility-image-layers-expected.png: Added. * compositing/visibility/visibility-image-layers.html: Added. Canonical link: https://commits.webkit.org/87358@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-10-28 17:46:38 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.set {
display: inline-block;
border: 1px solid black;
}
.box {
height: 100px;
width: 100px;
}
.hidden {
visibility: hidden;
}
.container {
margin: 10px;
padding: 20px;
}
.container.hidden {
outline: 4px solid red;
}
.visible {
visibility: visible;
}
.should-be-hidden {
background-color: red !important;
}
.should-be-visible {
background-color: green !important;
}
.composited {
-webkit-transform: translateZ(1px);
}
.visible-indicator {
background-color: green;
}
.hidden-indicator {
background-color: red;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText(true);
Source/WebCore: The HTML5 video element in Safari does not respect "visibility:hidden" CSS property https://bugs.webkit.org/show_bug.cgi?id=38829 Reviewed by James Robinson. Make compositing and CSS visibility play nicely together. The main issue was that an old optimization (see bug 4377) caused visibility:hidden layers to not appear in the z-order lists, but those layers could still become composited, but would remain detached. In addition, composited layers which were visibility:hidden would become visible sometimes. With this fix, the z-order lists always contain all layers when the page is in compositing mode. GraphicsLayer is changed to ensure that visibility:hidden layers show no content, and visible descendants of hidden layers work correctly. Tests: compositing/visibility/visibility-composited-transforms.html compositing/visibility/visibility-composited.html compositing/visibility/visibility-image-layers-dynamic.html compositing/visibility/visibility-image-layers.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::GraphicsLayer): Init m_contentsVisible to true. (WebCore::GraphicsLayer::dumpProperties): Dump m_contentsVisible if not true. * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::contentsAreVisible): Getter for m_contentsVisible. (WebCore::GraphicsLayer::setContentsVisible): Setter for m_contentsVisible. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsVisible): Override setContentsVisible. (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Handle ContentsVisibilityChanged flag (WebCore::GraphicsLayerCA::updateSublayerList): Only parent the m_contentsLayer if the layer has visible contents. (WebCore::GraphicsLayerCA::updateContentsVisibility): For bits painted into the layer itself, we hide it by clearing the backing store. * platform/graphics/ca/GraphicsLayerCA.h: Removed obsolete comment on the DrawsContentChanged flag, added ContentsVisibilityChanged flag. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateZOrderLists): If we're in compositing mode, include all layers in the z-order lists. (WebCore::RenderLayer::collectLayers): New param to specify whether we need to collect all layers. * rendering/RenderLayer.h: (WebCore::RenderLayer::hasVisibleDescendant): Add comment about the need for an assertion in hasVisibleContent() , and assertion in hasVisibleDescendant(). * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Call setContentsVisible() on the GraphicsLayer. (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): We can use simple container layers in cases where visibility:hidden causes layer content to not be drawn. (WebCore::RenderLayerBacking::hasVisibleNonCompositingDescendants): Renamed from hasNonCompositingDescendants() because it now also looks at visibility to decide when things are visible. * rendering/RenderLayerBacking.h: hasNonCompositingDescendants() renamed to hasVisibleNonCompositingDescendants(). LayoutTests: The HTML5 video element in Safari does not respect "visibility:hidden" CSS property https://bugs.webkit.org/show_bug.cgi?id=38829 Test various configurations of compositing layers and visibility. Reviewed by James Robinson. * compositing/visibility/visibility-composited-expected.png: Added. * compositing/visibility/visibility-composited-transforms-expected.png: Added. * compositing/visibility/visibility-composited-transforms.html: Added. * compositing/visibility/visibility-composited.html: Added. * compositing/visibility/visibility-image-layers-dynamic-expected.txt: Added. * compositing/visibility/visibility-image-layers-dynamic.html: Added. * compositing/visibility/visibility-image-layers-expected.png: Added. * compositing/visibility/visibility-image-layers.html: Added. Canonical link: https://commits.webkit.org/87358@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-10-28 17:46:38 +00:00
</script>
</head>
<body>
<!-- Tests visibility with directly composited images. -->
<!-- Left and right sides should look the same -->
<div class="set">
<div class="container"><img src="../resources/thiswayup.png" class="hidden box"></div>
<div class="hidden container"><img src="../resources/thiswayup.png" class="box"></div>
<div class="hidden container"><img src="../resources/thiswayup.png" class="visible box"></div>
</div>
<div class="set">
<div class="composited container"><img src="../resources/thiswayup.png" class="hidden composited box"></div>
<div class="composited hidden container"><img src="../resources/thiswayup.png" class="composited box"></div>
<div class="composited hidden container"><img src="../resources/thiswayup.png" class="visible composited box"></div>
</div>
</body>
</html>