Skip to content

Commit

Permalink
[web-animations] web-animations/responsive/width.html is a failure
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=272084

Reviewed by Antti Koivisto.

In 242527@main, a check was added to return a zero-length in cases where we were trying to
blending lengths with mixed types, but one used a keyword. In the case of the WPT test
web-animations/responsive/width.html which tested `width` blending between `min-content`
and a fixed value, this meant that we would always resolve a zero-width for the first half
such an animation, instead of returning `min-content`.

We adjust the change made in 242527@main to deal with "intrinsic" values specifically since
these will always yield discrete interpolation, as established by `canInterpolateLengths()`,
and thus we can return either the "from" or "to" value.

* LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/width-expected.txt:
* Source/WebCore/platform/Length.cpp:
(WebCore::blendMixedTypes):

Canonical link: https://commits.webkit.org/277112@main
  • Loading branch information
graouts committed Apr 5, 2024
1 parent 02e8281 commit 1166d97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

PASS width responsive to style changes
PASS width clamped to 0px on keyframes
FAIL width responsive to inherited changes from keyword assert_equals: expected "20px" but got "0px"
PASS width responsive to inherited changes from keyword
PASS width responsive to inherited changes from length

12 changes: 9 additions & 3 deletions Source/WebCore/platform/Length.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,21 @@ static Length blendMixedTypes(const Length& from, const Length& to, const Blendi
if (context.compositeOperation != CompositeOperation::Replace)
return makeCalculated(CalcOperator::Add, from, to);

if (from.isIntrinsicOrAuto() || to.isIntrinsicOrAuto()) {
ASSERT(context.isDiscrete);
ASSERT(!context.progress || context.progress == 1);
return context.progress ? to : from;
}

if (from.isRelative() || to.isRelative())
return { 0, LengthType::Fixed };

if (!to.isCalculated() && !from.isPercent() && (context.progress == 1 || from.isZero()))
return blend(Length(0, to.type()), to, context);

if (!from.isCalculated() && !to.isPercent() && (!context.progress || to.isZero()))
return blend(from, Length(0, from.type()), context);

if (from.isIntrinsicOrAuto() || to.isIntrinsicOrAuto() || from.isRelative() || to.isRelative())
return { 0, LengthType::Fixed };

auto blend = makeUnique<CalcExpressionBlendLength>(from, to, context.progress);
return Length(CalculationValue::create(WTFMove(blend), ValueRange::All));
}
Expand Down

0 comments on commit 1166d97

Please sign in to comment.