haikuwebkit/LayoutTests/compositing/layer-creation/translate-transition-overla...

57 lines
1.3 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>
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
<html>
<head>
<style>
.box {
width: 200px;
height: 100px;
background-color: blue;
margin: 52px 30px;
position: relative;
box-shadow: 0 0 10px black;
transition: -webkit-transform 10s;
-webkit-transform: translateX(0);
}
.dot {
position: absolute;
top: 0;
left: 0;
height: 4px;
width: 4px;
background-color: silver;
}
body.changed .box {
-webkit-transform: translateX(100px);
}
</style>
Flaky Test: compositing/backing/backing-store-attachment-with-rotation.html https://bugs.webkit.org/show_bug.cgi?id=204394 Reviewed by Myles C. Maxfield. Move compositing-overlap-utils.js to compositing/resources and use its layerTreeWithoutTransforms() function to not dump transforms for the flakey test. Adjust other tests which use this JS file. * compositing/backing/backing-store-attachment-with-rotation-expected.txt: * compositing/backing/backing-store-attachment-with-rotation.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/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/resources/compositing-test-utils.js: Renamed from LayoutTests/compositing/layer-creation/resources/compositing-overlap-utils.js. (makeDots): (layerTreeWithoutTransforms): (dumpLayersWithoutTransforms): * legacy-animation-engine/compositing/layer-creation/animation-overlap-with-children.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap.html: Canonical link: https://commits.webkit.org/217730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-21 21:30:10 +00:00
<script src="../resources/compositing-test-utils.js"></script>
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
Transform is sometimes left in a bad state after an animation https://bugs.webkit.org/show_bug.cgi?id=197401 rdar://problem/48179186 Reviewed by Dean Jackson. Source/WebCore: In some more complex compositing scenarios, at the end of an animation we'd fail to push a new transform onto a layer, because updateGeometry() would think there's an animation running (which there is, but in the "Ending" state). It's simpler in this code to just always push transform and opacity to the layer; they will get overridden by the animation while it's running. The current code dates from the first landing of the file, and the reason for the if (!isRunningAcceleratedTransformAnimation) check is lost in the sands of time. I was not able to get a reliable ref or layer tree test for this, because the next compositing update fixes it, and WTR seems to trigger one. But the added test does show the bug in Safari, and is a good test to have. Test: compositing/animation/transform-after-animation.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): LayoutTests: Share code between all the overlap tests that work by creating dot matrices, and strip out the transforms from the layer tree dumps, because they can vary with timing in these tests. * compositing/animation/transform-after-animation-expected.html: Added. * compositing/animation/transform-after-animation.html: Added. * compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * compositing/layer-creation/animation-overlap-with-children.html: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * 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-expected.txt: * compositing/layer-creation/multiple-keyframes-animation-overlap.html: * compositing/layer-creation/resources/compositing-overlap-utils.js: Added. (makeDots): (layerTreeWithoutTransforms): (dumpLayers): * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * compositing/layer-creation/scale-rotation-animation-overlap.html: * compositing/layer-creation/scale-rotation-transition-overlap.html: * compositing/layer-creation/translate-animation-overlap-expected.txt: * compositing/layer-creation/translate-animation-overlap.html: * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * compositing/layer-creation/translate-scale-animation-overlap.html: * compositing/layer-creation/translate-scale-transition-overlap.html: * compositing/layer-creation/translate-transition-overlap.html: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html: * legacy-animation-engine/compositing/backing/transform-transition-from-outside-view-expected.txt: * legacy-animation-engine/compositing/layer-creation/animation-overlap-with-children.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap.html: * platform/ios/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Canonical link: https://commits.webkit.org/211618@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-30 20:20:37 +00:00
function runTest()
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
{
Transform is sometimes left in a bad state after an animation https://bugs.webkit.org/show_bug.cgi?id=197401 rdar://problem/48179186 Reviewed by Dean Jackson. Source/WebCore: In some more complex compositing scenarios, at the end of an animation we'd fail to push a new transform onto a layer, because updateGeometry() would think there's an animation running (which there is, but in the "Ending" state). It's simpler in this code to just always push transform and opacity to the layer; they will get overridden by the animation while it's running. The current code dates from the first landing of the file, and the reason for the if (!isRunningAcceleratedTransformAnimation) check is lost in the sands of time. I was not able to get a reliable ref or layer tree test for this, because the next compositing update fixes it, and WTR seems to trigger one. But the added test does show the bug in Safari, and is a good test to have. Test: compositing/animation/transform-after-animation.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): LayoutTests: Share code between all the overlap tests that work by creating dot matrices, and strip out the transforms from the layer tree dumps, because they can vary with timing in these tests. * compositing/animation/transform-after-animation-expected.html: Added. * compositing/animation/transform-after-animation.html: Added. * compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * compositing/layer-creation/animation-overlap-with-children.html: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * 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-expected.txt: * compositing/layer-creation/multiple-keyframes-animation-overlap.html: * compositing/layer-creation/resources/compositing-overlap-utils.js: Added. (makeDots): (layerTreeWithoutTransforms): (dumpLayers): * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * compositing/layer-creation/scale-rotation-animation-overlap.html: * compositing/layer-creation/scale-rotation-transition-overlap.html: * compositing/layer-creation/translate-animation-overlap-expected.txt: * compositing/layer-creation/translate-animation-overlap.html: * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * compositing/layer-creation/translate-scale-animation-overlap.html: * compositing/layer-creation/translate-scale-transition-overlap.html: * compositing/layer-creation/translate-transition-overlap.html: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html: * legacy-animation-engine/compositing/backing/transform-transition-from-outside-view-expected.txt: * legacy-animation-engine/compositing/layer-creation/animation-overlap-with-children.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap.html: * platform/ios/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Canonical link: https://commits.webkit.org/211618@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-30 20:20:37 +00:00
makeDots(40, 20);
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
window.setTimeout(function() {
document.body.classList.add('changed');
Flaky Test: compositing/backing/backing-store-attachment-with-rotation.html https://bugs.webkit.org/show_bug.cgi?id=204394 Reviewed by Myles C. Maxfield. Move compositing-overlap-utils.js to compositing/resources and use its layerTreeWithoutTransforms() function to not dump transforms for the flakey test. Adjust other tests which use this JS file. * compositing/backing/backing-store-attachment-with-rotation-expected.txt: * compositing/backing/backing-store-attachment-with-rotation.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/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/resources/compositing-test-utils.js: Renamed from LayoutTests/compositing/layer-creation/resources/compositing-overlap-utils.js. (makeDots): (layerTreeWithoutTransforms): (dumpLayersWithoutTransforms): * legacy-animation-engine/compositing/layer-creation/animation-overlap-with-children.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap.html: Canonical link: https://commits.webkit.org/217730@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-21 21:30:10 +00:00
window.setTimeout(dumpLayersWithoutTransforms, 0);
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
}, 0);
}
Transform is sometimes left in a bad state after an animation https://bugs.webkit.org/show_bug.cgi?id=197401 rdar://problem/48179186 Reviewed by Dean Jackson. Source/WebCore: In some more complex compositing scenarios, at the end of an animation we'd fail to push a new transform onto a layer, because updateGeometry() would think there's an animation running (which there is, but in the "Ending" state). It's simpler in this code to just always push transform and opacity to the layer; they will get overridden by the animation while it's running. The current code dates from the first landing of the file, and the reason for the if (!isRunningAcceleratedTransformAnimation) check is lost in the sands of time. I was not able to get a reliable ref or layer tree test for this, because the next compositing update fixes it, and WTR seems to trigger one. But the added test does show the bug in Safari, and is a good test to have. Test: compositing/animation/transform-after-animation.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): LayoutTests: Share code between all the overlap tests that work by creating dot matrices, and strip out the transforms from the layer tree dumps, because they can vary with timing in these tests. * compositing/animation/transform-after-animation-expected.html: Added. * compositing/animation/transform-after-animation.html: Added. * compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * compositing/layer-creation/animation-overlap-with-children.html: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * 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-expected.txt: * compositing/layer-creation/multiple-keyframes-animation-overlap.html: * compositing/layer-creation/resources/compositing-overlap-utils.js: Added. (makeDots): (layerTreeWithoutTransforms): (dumpLayers): * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * compositing/layer-creation/scale-rotation-animation-overlap.html: * compositing/layer-creation/scale-rotation-transition-overlap.html: * compositing/layer-creation/translate-animation-overlap-expected.txt: * compositing/layer-creation/translate-animation-overlap.html: * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * compositing/layer-creation/translate-scale-animation-overlap.html: * compositing/layer-creation/translate-scale-transition-overlap.html: * compositing/layer-creation/translate-transition-overlap.html: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html: * legacy-animation-engine/compositing/backing/transform-transition-from-outside-view-expected.txt: * legacy-animation-engine/compositing/layer-creation/animation-overlap-with-children.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/mismatched-transform-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/multiple-keyframes-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/scale-rotation-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-scale-transition-overlap.html: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap-expected.txt: * legacy-animation-engine/compositing/layer-creation/translate-transition-overlap.html: * platform/ios/compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Canonical link: https://commits.webkit.org/211618@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-30 20:20:37 +00:00
window.addEventListener('load', runTest, false);
Reduce the side-effects of animations turning off overlap testing https://bugs.webkit.org/show_bug.cgi?id=92791 Reviewed by Dean Jackson. Source/WebCore: When a layer is running a transition or animation of the transform property, we would simply disable overlap testing for later layers, which had the side-effect of promoting lots of unrelated elements into layers temporarily. Fix by maintaining overlap, but computing an overlap extent that takes the animation into account. Rotations are currently treated as full rotations. If an extent for the overlap is hard to compute (e.g. 3d transforms, or matrix animations with a rotation component), then we fall back to the current behavior. Tests: 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/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 * page/animation/AnimationBase.cpp: (WebCore::containsRotation): (WebCore::AnimationBase::computeTransformedExtentViaTransformList): When we have matched transform lists, we can map a rectangle through the various operations. Transform-origin is used to shift the origin of the box first, and then unshift after. If we encounter a rotation, for now assume it's a full rotation (a future patch could tighten this up). (WebCore::AnimationBase::computeTransformedExtentViaMatrix): If we're using matrix interpolation, we have to decompose the matrix to see if there's any rotation component, and, if there is, fall back to current behavior. * page/animation/AnimationBase.h: * page/animation/AnimationController.cpp: (WebCore::AnimationControllerPrivate::computeExtentOfAnimation): (WebCore::AnimationController::computeExtentOfAnimation): * page/animation/AnimationController.h: * page/animation/AnimationControllerPrivate.h: * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::computeExtentOfTransformAnimation): Ask active keyframe animations and transitions to compute the bounds extent. * page/animation/CompositeAnimation.h: * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation): Compute the extent of the start and end transforms, and union them. * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): (WebCore::KeyframeAnimation::getAnimatedStyle): Some nullptr goodness. (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation): Compute an extent for each keyframe, and take their union. * page/animation/KeyframeAnimation.h: * platform/graphics/GeometryUtilities.cpp: (WebCore::euclidianDistance): Use Pythagoras to compute a distance. (WebCore::boundsOfRotatingRect): Given a rect whose location is relative to the rotation origin, compute a bounds for the rotated rect by computing the furthest corner from the origin, and sweeping out a circle. * platform/graphics/GeometryUtilities.h: * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isAffectedByTransformOrigin): * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::affectedByTransformOrigin): Ask all the operations if they are affected by transform-origin. (WebCore::TransformOperations::blendByMatchingOperations): nullptr. * platform/graphics/transforms/TransformOperations.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::pushMappingToContainer): Comment fix. Only take transforms into account if the geometry map says so (which is most of the time). * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer): RenderLayerCompositor is now using the geometry map in a way that is incompatible with this assertion; it deliberately ignores transforms sometimes, so we can't easily verify that the mapping matches mapping through renderers. (WebCore::RenderGeometryMap::pushMappingsToAncestor): Save and restore the UseTransforms bit. * rendering/RenderGeometryMap.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::boundingBox): Whitespace. (WebCore::RenderLayer::getOverlapBoundsIncludingChildrenAccountingForTransformAnimations): Helper function to get the bounds of a layer, including descendants, when a transform animation is running. * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::CompositingState::CompositingState): Add a ancestorHasTransformAnimation flag to detect nested animated transforms. (WebCore::RenderLayerCompositor::OverlapExtent::knownToBeHaveExtentUncertainty): This returns true when the layer is animating transform, and the transition/animation is such that we can't easily compute the bounds of the animation. (WebCore::RenderLayerCompositor::computeExtent): const RenderLayer&. Compute the animated bounds if there's a transform animation running. (WebCore::RenderLayerCompositor::addToOverlapMap): const RenderLayer& (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): const RenderLayer& (WebCore::RenderLayerCompositor::computeCompositingRequirements): Delay the call to pushMappingsToAncestor() until knowing if there's a transform animation running, and if there is, push the mapping while ignoring transforms (since the transform is implicitly taken into account for overlap via the computed animated bounds). If this layer is running a transform animation, set the childState.ancestorHasTransformAnimation flag so that descendants will know (nested transform animations fall back to current behavior). The if (.... && isRunningAcceleratedTransformAnimation()) is what previously caused us to turn off overlap testing in the face of animations. That now only happens if we were unable to easily compute the animation bounds. (WebCore::RenderLayerCompositor::isRunningTransformAnimation): This previously tested whether an accelerated animation was running, but that's timing sensitive; AnimationController can start the transform animation, but it's not yet considered accelerated until we get an async callback from GraphicsLayer, yet this code needed to know if the animation was running. Since transform animations are always accelerated, we can just test for a running transform animation. (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation): Deleted. * rendering/RenderLayerCompositor.h: * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Some FIXME comments. LayoutTests: These test overlay an animated element with a grid of position: relative squares. These reveal the overlap area by selectively getting composited. * compositing/layer-creation/animation-overlap-with-children-expected.txt: * compositing/layer-creation/mismatched-rotated-transform-animation-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-animation-overlap.html: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-rotated-transform-transition-overlap.html: Added. * compositing/layer-creation/mismatched-transform-transition-overlap-expected.txt: Added. * compositing/layer-creation/mismatched-transform-transition-overlap.html: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap-expected.txt: Added. * compositing/layer-creation/multiple-keyframes-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-animation-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-animation-overlap.html: Added. * compositing/layer-creation/scale-rotation-transition-overlap-expected.txt: Added. * compositing/layer-creation/scale-rotation-transition-overlap.html: Added. * compositing/layer-creation/translate-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-animation-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-animation-overlap.html: Added. * compositing/layer-creation/translate-scale-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-scale-transition-overlap.html: Added. * compositing/layer-creation/translate-transition-overlap-expected.txt: Added. * compositing/layer-creation/translate-transition-overlap.html: Added. Canonical link: https://commits.webkit.org/160718@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-15 23:07:37 +00:00
</script>
</head>
<body>
<div class="box">
</div>
<pre id="layers"></pre>
</body>
</html>