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

LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr

This commit is contained in:
Matthew Olsson 2023-02-26 16:09:02 -07:00 committed by Andreas Kling
parent 1df3652e27
commit 7c0c1c8f49
214 changed files with 825 additions and 827 deletions

View file

@ -47,7 +47,7 @@ void CSSRuleList::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
for (auto& rule : m_rules)
visitor.visit(&rule);
visitor.visit(rule);
}
bool CSSRuleList::is_supported_property_index(u32 index) const
@ -123,23 +123,23 @@ WebIDL::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 const& rule : m_rules) {
switch (rule.type()) {
switch (rule->type()) {
case CSSRule::Type::FontFace:
break;
case CSSRule::Type::Import: {
auto const& import_rule = static_cast<CSSImportRule const&>(rule);
auto const& import_rule = static_cast<CSSImportRule const&>(*rule);
if (import_rule.has_import_result() && import_rule.loaded_style_sheet())
import_rule.loaded_style_sheet()->for_each_effective_style_rule(callback);
break;
}
case CSSRule::Type::Media:
static_cast<CSSMediaRule const&>(rule).for_each_effective_style_rule(callback);
static_cast<CSSMediaRule const&>(*rule).for_each_effective_style_rule(callback);
break;
case CSSRule::Type::Style:
callback(static_cast<CSSStyleRule const&>(rule));
callback(static_cast<CSSStyleRule const&>(*rule));
break;
case CSSRule::Type::Supports:
static_cast<CSSSupportsRule const&>(rule).for_each_effective_style_rule(callback);
static_cast<CSSSupportsRule const&>(*rule).for_each_effective_style_rule(callback);
break;
}
}
@ -150,17 +150,17 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
bool any_media_queries_changed_match_state = false;
for (auto& rule : m_rules) {
switch (rule.type()) {
switch (rule->type()) {
case CSSRule::Type::FontFace:
break;
case CSSRule::Type::Import: {
auto& import_rule = verify_cast<CSSImportRule>(rule);
auto& import_rule = verify_cast<CSSImportRule>(*rule);
if (import_rule.has_import_result() && import_rule.loaded_style_sheet() && import_rule.loaded_style_sheet()->evaluate_media_queries(window))
any_media_queries_changed_match_state = true;
break;
}
case CSSRule::Type::Media: {
auto& media_rule = verify_cast<CSSMediaRule>(rule);
auto& media_rule = verify_cast<CSSMediaRule>(*rule);
bool did_match = media_rule.condition_matches();
bool now_matches = media_rule.evaluate(window);
if (did_match != now_matches)
@ -172,7 +172,7 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
case CSSRule::Type::Style:
break;
case CSSRule::Type::Supports: {
auto& supports_rule = verify_cast<CSSSupportsRule>(rule);
auto& supports_rule = verify_cast<CSSSupportsRule>(*rule);
if (supports_rule.condition_matches() && supports_rule.css_rules().evaluate_media_queries(window))
any_media_queries_changed_match_state = true;
break;