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

LibWeb: Implement initial CSSFontFaceRule and FontFace classes

For now, this is the bare minimum that's needed: font-family and src.
This commit is contained in:
Sam Atkins 2022-03-28 20:30:26 +01:00 committed by Andreas Kling
parent 1dcde57922
commit 804b8c85e8
13 changed files with 173 additions and 6 deletions

View file

@ -78,8 +78,7 @@ void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const
{
for (auto const& rule : m_rules) {
switch (rule.type()) {
case CSSRule::Type::Style:
callback(static_cast<CSSStyleRule const&>(rule));
case CSSRule::Type::FontFace:
break;
case CSSRule::Type::Import: {
auto const& import_rule = static_cast<CSSImportRule const&>(rule);
@ -90,6 +89,9 @@ void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const
case CSSRule::Type::Media:
static_cast<CSSMediaRule const&>(rule).for_each_effective_style_rule(callback);
break;
case CSSRule::Type::Style:
callback(static_cast<CSSStyleRule const&>(rule));
break;
case CSSRule::Type::Supports:
static_cast<CSSSupportsRule const&>(rule).for_each_effective_style_rule(callback);
break;
@ -105,7 +107,7 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
for (auto& rule : m_rules) {
switch (rule.type()) {
case CSSRule::Type::Style:
case CSSRule::Type::FontFace:
break;
case CSSRule::Type::Import: {
auto& import_rule = verify_cast<CSSImportRule>(rule);
@ -123,6 +125,8 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
any_media_queries_changed_match_state = true;
break;
}
case CSSRule::Type::Style:
break;
case CSSRule::Type::Supports: {
auto& supports_rule = verify_cast<CSSSupportsRule>(rule);
if (supports_rule.condition_matches() && supports_rule.css_rules().evaluate_media_queries(window))