haikuwebkit/LayoutTests/compositing/layer-creation/overlap-animation-clipping....

114 lines
3.2 KiB
HTML
Raw Permalink Normal View History

[Web Animations] Turn Web Animations with CSS integration on https://bugs.webkit.org/show_bug.cgi?id=184819 <rdar://problem/39597337> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: * css-animations/test_animation-cancel.html: * css-animations/test_animation-computed-timing.html: * css-animations/test_animation-currenttime.html: * css-animations/test_animation-finish.html: * css-animations/test_animation-finished.html: * css-animations/test_animation-id.html: * css-animations/test_animation-pausing.html: * css-animations/test_animation-playstate.html: * css-animations/test_animation-ready.html: * css-animations/test_animation-reverse.html: * css-animations/test_animation-starttime.html: * css-animations/test_animations-dynamic-changes.html: * css-animations/test_cssanimation-animationname.html: * css-animations/test_document-get-animations.html: * css-animations/test_effect-target.html: * css-animations/test_element-get-animations.html: * css-animations/test_event-dispatch.html: * css-animations/test_event-order.html: * css-animations/test_keyframeeffect-getkeyframes.html: * css-animations/test_pseudoElement-get-animations.html: * css-animations/test_setting-effect.html: * css-transitions/test_animation-cancel.html: * css-transitions/test_animation-computed-timing.html: * css-transitions/test_animation-currenttime.html: * css-transitions/test_animation-finished.html: * css-transitions/test_animation-pausing.html: * css-transitions/test_animation-ready.html: * css-transitions/test_animation-starttime.html: * css-transitions/test_csstransition-transitionproperty.html: * css-transitions/test_document-get-animations.html: * css-transitions/test_effect-target.html: * css-transitions/test_element-get-animations.html: * css-transitions/test_event-dispatch.html: * css-transitions/test_keyframeeffect-getkeyframes.html: * css-transitions/test_pseudoElement-get-animations.html: * css-transitions/test_setting-effect.html: LayoutTests/imported/w3c: * web-platform-tests/css-timing-1/frames-timing-functions-output.html: * web-platform-tests/css/css-logical/animation-003.tentative.html: * web-platform-tests/css/css-scoping/keyframes-001.html: * web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-context.html: * web-platform-tests/web-animations/interfaces/Animatable/animate.html: * web-platform-tests/web-animations/timing-model/animations/current-time.html: Source/WebCore: * page/RuntimeEnabledFeatures.h: Source/WebKit: * Shared/WebPreferences.yaml: Source/WebKitLegacy/mac: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): Source/WebKitLegacy/win: * WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): Tools: * DumpRenderTree/TestOptions.h: LayoutTests: * TestExpectations: * animations/3d/matrix-transform-type-animation.html: * animations/3d/replace-filling-transform.html: * animations/3d/transform-origin-vs-functions.html: * animations/3d/transform-perspective.html: * animations/additive-transform-animations.html: * animations/animation-border-overflow.html: * animations/animation-callback-timestamp.html: * animations/animation-controller-drt-api.html: * animations/animation-direction-alternate-reverse-expected.txt: * animations/animation-direction-alternate-reverse.html: * animations/animation-direction-reverse-fill-mode-hardware.html: * animations/animation-direction-reverse-hardware-opacity.html: * animations/animation-direction-reverse-hardware.html: * animations/animation-direction-reverse-non-hardware.html: * animations/animation-direction-reverse-timing-functions-hardware.html: * animations/animation-direction-reverse-timing-functions.html: * animations/animation-direction.html: * animations/animation-followed-by-transition.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/animation-internals-api-expected.txt: Removed. * animations/animation-internals-api-multiple-keyframes-expected.txt: Removed. * animations/animation-internals-api-multiple-keyframes.html: Removed. * animations/animation-internals-api.html: Removed. * animations/animation-offscreen-to-onscreen.html: * animations/animation-playstate-paused-style-resolution.html: * animations/big-rotation-expected.txt: * animations/big-rotation.html: * animations/change-completed-animation-transform.html: * animations/change-keyframes.html: * animations/combo-transform-rotate+scale.html: * animations/cross-fade-background-image.html: * animations/cross-fade-border-image-source.html: * animations/cross-fade-list-style-image.html: * animations/cross-fade-webkit-mask-box-image.html: * animations/duplicate-keys-expected.html: * animations/duplicate-keys.html: * animations/duplicated-keyframes-name.html: * animations/fill-forwards-end-state.html: * animations/fill-mode-forwards-zero-duration-expected.txt: * animations/fill-mode-forwards-zero-duration.html: * animations/fill-mode-removed.html: * animations/font-variations/font-stretch.html: * animations/font-variations/font-style.html: * animations/font-variations/font-variation-settings-order.html: * animations/font-variations/font-variation-settings-unlike.html: * animations/font-variations/font-variation-settings.html: * animations/font-variations/font-weight.html: * animations/generic-from-to.html: * animations/import.html: * animations/keyframe-multiple-timing-functions-transform.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-comma-separated.html: * animations/keyframes-dynamic.html: * animations/keyframes-infinite-iterations.html: * animations/keyframes-invalid-keys.html: * animations/keyframes-out-of-order.html: * animations/keyframes.html: * animations/leak-document-with-css-animation.html: * animations/lineheight-animation.html: * animations/longhand-timing-function.html: * animations/matrix-anim.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/missing-keyframe-properties-repeating.html: * animations/missing-keyframe-properties-timing-function.html: * animations/missing-keyframe-properties.html: * animations/missing-values-first-keyframe.html: * animations/missing-values-last-keyframe.html: * animations/multiple-animations-timing-function.html: * animations/multiple-animations.html: * animations/multiple-keyframes.html: * animations/negative-delay.html: * animations/pause-crash.html: * animations/play-state-start-paused.html: * animations/resources/animation-leak-iframe.html: * animations/simultaneous-start-left.html: * animations/simultaneous-start-transform.html: * animations/spring-function.html: * animations/stacking-context-unchanged-while-running.html: * animations/stop-animation-on-suspend.html: * animations/suspend-resume-animation-events.html: * animations/timing-functions.html: * animations/transition-and-animation-1.html: * animations/transition-and-animation-2.html: * animations/transition-and-animation-3.html: * animations/trigger-container-scroll-boundaries.html: * animations/trigger-container-scroll-empty.html: * animations/trigger-container-scroll-simple.html: * animations/unanimated-style.html: * animations/unprefixed-keyframes.html: * animations/width-using-ems.html: * compositing/animation/animated-composited-inside-hidden.html: * compositing/animation/computed-style-during-delay.html: * compositing/animation/layer-for-filling-animation.html: * compositing/backing/backface-visibility-flip.html: * compositing/backing/transform-transition-from-outside-view.html: * compositing/contents-scale/animating.html: * compositing/layer-creation/animation-overlap-with-children.html: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * compositing/layer-creation/mismatched-transform-transition-overlap.html: * compositing/layer-creation/multiple-keyframes-animation-overlap.html: * compositing/layer-creation/overlap-animation-clipping.html: * compositing/layer-creation/overlap-animation-container.html: * compositing/layer-creation/overlap-animation.html: * compositing/layer-creation/scale-rotation-animation-overlap.html: * compositing/layer-creation/scale-rotation-transition-overlap.html: * compositing/layer-creation/translate-animation-overlap.html: * compositing/layer-creation/translate-scale-animation-overlap.html: * compositing/layer-creation/translate-scale-transition-overlap.html: * compositing/layer-creation/translate-transition-overlap.html: * compositing/overflow/overflow-positioning.html: * compositing/reflections/animation-inside-reflection.html: * compositing/reflections/nested-reflection-animated.html: * compositing/reflections/nested-reflection-transition.html: * compositing/scrolling/touch-scroll-to-clip.html: * compositing/transitions/scale-transition-no-start.html: * compositing/transitions/singular-scale-transition.html: * compositing/visible-rect/animated-from-none.html: * compositing/visible-rect/animated.html: * css3/calc/transitions-dependent.html: * css3/calc/transitions.html: * css3/filters/backdrop/animation.html: * css3/filters/composited-during-animation.html: * css3/filters/filter-animation-from-none-hw.html: * css3/filters/filter-animation-from-none-multi-hw.html: * css3/filters/filter-animation-from-none-multi.html: * css3/filters/filter-animation-from-none.html: * css3/filters/filter-animation-hw.html: * css3/filters/filter-animation-multi-hw.html: * css3/filters/filter-animation-multi.html: * css3/filters/filter-animation.html: * css3/masking/clip-path-animation.html: * fast/animation/css-animation-resuming-when-visible-with-style-change.html: * fast/animation/css-animation-resuming-when-visible-with-style-change2.html: * fast/animation/css-animation-resuming-when-visible.html: * fast/animation/css-animation-throttling-lowPowerMode.html: * fast/animation/height-auto-transition-computed-value.html: * fast/css-generated-content/pseudo-animation.html: * fast/css-generated-content/pseudo-transition.html: * fast/filter-image/filter-image-animation.html: * fast/shapes/shape-outside-floats/shape-outside-animation.html: * fast/shapes/shape-outside-floats/shape-outside-shape-image-threshold-animation.html: * fast/shapes/shape-outside-floats/shape-outside-shape-margin-animation.html: * http/wpt/css/css-animations/start-animation-001.html: * imported/blink/transitions/transition-not-interpolable.html: * imported/blink/transitions/unprefixed-transform.html: * platform/ios/TestExpectations: * platform/win/TestExpectations: * transitions/remove-transition-style.html: * transitions/transition-drt-api-delay-expected.txt: Removed. * transitions/transition-drt-api-delay.html: Removed. * transitions/transition-drt-api-expected.txt: Removed. * transitions/transition-drt-api.html: Removed. * transitions/zero-duration-with-non-zero-delay-end.html: Canonical link: https://commits.webkit.org/204981@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-27 09:49:52 +00:00
<!DOCTYPE html>
Element is displayed behind a composited layer when clipping is used on a previous element https://bugs.webkit.org/show_bug.cgi?id=104981 Reviewed by Simon Fraser. Source/WebCore: RenderLayerCompositor::computeCompositingRequirements uses the local bounding box of the layers to optimize the number of composited layers that are created. That's needed in order to make sure that composited layers that are displayed behind non-composited layers are correctly promoting the layers in front to be composited. Otherwise the non-composited layers are rendered in the parent composited layer, displaying behind the other composited layers. That might be wrong as the correct paint order might not be preserved. In order to make animations work, there's a flag that will disable that optimization. That's because the animations run in the platform layer and the platform layer doesn't know about the layers that are not promoted to composited layers. When the overlapping of the layers is computed it just uses the start or the stop state, but no intermediate states. For that reason, all the 'top' layers in front of animated elements will become composited. When an animation has a clipping rectangle, then we know for sure that the animation is going to be contained inside the clip area, so WebKit uses the bounding box of the clipping area to detect the overlapping layers, so there's no need to disable the optimization in that case. However, if there is a different animation displaying behind the clipping container, we cannot safely disable that optimization anymore. That's because we still don't know what are the intermediate states of that particular animated layer. The bug was that the optimization was re-enabled anyway, even in this particular case. In order to fix it, I changed the logic, so that instead of re-enabling the optimization after a clipping container, it will just avoid to propagate the internal state to the following layers when there's no need to so. Note that 3D transforms behave like animations for now and disable the optimization. Because of that some of the existing tests ended up creating more layers than needed. That's because the tests had an overflow area that recreated the issue that this patch fixes, but with 3D transforms instead of animations. 3D transforms will be treated in a separate patch. Tests: compositing/layer-creation/overlap-animation-clipping.html compositing/layer-creation/overlap-animation-container.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): LayoutTests: Updated existing test results and added two new tests to check that animations respect the correct paint order, even though they are painted with composited layers. Note that there are side effects of this patch that will be corrected in a following bug. 3D layers are treated like animations, so they disable the overlapping optimizations. Because of that, some of the test results were updated to include the layers that, previously, were not created as a result of being in front of a "clipping container". * compositing/geometry/foreground-layer-expected.txt: * compositing/layer-creation/overlap-animation-clipping-expected.txt: Added. * compositing/layer-creation/overlap-animation-clipping.html: Added. Checking that the animation inside a clipping container is not affecting how we compute the animations outside the clipping container. * compositing/layer-creation/overlap-animation-container-expected.txt: Added. * compositing/layer-creation/overlap-animation-container.html: Added. Checking that we don't create unnecessary composited layers for layers inside composited containers that draw in front of animated layers. * compositing/overflow/clip-descendents-expected.txt: * compositing/overflow/clip-descendents.html: Removed the text from the output, so that platforms can share the same expected result. * platform/chromium-win/compositing/overflow/clip-descendents-expected.txt: Removed. Not needed anymore, all Chromium platforms can share the same results now. * platform/chromium/compositing/geometry/foreground-layer-expected.txt: * platform/chromium/compositing/layer-creation/overlap-animation-clipping-expected.txt: Added. * platform/chromium/compositing/layer-creation/overlap-animation-container-expected.txt: Added. * platform/chromium/compositing/layer-creation/overlap-transformed-3d-expected.txt: Added. * platform/chromium/compositing/layer-creation/overlap-transforms-expected.txt: * platform/chromium/compositing/overflow/clip-descendents-expected.txt: Renamed from LayoutTests/platform/chromium-mac/compositing/overflow/clip-descendents-expected.txt. * platform/qt/compositing/overflow/clip-descendents-expected.txt: Canonical link: https://commits.webkit.org/124908@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-11 22:05:25 +00:00
<html>
<head>
<style>
.container {
height: 460px;
width: 120px;
overflow: hidden;
position: relative;
left: 50px;
z-index: 0; /* create stacking context */
border: 1px solid black;
background-color: white;
}
.box {
position: relative;
width: 100px;
height: 100px;
margin: 10px;
background-color: blue;
}
.force-layer {
-webkit-transform: translateZ(1px);
}
.yellow {
background-color: yellow;
}
.gray {
background-color: gray;
}
.animating1 {
-webkit-animation: translate1 2s linear infinite alternate;
}
.animating2 {
-webkit-animation: translate2 2s linear infinite alternate;
}
@-webkit-keyframes translate1 {
from { -webkit-transform: translate(0px, -110px); }
to { -webkit-transform: translate(0px, 590px); }
}
@-webkit-keyframes translate2 {
from { -webkit-transform: translate(0px, -220px); }
to { -webkit-transform: translate(0px, 110px); }
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function queueBoxForAnimation(elementId, animationClass, callback) {
var box = document.getElementById(elementId);
if (callback)
box.addEventListener('webkitAnimationStart', callback, false);
box.classList.add(animationClass);
}
function runTest()
{
queueBoxForAnimation("to-animate1", "animating1");
queueBoxForAnimation("to-animate2", "animating2", animationStarted);
}
function animationStarted()
{
if (window.testRunner) {
var layersElement = document.getElementById('layers');
// Make sure we don't include the #layers element in the tree. The text size
// might differ between platforms.
layersElement.style.display = "none";
layersElement.innerText = window.internals.layerTreeAsText(document);
layersElement.style.display = "block";
testRunner.notifyDone();
}
}
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
<!-- The test checks that composited layers are created when needed to display elements in front of animated layers.
There are two animations going at the same time. The second animation is inside a clipping
container (white background with black border). The first animation should display behind the clipping container.
For both animations, the following should be true:
1. Yellow box should display in front of the blue box.
2. Gray boxes should display behind the blue box.
-->
<!-- This div will not get a layer -->
<div class="box gray"></div>
<div id="to-animate1" class="box"></div>
<div class="container">
<!-- This div will be forced to get a layer -->
<div class="box gray force-layer"></div>
<!-- This div will not get a layer -->
<div class="box gray"></div>
<div id="to-animate2" class="box"></div>
<!-- This div will get a layer -->
<div class="box yellow"></div>
</div>
<!-- This div will also get a layer -->
<div class="box yellow"></div>
<pre id="layers">Layer tree goes here in DRT</pre>
</body>
</html>