haikuwebkit/LayoutTests/animations/transition-and-animation-3....

73 lines
2.1 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>
<html>
<head>
<style type="text/css" media="screen">
.box {
position: absolute;
height: 100px;
width: 100px;
left: 0px;
background-color: blue;
}
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
.box.transitioning {
transition: left 10s linear;
left: 100px;
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
}
.box.animating {
animation: move 0.1s linear;
}
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
.box.retargeted {
left: 200px;
}
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
@keyframes move {
from { left: 500px }
to { left: 501px }
}
</style>
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<div id="test" class="box"></div>
<script type="text/javascript" charset="utf-8">
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
description("Once animation has finished, box should be running left transition from 0px to 200px.");
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
window.jsTestIsAsync = true;
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
let animations;
const testElement = document.getElementById('test');
// Start the test by starting a transition from 0 to 100px.
window.setTimeout(() => testElement.classList.add("transitioning"));
// Then, once the transition has started, start an animation.
testElement.addEventListener("transitionstart", event => {
setTimeout(() => testElement.classList.add("animating"));
});
// Then wait for the animation to start and change the underlying left value.
testElement.addEventListener("animationstart", event => {
testElement.classList.add("retargeted");
});
// When the animation has ended, check that we're transitioning from ~0 > 200, and not 100 > 200.
testElement.addEventListener("animationend", event => {
animations = testElement.getAnimations();
shouldBe("animations.length", "1");
shouldBeTrue("animations[0] instanceof CSSTransition");
shouldNotBeEqualToString("animations[0].effect.getKeyframes()[0].left", "100px");
shouldBeEqualToString("animations[0].effect.getKeyframes()[1].left", "200px");
finishJSTest();
});
</script>
[Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. LayoutTests/imported/mozilla: Mark some progressions in the Mozilla CSS Animations and CSS Transitions tests. * css-transitions/test_animation-cancel-expected.txt: * css-transitions/test_animation-ready-expected.txt: Source/WebCore: We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. LayoutTests: Implementing the CSS Transitions spec for starting transitions highlighted a couple of issues with existing tests. * TestExpectations: The test imported/mozilla/css-transitions/test_animation-ready.html now passes reliably. * animations/transition-and-animation-3-expected.txt: * animations/transition-and-animation-3.html: This test was mistakenly expecting a retargeted transition to pick up from the underlying value (100px) rather than the interrupted transition's value (~0px). We update the test to be more obvious about what it is testing and with the correct behavior per the spec. * transitions/background-position-transitions-expected.txt: * transitions/background-position-transitions.html: Shorthand properties are expected to yield a transitiong for each shorthand property, so we update this test to check the background-position shorthand properties. * transitions/resources/transition-test-helpers.js: We uncovered a crash, which is not new to this patch, that forces us to work around using the background-position longhand properties. So we work around this by reading from the shorthand background-position property and manually parsing the value. Fixing this crash is tracked by webkit.org/b/186766. * transitions/transition-to-from-auto-expected.txt: * transitions/transition-to-from-auto.html: Update the test to check that we only yield transitions when interpolating between non-auto values, as mandated by the spec. Canonical link: https://commits.webkit.org/202049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-18 21:20:47 +00:00
<script src="../resources/js-test-post.js"></script>
</body>
</html>