1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Make @import rules functional again :^)

The changes in commit d462a6720a meant
that `CSSLoader::load_next_import_if_needed()` was no longer being
called, so no `@import` rules were loading.

The spec does not seem to mention when that loading should take place,
but WebKit does this at parse time, as each rule is added to the style
sheet. If it works for them, it's probably not that bad. :^)

So, that's what we now do here. The `CSSImportRule` creates a fetch
request when it is constructed, so each one is responsible for its own
contents.
This commit is contained in:
Sam Atkins 2021-11-18 17:34:53 +00:00 committed by Andreas Kling
parent ce6fd38e5d
commit 738e682ae0
3 changed files with 54 additions and 7 deletions

View file

@ -1747,7 +1747,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
}
if (url.has_value())
return CSSImportRule::create(url.value());
return CSSImportRule::create(url.value(), const_cast<DOM::Document&>(*m_context.document()));
else
dbgln("Unable to parse url from @import rule");