Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f28a05dbdb97a892a64d14201bcabd4510acccca
https://github.com/WebKit/WebKit/commit/f28a05dbdb97a892a64d14201bcabd4510acccca
Author: Ahmad Saleem <[email protected]>
Date: 2026-06-21 (Sun, 21 Jun 2026)
Changed paths:
A
LayoutTests/http/tests/loading/preload-css-import-after-other-rules-expected.txt
A LayoutTests/http/tests/loading/preload-css-import-after-other-rules.html
M Source/WebCore/html/parser/CSSPreloadScanner.cpp
Log Message:
-----------
CSS preload scanner fails to preload @import rules that follow an @layer
statement rule
https://bugs.webkit.org/show_bug.cgi?id=317519
rdar://180170656
Reviewed by Chris Dumez.
The CSS preload scanner only continued scanning past a @charset rule; any
other at-rule sent it to the DoneParsingImportRules state and stopped it from
preloading subsequent @import rules. Cascade layers commonly declare layer
order up front with an empty @layer statement rule (e.g. `@layer foo, bar;`)
before the @import rules, which legally precede @import per the cascade layers
spec. Because of this, none of the @import rules after such a statement were
being speculatively preloaded.
Treat a @layer statement rule like @charset in CSSPreloadScanner::emitRule()
and keep scanning. A @layer block rule (`@layer foo { ... }`) is unaffected:
it hits '{' and transitions to DoneParsingImportRules before emitRule() is
ever reached, so only the statement form (terminated by ';') flows through the
new branch.
* Source/WebCore/html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::emitRule): Continue scanning past @layer statement
rules so following @import rules are still preloaded.
* LayoutTests/http/tests/loading/preload-css-import-after-other-rules.html:
Added.
*
LayoutTests/http/tests/loading/preload-css-import-after-other-rules-expected.txt:
Added.
Canonical link: https://commits.webkit.org/315576@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications