mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
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.
This commit is contained in:
parent
39b2046c42
commit
77650fe886
Notes:
sideshowbarker
2024-07-17 20:26:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/77650fe8860
1 changed files with 5 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue