Bug 297033

Summary: [css-anchor-position-1] Changing window focus causes relayout on anchor() tests
Product: WebKit Reporter: fantasai <fantasai.bugs>
Component: Layout and RenderingAssignee: Antti Koivisto <koivisto>
Status: NEW    
Severity: Normal CC: bfulgham, kiet.ho, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 291856    

fantasai
Reported 2025-08-06 20:04:18 PDT
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?
Attachments
Radar WebKit Bug Importer
Comment 1 2025-08-06 20:04:26 PDT
alan
Comment 2 2025-08-06 20:10:18 PDT
It looks like the anchored element'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<WebCore::Style::InsetEdge, 4>::value_type) $5 = { WebCore::Style::LengthWrapperBase<WebCore::Style::LengthPercentage<WebCore::CSS::Range, float>, WebCore::Constant<WebCore::CSSValueAuto> > = { 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<WebCore::Style::InsetEdge, 4>::value_type) $6 = { WebCore::Style::LengthWrapperBase<WebCore::Style::LengthPercentage<WebCore::CSS::Range, float>, WebCore::Constant<WebCore::CSSValueAuto> > = { m_value = { = (m_intValue = 0, m_floatValue = 0, m_calculationValueHandle = 0) m_type = Auto m_hasQuirk = false m_isFloat = true m_isEmptyValue = false } } }
Note You need to log in before you can comment on or make changes to this bug.