summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-19 09:42:49 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-23 01:22:41 +0100
commit77650fe88608b0970455a9725cff41c4aade8f10 (patch)
treeaef0c58a680cfb38a3a9f4287e29e0da5a9020ce /Userland/Libraries/LibWeb
parent39b2046c427a5be11551cf7f430c8ae542390069 (diff)
downloadserenity-77650fe88608b0970455a9725cff41c4aade8f10.zip
LibWeb: Remove duplicate checks in for_each_effective_style_rule()
After confirming the rule types, we can use static_cast instead of verify_cast to avoid some extra work.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
index b580b0e7fe..984ed095c4 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
@@ -80,22 +80,22 @@ DOM::ExceptionOr<void> CSSRuleList::remove_a_css_rule(u32 index)
void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
{
- for (auto& rule : m_rules) {
+ for (auto const& rule : m_rules) {
switch (rule.type()) {
case CSSRule::Type::Style:
- callback(verify_cast<CSSStyleRule>(rule));
+ callback(static_cast<CSSStyleRule const&>(rule));
break;
case CSSRule::Type::Import: {
- auto const& import_rule = verify_cast<CSSImportRule>(rule);
+ auto const& import_rule = static_cast<CSSImportRule const&>(rule);
if (import_rule.has_import_result())
import_rule.loaded_style_sheet()->for_each_effective_style_rule(callback);
break;
}
case CSSRule::Type::Media:
- verify_cast<CSSMediaRule>(rule).for_each_effective_style_rule(callback);
+ static_cast<CSSMediaRule const&>(rule).for_each_effective_style_rule(callback);
break;
case CSSRule::Type::Supports:
- verify_cast<CSSSupportsRule>(rule).for_each_effective_style_rule(callback);
+ static_cast<CSSSupportsRule const&>(rule).for_each_effective_style_rule(callback);
break;
case CSSRule::Type::__Count:
VERIFY_NOT_REACHED();