Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec9c24b678b4159b2365e99b89de6bdf84a1f1d7
      
https://github.com/WebKit/WebKit/commit/ec9c24b678b4159b2365e99b89de6bdf84a1f1d7
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-22 (Fri, 22 May 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/animations/zoom-interpolation-expected.txt
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/style/computed/StyleComputedStyleBase.cpp
    M Source/WebCore/style/computed/StyleComputedStyleBase.h
    M 
Source/WebCore/style/computed/StyleComputedStyleProperties+SettersCustomInlines.h
    M Source/WebCore/style/values/viewport/StyleZoom.h

  Log Message:
  -----------
  [CSS Viewport] Make zoom animatable by computed value
https://bugs.webkit.org/show_bug.cgi?id=315081
rdar://177411607

Reviewed by Sam Weinig.

This patch aligns WebKit with the recent CSS Viewport Specification
resolution [1] that defines `zoom` as animatable by computed value.

WebKit previously marked `zoom` as "not animatable", leading to ~150
failing subtests in the recently-added zoom-interpolation.html.

The change flips `zoom`'s animation-type to "by computed value" so the
auto-derived tuple-like `Blending<Style::Zoom>` (forwarding to the
existing `Blending<NumberOrPercentageResolvedToNumber<...>>`) handles
the interpolation. The standard `StyleTypeWrapper` is then wired up via
`animation-wrapper-requires-setter`, pointing at a new
`Style::ComputedStyleBase::setZoomFromAnimation` (mirroring
`setLetterSpacingFromAnimation` / `setWordSpacingFromAnimation`).

The dedicated setter is needed to avoid a double-apply bug: `setZoom`
multiplies the new specified value into the cumulative `usedZoom`, so
the style builder calls `resetUsedZoom()` (usedZoom <- parent.usedZoom)
before each `setZoom`. The animation pipeline doesn't issue that reset,
so calling `setZoom` directly would fold the destination's existing
zoom in a second time. `setZoomFromAnimation` recovers the parent's
`usedZoom` from the destination's current (specifiedZoom, usedZoom)
pair and replays the multiplication, leaving usedZoom at
`parent.usedZoom * specifiedZoom` — so layout reflects the animated
value.

It also applies the legacy `zoom: 0` -> `1` fold (matching
`StyleBuilderCustom::applyValueZoom`) so that negative-progress
extrapolation that clamps near 0 doesn't leak through.

[1] https://github.com/w3c/csswg-drafts/issues/10872

* Source/WebCore/css/CSSProperties.json:
Change `zoom`'s animation-type from "not animatable" to
"by computed value" and route the wrapper's setter through
`setZoomFromAnimation` via `animation-wrapper-requires-setter`.

* Source/WebCore/style/computed/StyleComputedStyleBase.h:
* Source/WebCore/style/computed/StyleComputedStyleBase.cpp:
Add `setZoomFromAnimation`, which recovers parent's `usedZoom` from
the destination's existing (specifiedZoom, usedZoom) pair, replays
the `usedZoom = parent.usedZoom * specifiedZoom` accumulation under
the same clamp `setZoom` uses, and applies the `zoom: 0` -> `1`
legacy fold.

* Source/WebCore/style/values/viewport/StyleZoom.h:
Hoist `minEffective` / `maxEffective` clamp bounds onto
`Style::Zoom` so `setZoom` and `setZoomFromAnimation` share one
source of truth.

* 
Source/WebCore/style/computed/StyleComputedStyleProperties+SettersCustomInlines.h:
Use the hoisted `Style::Zoom::minEffective` / `maxEffective`
constants.

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



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

Reply via email to