Ignore:
Timestamp:
Jan 6, 2022, 2:46:20 AM (3 years ago)
Author:
[email protected]
Message:

computed style for transition longhand properties is wrong
https://bugs.webkit.org/show_bug.cgi?id=234880

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Mark WPT progressions.

  • web-platform-tests/css/css-transitions/parsing/transition-delay-computed-expected.txt:
  • web-platform-tests/css/css-transitions/parsing/transition-duration-computed-expected.txt:
  • web-platform-tests/css/css-transitions/parsing/transition-property-computed-expected.txt:
  • web-platform-tests/css/css-transitions/parsing/transition-timing-function-computed-expected.txt:
  • web-platform-tests/css/css-transitions/transition-delay-001-expected.txt:
  • web-platform-tests/css/css-transitions/transition-duration-001-expected.txt:

Source/WebCore:

We had two issues in the way we treated animation lists.

First, we would always output the filled-in values in the computed style, which
meant that setting animation-name: one, two; animation-duration: 1s would yield
1s, 1s instead of just 1s for animation-duration. So we now maintain a bit
on Animation to indicate whether a given value was set for filling and
ComputedStyleExtractor::addValueForAnimationPropertyToList() can now query it
before adding this value when returning the computed style.

Second, in RenderStyle::adjustTransitions(), we would mistakenly try to remove entries
if we found a transition-property repeated. However, this is valid so we remove the
code related to this entirely.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::addValueForAnimationPropertyToList):

  • platform/animation/Animation.cpp:

(WebCore::Animation::Animation):

  • platform/animation/Animation.h:

(WebCore::Animation::clearDelay):
(WebCore::Animation::clearDirection):
(WebCore::Animation::clearDuration):
(WebCore::Animation::clearFillMode):
(WebCore::Animation::clearIterationCount):
(WebCore::Animation::clearPlayState):
(WebCore::Animation::clearProperty):
(WebCore::Animation::clearTimingFunction):
(WebCore::Animation::fillDelay):
(WebCore::Animation::fillDirection):
(WebCore::Animation::fillDuration):
(WebCore::Animation::fillFillMode):
(WebCore::Animation::fillIterationCount):
(WebCore::Animation::fillPlayState):
(WebCore::Animation::fillProperty):
(WebCore::Animation::fillTimingFunction):
(WebCore::Animation::isDelayFilled const):
(WebCore::Animation::isDirectionFilled const):
(WebCore::Animation::isDurationFilled const):
(WebCore::Animation::isFillModeFilled const):
(WebCore::Animation::isIterationCountFilled const):
(WebCore::Animation::isPlayStateFilled const):
(WebCore::Animation::isPropertyFilled const):
(WebCore::Animation::isTimingFunctionFilled const):

  • platform/animation/AnimationList.cpp:

(WebCore::AnimationList::fillUnsetProperties):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::adjustTransitions):

LayoutTests:

This test was incorrect since it assumed that filled-in values in animation lists
would be part of the computed style. We update the expectation and add other properties
that weren't being tested.

  • animations/fill-unset-properties-expected.txt:
  • animations/fill-unset-properties.html:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r287669 r287678  
    14351435void ComputedStyleExtractor::addValueForAnimationPropertyToList(CSSValueList& list, CSSPropertyID property, const Animation* animation)
    14361436{
    1437     if (property == CSSPropertyAnimationDuration || property == CSSPropertyTransitionDuration)
    1438         list.append(valueForAnimationDuration(animation ? animation->duration() : Animation::initialDuration()));
    1439     else if (property == CSSPropertyAnimationDelay || property == CSSPropertyTransitionDelay)
    1440         list.append(valueForAnimationDelay(animation ? animation->delay() : Animation::initialDelay()));
    1441     else if (property == CSSPropertyAnimationIterationCount)
    1442         list.append(valueForAnimationIterationCount(animation ? animation->iterationCount() : Animation::initialIterationCount()));
    1443     else if (property == CSSPropertyAnimationDirection)
    1444         list.append(valueForAnimationDirection(animation ? animation->direction() : Animation::initialDirection()));
    1445     else if (property == CSSPropertyAnimationFillMode)
    1446         list.append(valueForAnimationFillMode(animation ? animation->fillMode() : Animation::initialFillMode()));
    1447     else if (property == CSSPropertyAnimationPlayState)
    1448         list.append(valueForAnimationPlayState(animation ? animation->playState() : Animation::initialPlayState()));
    1449     else if (property == CSSPropertyAnimationName)
     1437    if (property == CSSPropertyAnimationDuration || property == CSSPropertyTransitionDuration) {
     1438        if (!animation || !animation->isDurationFilled())
     1439            list.append(valueForAnimationDuration(animation ? animation->duration() : Animation::initialDuration()));
     1440    } else if (property == CSSPropertyAnimationDelay || property == CSSPropertyTransitionDelay) {
     1441        if (!animation || !animation->isDelayFilled())
     1442            list.append(valueForAnimationDelay(animation ? animation->delay() : Animation::initialDelay()));
     1443    } else if (property == CSSPropertyAnimationIterationCount) {
     1444        if (!animation || !animation->isIterationCountFilled())
     1445            list.append(valueForAnimationIterationCount(animation ? animation->iterationCount() : Animation::initialIterationCount()));
     1446    } else if (property == CSSPropertyAnimationDirection) {
     1447        if (!animation || !animation->isDirectionFilled())
     1448            list.append(valueForAnimationDirection(animation ? animation->direction() : Animation::initialDirection()));
     1449    } else if (property == CSSPropertyAnimationFillMode) {
     1450        if (!animation || !animation->isFillModeFilled())
     1451            list.append(valueForAnimationFillMode(animation ? animation->fillMode() : Animation::initialFillMode()));
     1452    } else if (property == CSSPropertyAnimationPlayState) {
     1453        if (!animation || !animation->isPlayStateFilled())
     1454            list.append(valueForAnimationPlayState(animation ? animation->playState() : Animation::initialPlayState()));
     1455    } else if (property == CSSPropertyAnimationName)
    14501456        list.append(valueForAnimationName(animation ? animation->name() : Animation::initialName()));
    14511457    else if (property == CSSPropertyTransitionProperty) {
    1452         if (animation)
    1453             list.append(createTransitionPropertyValue(*animation));
    1454         else
     1458        if (animation) {
     1459            if (!animation->isPropertyFilled())
     1460                list.append(createTransitionPropertyValue(*animation));
     1461        } else
    14551462            list.append(CSSValuePool::singleton().createIdentifierValue(CSSValueAll));
    14561463    } else if (property == CSSPropertyAnimationTimingFunction || property == CSSPropertyTransitionTimingFunction) {
    1457         if (animation)
    1458             list.append(valueForAnimationTimingFunction(*animation->timingFunction()));
    1459         else
     1464        if (animation) {
     1465            if (!animation->isTimingFunctionFilled())
     1466                list.append(valueForAnimationTimingFunction(*animation->timingFunction()));
     1467        } else
    14601468            list.append(valueForAnimationTimingFunction(CubicBezierTimingFunction::defaultTimingFunction()));
    14611469    } else
Note: See TracChangeset for help on using the changeset viewer.