Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8da2ffcdc7dc113b0f0a195063316b39819c1653
      
https://github.com/WebKit/WebKit/commit/8da2ffcdc7dc113b0f0a195063316b39819c1653
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-08 (Wed, 08 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-with-transition-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-with-transition.html
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/PropertyCascade.h
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilder.h
    M Source/WebCore/style/StyleTreeResolver.cpp
    M Source/WebCore/style/StyleTreeResolver.h
    M Source/WebCore/style/Styleable.h

  Log Message:
  -----------
  !important should override CSS animations even when CSS transitions are also 
running
https://bugs.webkit.org/show_bug.cgi?id=311628

Reviewed by Antti Koivisto.

Previously, applyCascadeAfterAnimation used a single bool to choose
between AfterTransition and AfterAnimation cascade types. When an
element had both running transitions and animations, AfterTransition
was selected, which prevented !important declarations from overriding
CSS animation values.

Per https://drafts.csswg.org/css-cascade-5/#importance, "important
declarations from all origins take precedence over animations." However,
transition declarations take precedence over important declarations
per the cascade sorting order. When both are present, each animated
property must be handled according to whether it is animated by a
transition or an animation.

The fix introduces a PropertyCascade::AnimationSource enum with
CSSAnimation and CSSTransition flags. Instead of passing two separate
HashSets of animated properties, we now pass a single
HashMap<AnimatableCSSProperty, EnumSet<AnimationSource>> so that
shouldApplyAfterAnimation can distinguish per-property whether it is
animated by a transition, an animation, or both. This also removes the
now-unused PropertyType::AfterTransition enum value.

Test: 
imported/w3c/web-platform-tests/css/css-animations/animation-important-with-transition.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-with-transition-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-with-transition.html:
 Added.
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::PropertyCascade):
(WebCore::Style::PropertyCascade::AnimationLayer::AnimationLayer):
(WebCore::Style::PropertyCascade::shouldApplyAfterAnimation):
* Source/WebCore/style/PropertyCascade.h:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):
* Source/WebCore/style/StyleBuilder.h:
* Source/WebCore/style/Styleable.h:
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
(WebCore::Style::TreeResolver::applyCascadeAfterAnimation):
* Source/WebCore/style/StyleTreeResolver.h:

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



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

Reply via email to