<?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>301461</bug_id>
          
          <creation_ts>2025-10-25 05:44:08 -0700</creation_ts>
          <short_desc>[css-transitions][css-anchor-position] transitioning an accelerated property to show a popover with anchor positioning yields two transitions, fails to transition again</short_desc>
          <delta_ts>2025-11-05 07:26:05 -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>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=301510</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>
          
          <blocked>301070</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Antoine Quint">graouts</reporter>
          <assigned_to name="Kiet Ho">kiet.ho</assigned_to>
          <cc>jamesnw</cc>
    
    <cc>kiet.ho</cc>
    
    <cc>koivisto</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2154233</commentid>
    <comment_count>0</comment_count>
      <attachid>477196</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 05:44:08 -0700</bug_when>
    <thetext>Created attachment 477196
Testcase

This is a bug for one of the issues shown in bug 301070, or perhaps it&apos;ll be a duplicate, but there&apos;s something fishy going on when using a CSS Transition to show a popover when anchor positioning is involved. The attached test case does the following:

======================

&lt;style&gt;

[popover] {
    transition: opacity 1s ease-in-out;

    position-try: flip-inline;

    &amp;:popover-open {
        display: block;
        opacity: 1;
    }

    @starting-style {
        &amp;:popover-open {
            opacity: 0;
        }
    }
}
&lt;/style&gt;

&lt;button type=&quot;button&quot; popovertarget=&quot;popover&quot;&gt;Show popover&lt;/button&gt;

&lt;div id=&quot;popover&quot; popover&gt;
    &lt;p&gt;Popover&lt;/p&gt;
&lt;/div&gt;

======================

Clicking the &quot;Show popover&quot; visually has the right behavior but as it turns out the `opacity` transitions run twice, a second transition starting once the first, expected, transition completes.

Another issue is that after dismissing the popover, the transition will not run again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154235</commentid>
    <comment_count>1</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 05:45:24 -0700</bug_when>
    <thetext>Using another accelerated property, such as `translate`, reproduces the issue. Using a non-accelerated property, such as `margin-left`, does not reproduce the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154250</commentid>
    <comment_count>2</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 10:39:14 -0700</bug_when>
    <thetext>The reason it does not look like a second transition is running is because it&apos;s transitioning from `0.999571919` to `1`. I&apos;m not sure yet why it&apos;s picking `0.999571919`, which is clearly an animated value and which should not be considered as a value for considering a transition, over the underlying value, which should be 1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154253</commentid>
    <comment_count>3</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 10:52:48 -0700</bug_when>
    <thetext>We get `oldStyle` in `Style::TreeResolver::createAnimatedElementUpdate()` by calling `resolveStartingStyle()` when the first transition is created. When the second is created, we get it by calling `beforeResolutionStyle()`. Somehow an animated value snuck into what is stored in `m_savedBeforeResolutionStylesForInterleaving`.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154254</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 11:02:17 -0700</bug_when>
    <thetext>I see that there&apos;s some code where `m_savedBeforeResolutionStylesForInterleaving` is populated which is specific to when anchor positioning is involved in `Style:::

        // Ensure that style resolution visits any unresolved anchor-positioned elements.
        if (elementAndState.value-&gt;stage &lt; AnchorPositionResolutionStage::Resolved) {
            const_cast&lt;Element&amp;&gt;(*elementAndState.key.first).invalidateForResumingAnchorPositionedElementResolution();
            m_needsInterleavedLayout = true;
            saveBeforeResolutionStyleForInterleaving(*elementAndState.key.first);
        }

I get a hunch that is something is wrong either in what we store in `m_savedBeforeResolutionStylesForInterleaving` or the circumstance under which we use it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154257</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 11:09:41 -0700</bug_when>
    <thetext>Yes, logging indicates the `oldStyle` we get for the second transition is read from `m_savedBeforeResolutionStylesForInterleaving` and was stored in the function call above. Somehow we&apos;re resolving an animated style there, which is incorrect.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154258</commentid>
    <comment_count>6</comment_count>
      <attachid>477199</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-10-25 11:10:08 -0700</bug_when>
    <thetext>Created attachment 477199
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154523</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-10-27 14:17:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/163512045&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>477196</attachid>
            <date>2025-10-25 05:44:08 -0700</date>
            <delta_ts>2025-10-25 11:10:08 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>anchor-popover-transition.html</filename>
            <type>text/html</type>
            <size>965</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64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ZXZlbnQu
cHJvcGVydHlOYW1lfTwvY29kZT48L3A+YCk7CmZvciAoZXZlbnRUeXBlIG9mIFsndHJhbnNpdGlv
bnN0YXJ0JywgJ3RyYW5zaXRpb25lbmQnLCAndHJhbnNpdGlvbmNhbmNlbCddKQogICAgcG9wb3Zl
ci5hZGRFdmVudExpc3RlbmVyKGV2ZW50VHlwZSwgZHVtcEV2ZW50KTsKCjwvc2NyaXB0Pgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>477199</attachid>
            <date>2025-10-25 11:10:08 -0700</date>
            <delta_ts>2025-10-25 11:10:08 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>anchor-popover-transition.html</filename>
            <type>text/html</type>
            <size>1063</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">PHN0eWxlPgoKW3BvcG92ZXJdIHsKICAgIC8qIGFuaW1hdGluZyBgbWFyZ2luLWxlZnRgIGRvZXMg
bm90IHJlcHJvZHVjZSB0aGUgaXNzdWUsCiAgICAgICBhbmltYXRpb24gYHRyYW5zbGF0ZWAgZG9l
cyAqLwogICAgdHJhbnNpdGlvbjogb3BhY2l0eSAxcyBlYXNlLWluLW91dDsKCiAgICAvKiBkb2Vz
IG5vdCByZXByb2R1Y2Ugd2l0aCB0aGlzIHByb3BlcnR5IGNvbW1lbnRlZCBvdXQgKi8KICAgIHBv
c2l0aW9uLXRyeTogZmxpcC1pbmxpbmU7CgogICAgJjpwb3BvdmVyLW9wZW4gewogICAgICAgIGRp
c3BsYXk6IGJsb2NrOwogICAgICAgIG9wYWNpdHk6IDE7CiAgICB9CgogICAgQHN0YXJ0aW5nLXN0
eWxlIHsKICAgICAgICAmOnBvcG92ZXItb3BlbiB7CiAgICAgICAgICAgIG9wYWNpdHk6IDA7CiAg
ICAgICAgfQogICAgfQp9Cjwvc3R5bGU+Cgo8YnV0dG9uIHR5cGU9ImJ1dHRvbiIgcG9wb3ZlcnRh
cm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