Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5c614d46912aa58bb34efc59108a926158b05806
https://github.com/WebKit/WebKit/commit/5c614d46912aa58bb34efc59108a926158b05806
Author: Antti Koivisto <[email protected]>
Date: 2026-03-18 (Wed, 18 Mar 2026)
Changed paths:
A
LayoutTests/fast/css/anchor-position-media-query-viewport-units-expected.html
A LayoutTests/fast/css/anchor-position-media-query-viewport-units.html
M Source/WebCore/dom/Document.cpp
Log Message:
-----------
[css-anchor-position-1] Media queries may fail to resolve in presence of
viewport units and anchors
https://bugs.webkit.org/show_bug.cgi?id=310086
rdar://172385594
Reviewed by Alan Baradlay.
On window resize the presence of viewport units invalidates style. We enter
style resolution
where the anchor positioning triggers interleaved layout. Media query
evaluation is not performed in
during these nested layouts. We then exit style resolution with layout clean but
the media queries still have not been evaluated.
Without viewport units we would just invalidate layout and resolve media
queries before that.
Without anchor positioning we would do a normal layout after style resolution
also resolving media queries.
Test: fast/css/anchor-position-media-query-viewport-units.html
*
LayoutTests/fast/css/anchor-position-media-query-viewport-units-expected.html:
Added.
* LayoutTests/fast/css/anchor-position-media-query-viewport-units.html: Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::resolveStyle):
Fix by ensuring we evalute media queries when already before entering style
resolution, not just before layout.
Canonical link: https://commits.webkit.org/309470@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications