<?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>297033</bug_id>
          
          <creation_ts>2025-08-06 20:04:18 -0700</creation_ts>
          <short_desc>[css-anchor-position-1] Changing window focus causes relayout on anchor() tests</short_desc>
          <delta_ts>2025-08-06 20:10:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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>291856</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="fantasai">fantasai.bugs</reporter>
          <assigned_to name="Antti Koivisto">koivisto</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>kiet.ho</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>2134832</commentid>
    <comment_count>0</comment_count>
    <who name="fantasai">fantasai.bugs</who>
    <bug_when>2025-08-06 20:04:18 -0700</bug_when>
    <thetext>For some reason, we are triggering relayout when the window changes focus on anchor positioning tests such as https://wpt.live/css/css-anchor-position/anchor-scope-scroll.html

This is noticeable if you turn on logging. Seems like an excessive amount of work given nothing is supposed to change?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134833</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-08-06 20:04:26 -0700</bug_when>
    <thetext>&lt;rdar://problem/157715763&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134835</commentid>
    <comment_count>2</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2025-08-06 20:10:18 -0700</bug_when>
    <thetext>It looks like the anchored element&apos;s inset value goes from fixed to auto on window focus (which then triggers layout).

in RenderStyle::changeRequiresLayout

(lldb) expr a.m_sides[0]
(const std::array&lt;WebCore::Style::InsetEdge, 4&gt;::value_type) $5 = {
  WebCore::Style::LengthWrapperBase&lt;WebCore::Style::LengthPercentage&lt;WebCore::CSS::Range, float&gt;, WebCore::Constant&lt;WebCore::CSSValueAuto&gt; &gt; = {
    m_value = {
       = (m_intValue = 1126105088, m_floatValue = 159, m_calculationValueHandle = 1126105088)
      m_type = Fixed
      m_hasQuirk = false
      m_isFloat = true
      m_isEmptyValue = false
    }
  }
}

(lldb) expr b.m_sides[0]
(const std::array&lt;WebCore::Style::InsetEdge, 4&gt;::value_type) $6 = {
  WebCore::Style::LengthWrapperBase&lt;WebCore::Style::LengthPercentage&lt;WebCore::CSS::Range, float&gt;, WebCore::Constant&lt;WebCore::CSSValueAuto&gt; &gt; = {
    m_value = {
       = (m_intValue = 0, m_floatValue = 0, m_calculationValueHandle = 0)
      m_type = Auto
      m_hasQuirk = false
      m_isFloat = true
      m_isEmptyValue = false
    }
  }
}</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>