Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d655d6b0d8befe387100d01453f52ef59810a80b
      
https://github.com/WebKit/WebKit/commit/d655d6b0d8befe387100d01453f52ef59810a80b
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-05 (Mon, 05 Oct 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-computed-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Transform.cpp
    M Source/WebCore/style/values/transforms/StyleRotate.h

  Log Message:
  -----------
  rotate property ignores the sign of the axis when serializing
https://bugs.webkit.org/show_bug.cgi?id=325385
rdar://188493811

Reviewed by Antti Koivisto.

When the `rotate` property specifies an axis that is parallel to a named
axis but points in the reverse direction (e.g. `0 0 -1 45deg`, `-1 0 0
400grad`), the axis must serialize to the matching keyword — or be
omitted, for z — with the angle negated, so that the serialization
represents the same rotation. Per CSS Transforms Level 2 [1]:

We were dropping the axis (or collapsing it to the x/y keyword) while
keeping the angle unchanged, so `0 0 -1 45deg` serialized as `45deg`
instead of `-45deg`, and `-1 0 0 45deg` as `x 45deg` instead of
`x -45deg`. This affected both the specified-value serialization
(element.style.rotate) and the computed-value serialization
(getComputedStyle().rotate). Firefox and Chrome both negate the angle
in these cases.

Fixed in the two serialization paths:

* consumeRotate() canonicalizes the axis vector at parse time; when the
  sole non-zero component is negative it now negates the angle in
  addition to emitting the keyword / omitting the axis.

* Style::Rotate::Function::switchOn() does the same for values that reach
  style-time serialization with a genuine negative axis-aligned vector
  (e.g. blended/animated results), negating the angle when the relevant
  component is negative.

[1] 
https://drafts.csswg.org/css-transforms-2/#individual-transform-serialization

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt:
 Progressions
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-computed-expected.txt:
 Ditto
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/parsing/rotate-parsing-valid-expected.txt:
 Ditto
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Transform.cpp:
(WebCore::CSSPropertyParserHelpers::consumeRotate):
* Source/WebCore/style/values/transforms/StyleRotate.h:
(WebCore::Style::Rotate::Function::switchOn const):

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



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

Reply via email to