haikuwebkit/LayoutTests/compositing/masks/compositing-clip-path-chang...

61 lines
1.6 KiB
HTML
Raw Permalink Normal View History

Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.box {
width: 300px;
height: 300px;
background-color: blue;
}
.composited {
-webkit-transform: translateZ(0);
}
.clipped {
-webkit-clip-path: inset(0 50px);
}
.masked {
-webkit-mask: linear-gradient(white, transparent);
}
body.changed .clipped {
-webkit-clip-path: inset(0 70px);
}
</style>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
testRunner.dumpAsText();
}
function doTest()
{
window.setTimeout(function() {
window.setTimeout(function() {
if (window.internals)
window.internals.startTrackingRepaints();
Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
document.body.classList.add('changed');
Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
if (window.internals)
document.getElementById('repaintRects').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
if (window.testRunner)
testRunner.notifyDone();
}, 0)
}, 0)
Allow composited clip-path to be updated without a layer repaint https://bugs.webkit.org/show_bug.cgi?id=142384 Reviewed by Zalan Bujtas. Source/WebCore: When clip-path is mapped to a compositing shape layer mask, we can just push a new shape to the GraphicsLayer to update the clip path, without needing to repaint. Achieve this by adding ContextSensitivePropertyClipPath. When set, and the stars are aligned, issue a StyleDifferenceRecompositeLayer rather than a StyleDifferenceRepaint. We ask RenderLayerCompositor whether the clip path can be composited to hide platform differences related to whether GraphicsLayer supports shape masks. Test: compositing/masks/compositing-clip-path-change-no-repaint.html * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference): Remove obvious comment about opacity. Handle ContextSensitivePropertyClipPath. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::canCompositeClipPath): If we have a mask we have to paint the mask + clip path into the mask layer (mirrors code in RenderLayerBacking::updateMaskingLayer but isn't quite similar enough to share). * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint): Set ContextSensitivePropertyClipPath and don't return, as is normal for context-sensitive property handling. * rendering/style/RenderStyleConstants.h: Line things up to avoid future bit fumbles, and remove unnecessary braces. LayoutTests: Test repaint with a clip-path change. * compositing/masks/compositing-clip-path-change-no-repaint-expected.txt: Added. * compositing/masks/compositing-clip-path-change-no-repaint.html: Added. Canonical link: https://commits.webkit.org/160448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-06 18:14:10 +00:00
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div class="clipped composited box">box1</div>
<div class="clipped masked composited box">box2</div>
<p>Only the second box should have a repaint.</p>
<pre id="repaintRects"></pre>
</body>
</html>