haikuwebkit/LayoutTests/model-element/model-element-graphics-laye...

39 lines
938 B
HTML
Raw Permalink Normal View History

Separated models don't get opacity set on them at all https://bugs.webkit.org/show_bug.cgi?id=224763 Reviewed by Tim Horton. Source/WebCore: Test: model-element/model-element-graphics-layers-opacity.html This certainly won't be the way things land once separated/optimized layer semantics are better understood, but for now, it is useful to explicitly propogate the opacity of the owing layer to the content layer if the content layer is a model layer. In the future, we may want to do this for any separated child (and conversely, only to the content layer if it is separated), but this will allow us to play a bit futher in our experimentation. Also adds support for dumping the opacity of a content layer to make this testable. * platform/graphics/GraphicsLayerClient.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsToModel): (WebCore::GraphicsLayerCA::purposeNameForInnerLayer const): (WebCore::GraphicsLayerCA::dumpInnerLayer const): * testing/Internals.cpp: (WebCore::toPlatformLayerTreeFlags): * testing/Internals.h: * testing/Internals.idl: LayoutTests: Add new test which use the macOS/iOS only platformLayerTreeAsText internals function to show that opacity is getting set on the content layer. * model-element/model-element-graphics-layers-opacity-expected.txt: Added. * model-element/model-element-graphics-layers-opacity.html: Added. * platform/gtk/TestExpectations: * platform/wpe/TestExpectations: * platform/win/TestExpectations: * compositing/video/video-object-position-expected.txt: * compositing/visible-rect/mask-layer-coverage-expected.txt: * fullscreen/full-screen-layer-dump-expected.txt: * platform/ios/compositing/video/video-object-position-expected.txt: * platform/ios/compositing/visible-rect/mask-layer-coverage-expected.txt: * platform/mac/compositing/images/direct-image-object-fit-expected.txt: * platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt: * platform/mac/compositing/video/video-object-fit-expected.txt: Update results for update content layer type dumping. Canonical link: https://commits.webkit.org/236807@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-20 23:21:06 +00:00
<!DOCTYPE html><!-- webkit-test-runner [ ModelElementEnabled=true ] -->
<html>
<head>
<style>
model {
opacity: 0.5;
}
</style>
</head>
<body>
<model id="model">
<source src="resources/heart.usdz">
</model>
<pre id="layers"></pre>
<script>
let layers = document.getElementById("layers");
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
} else
layers.textContent = "This test requires testRunner.";
let model = document.getElementById("model");
model.ready.then(value => {
if (window.testRunner)
Changing the source of a model element with clipping applied does not update the model https://bugs.webkit.org/show_bug.cgi?id=224917 Reviewed by Simon Fraser. Source/WebCore: Tests: model-element/model-element-contents-layer-updates-with-clipping.html model-element/model-element-contents-layer-updates.html Previously, a <model> with a contents clipping layer (e.g. border-radius) would not reparent its contents layer in the right place when setContentsToModel was called again (because the source changed), leaving the old model contents layer in place. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::updateSublayerList): Ensure that updateSublayerList always parents contentsLayer in one of its two homes: under contentsClippingLayer, if it exists; otherwise, directly under the primary layer. (WebCore::GraphicsLayerCA::setContentsToModel): Drive-by fix a bug revealed by the tests for this patch: when swapping out the contents layer in setContentsToModel, we also need to mark ContentsRectsChanged, or the new contents layer will not get its bounds set during the subsequent flush. (WebCore::GraphicsLayerCA::setContentsToPlatformLayer): Remove special-case code that was added to fix this bug just for setContentsToPlatformLayer; this case is now correctly handled for all contents layers by updateSublayerList. (WebCore::GraphicsLayerCA::dumpInnerLayer const): * platform/graphics/GraphicsLayerClient.h: * platform/graphics/ca/PlatformCALayer.cpp: (WebCore::PlatformCALayer::dumpAdditionalProperties): * platform/graphics/ca/PlatformCALayer.h: * testing/Internals.cpp: (WebCore::toPlatformLayerTreeFlags): * testing/Internals.h: * testing/Internals.idl: Add a bit to platformLayerTreeAsText() that makes PlatformCALayerRemoteModelHosting dump the size of the model that it is hosting, which is used in the test for this bug. Remove the IncludeOpacity bit since we can just always log opacity if it's not the default. Source/WebKit: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm: (WebKit::PlatformCALayerRemoteModelHosting::dumpAdditionalProperties): Add a bit to platformLayerTreeAsText() that makes PlatformCALayerRemoteModelHosting dump the size of the model that it is hosting, which is used in the test for this bug. LayoutTests: * model-element/model-element-contents-layer-updates-expected.txt: Added. * model-element/model-element-contents-layer-updates-with-clipping-expected.txt: Added. * model-element/model-element-contents-layer-updates-with-clipping.html: Added. * model-element/model-element-contents-layer-updates.html: Added. * model-element/resources/cube.usdz: Added. * platform/ios-wk2/TestExpectations: * platform/mac/TestExpectations: Add tests that ensure that adding a <model> with one source, then changing it to another, correctly updates the content layer. Test this both with and without clipping (the without-clipping case passed before this change, with-clipping failed). These tests only work on Cocoa ports with UI-side compositing enabled because they depend on the PlatformCALayer subclass holding on to the model data (and logging its size) in order to distinguish between the two models. Canonical link: https://commits.webkit.org/236998@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-25 02:12:07 +00:00
layers.innerText = window.internals.platformLayerTreeAsText(model);
Separated models don't get opacity set on them at all https://bugs.webkit.org/show_bug.cgi?id=224763 Reviewed by Tim Horton. Source/WebCore: Test: model-element/model-element-graphics-layers-opacity.html This certainly won't be the way things land once separated/optimized layer semantics are better understood, but for now, it is useful to explicitly propogate the opacity of the owing layer to the content layer if the content layer is a model layer. In the future, we may want to do this for any separated child (and conversely, only to the content layer if it is separated), but this will allow us to play a bit futher in our experimentation. Also adds support for dumping the opacity of a content layer to make this testable. * platform/graphics/GraphicsLayerClient.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::setContentsToModel): (WebCore::GraphicsLayerCA::purposeNameForInnerLayer const): (WebCore::GraphicsLayerCA::dumpInnerLayer const): * testing/Internals.cpp: (WebCore::toPlatformLayerTreeFlags): * testing/Internals.h: * testing/Internals.idl: LayoutTests: Add new test which use the macOS/iOS only platformLayerTreeAsText internals function to show that opacity is getting set on the content layer. * model-element/model-element-graphics-layers-opacity-expected.txt: Added. * model-element/model-element-graphics-layers-opacity.html: Added. * platform/gtk/TestExpectations: * platform/wpe/TestExpectations: * platform/win/TestExpectations: * compositing/video/video-object-position-expected.txt: * compositing/visible-rect/mask-layer-coverage-expected.txt: * fullscreen/full-screen-layer-dump-expected.txt: * platform/ios/compositing/video/video-object-position-expected.txt: * platform/ios/compositing/visible-rect/mask-layer-coverage-expected.txt: * platform/mac/compositing/images/direct-image-object-fit-expected.txt: * platform/mac/compositing/reflections/direct-image-object-fit-reflected-expected.txt: * platform/mac/compositing/video/video-object-fit-expected.txt: Update results for update content layer type dumping. Canonical link: https://commits.webkit.org/236807@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-20 23:21:06 +00:00
model.remove();
}, reason => {
layers.textContent = `Failed. Model did not load: ${reason}`;
}).finally(() => {
if (window.testRunner)
testRunner.notifyDone();
});
</script>
</body>
</html>