<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>229492</bug_id>
          
          <creation_ts>2021-08-25 04:50:10 -0700</creation_ts>
          <short_desc>Applying CSS animation to child elements breaks CSS filter applied to parent</short_desc>
          <delta_ts>2026-02-02 08:43:28 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Animations</component>
          <version>Safari 14</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=144012</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=213172</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="CJ Gammon">gammon</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>bfulgham</cc>
    
    <cc>dino</cc>
    
    <cc>graouts</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1787140</commentid>
    <comment_count>0</comment_count>
      <attachid>436383</attachid>
    <who name="CJ Gammon">gammon</who>
    <bug_when>2021-08-25 04:50:10 -0700</bug_when>
    <thetext>Created attachment 436383
Three circles inside a parent with filter applied.  One circle has css animation applied.

When using CSS animations to animate a child element it breaks a `filter: url(#)` applied to the parent container.  This seems to be because it forces each child to have a new render layer.

Result: The filter is no longer applied.
Expected: The filter remains applied to the parent.


See example here:
https://codepen.io/cjgammon/pen/abwzdEX

Could be related to Issue #144012: https://bugs.webkit.org/show_bug.cgi?id=144012</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1787199</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-08-25 10:11:59 -0700</bug_when>
    <thetext>Confirmed. You&apos;re right that this is similar to bug 144012.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1787200</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-08-25 10:12:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/82345483&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2176943</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2026-01-31 17:53:22 -0800</bug_when>
    <thetext>bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer&amp; layer, RequiresCompositingData&amp; queryData) const
{
    auto&amp; renderer = rendererForCompositingTests(layer);

    if (!renderer.layer()) {
        ASSERT_NOT_REACHED();
        return false;
    }

    auto hasAncestorWithReferenceFilter = [&amp;]() -&gt; bool {
        for (auto* ancestor = layer.parent(); ancestor; ancestor = ancestor-&gt;parent()) {
            auto&amp; ancestorRenderer = ancestor-&gt;renderer();
            if (!ancestorRenderer.hasFilter())
                continue;

            if (ancestorRenderer.style().filter().hasReferenceFilter())
                return true;
        }
        return false;
    };

    bool intrinsic =
        requiresCompositingForTransform(renderer)
        || requiresCompositingForAnimation(renderer)
        || requiresCompositingForPosition(renderer, *renderer.layer(), queryData)
        || requiresCompositingForCanvas(renderer)
        || requiresCompositingForFilters(renderer)
        || requiresCompositingForWillChange(renderer)
        || requiresCompositingForBackfaceVisibility(renderer)
        || requiresCompositingForViewTransition(renderer)
        || requiresCompositingForVideo(renderer)
        || requiresCompositingForModel(renderer)
        || requiresCompositingForFrame(renderer, queryData)
        || requiresCompositingForPlugin(renderer, queryData)
        || requiresCompositingForOverflowScrolling(*renderer.layer(), queryData)
        || requiresCompositingForAnchorPositioning(*renderer.layer());

    if (!intrinsic)
        return false;

    // Prevent isolated compositing when an ancestor owns an SVG reference filter.
    if (hasAncestorWithReferenceFilter())
        return false;

    queryData.intrinsic = true;
    return true;
}

This fixes it but breaks `-webkit-box-reflect` case here - https://codepen.io/cobra_winfrey/pen/JjOvxYG</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2177164</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2026-02-02 08:43:28 -0800</bug_when>
    <thetext>That&apos;s not the right fix. What we need to do here is to paint the SVG filter in compositing layers when possible, rather than just dropping them the floor.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>436383</attachid>
            <date>2021-08-25 04:50:10 -0700</date>
            <delta_ts>2021-08-25 04:50:10 -0700</delta_ts>
            <desc>Three circles inside a parent with filter applied.  One circle has css animation applied.</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>1625</size>
            <attacher name="CJ Gammon">gammon</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgICA8aGVhZD4KICAgICAgICA8c3R5bGU+CmJvZHl7CiAgaGVpZ2h0OiAxMDB2aDsK
fQoKI2ZpbHRlcnN7CiAgcG9zaXRpb246IGFic29sdXRlOwogIGxlZnQ6IC0xMDAwcHg7Cn0KCiNn
b297CiAgZmlsdGVyOiB1cmwoI2dvb2lmeSk7CiAgdHJhbnNmb3JtOiB0cmFuc2xhdGVaKDApOwog
IHdpZHRoOiAxMDAlOwogIGhlaWdodDogMTAwJTsKfQoKLmNpcmNsZTpudGgtY2hpbGQoMSkgewog
IGFuaW1hdGlvbjogbW92ZUEgMTBzOwp9CgpAa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ICAgICAgICAg
MCAwIDEgMCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIDAgMCAwIDI1NSAtMTUzIiAvPgo8L2ZpbHRlcj4KICAgIDwvZGVmcz4KPC9zdmc+CgoKPGRp
diBpZD0iZ29vIj4KICA8c3ZnIGNsYXNzPSJjaXJjbGUiIHdpZHRoPSIxODAiIGhlaWdodD0iMTgw
IiBkYXRhLXg9IjAiIGRhdGEteT0iMCI+CiAgICAgPGNpcmNsZSBjeD0iOTAiIGN5PSI5MCIgcj0i
OTAiIGZpbGw9InJlZCIgLz4KICA8L3N2Zz4KICA8c3ZnIGNsYXNzPSJjaXJjbGUiIHdpZHRoPSIx
ODAiIGhlaWdodD0iMTgwIiBkYXRhLXg9IjAiIGRhdGEteT0iMCI+CiAgICAgPGNpcmNsZSBjeD0i
OTAiIGN5PSI5MCIgcj0iOTAiZmlsbD0iYmx1ZSIgLz4KICA8L3N2Zz4KICA8c3ZnIGNsYXNzPSJj
aXJjbGUiIHdpZHRoPSIxODAiIGhlaWdodD0iMTgwIiBkYXRhLXg9IjAiIGRhdGEteT0iMCI+CiAg
ICAgPGNpcmNsZSBjeD0iOTAiIGN5PSI5MCIgcj0iOTAiIGZpbGw9Im9yYW5nZSIgLz4KICA8L3N2
Zz4KPC9kaXY+CiAgICA8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>