Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2a404f3390176be6347117592a7cd12e5975a6a2
      
https://github.com/WebKit/WebKit/commit/2a404f3390176be6347117592a7cd12e5975a6a2
  Author: Chris Dumez <[email protected]>
  Date:   2026-06-21 (Sun, 21 Jun 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-range-shorthand-end-zero-offset-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-range-shorthand-end-zero-offset.html
    M Source/WebCore/css/ShorthandSerializer.cpp

  Log Message:
  -----------
  animation-range shorthand serialization drops a 0% offset on 
animation-range-end
https://bugs.webkit.org/show_bug.cgi?id=317518

Reviewed by Anne van Kesteren.

When serializing the animation-range shorthand, an offset is omitted only
when it equals the range's default: 0% for animation-range-start and 100%
for animation-range-end. ShorthandSerializer::serializeSingleAnimationRange()
already had an isDefault() helper that branches on the range type to apply
the right default, but its single call site passed a hardcoded
Style::SingleAnimationRangeType::Start, so the end value was always tested
against 0% instead of 100%.

As a result a 0% offset on the end value -- which is not the end default and
must be preserved -- was treated as omittable and collapsed to the bare range
name. This was web-observable via getPropertyValue('animation-range') /
cssText: e.g. `animation-range: normal cover 0%` serialized as `normal cover`,
which re-parses to `cover 100%`, silently losing the authored value. (A 100%
end offset, the actual end default, never reached this path because the
longhand normalizes `cover 100%` to `cover` beforehand.) The bug only
surfaced when the end's range name differed from the start's, so the existing
`contain 100% contain 0%` coverage did not catch it.

Fixed by passing the function's own `type` parameter to isDefault(), matching
its evident design and WebCore's Style model
(StyleSingleAnimationRange::defaultValue(): 0% for Start, 100% for End).

Test: 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-range-shorthand-end-zero-offset.html

The 3 new subtests are passing in Chrome already so this aligns our behavior
with them.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-range-shorthand-end-zero-offset-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-range-shorthand-end-zero-offset.html:
 Added.
* Source/WebCore/css/ShorthandSerializer.cpp:
(WebCore::ShorthandSerializer::serializeSingleAnimationRange const):

Canonical link: https://commits.webkit.org/315574@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to