1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

LibWeb: Use String for getting/setting MediaQueryList media

This commit is contained in:
Sam Atkins 2023-12-01 16:54:48 +00:00 committed by Andreas Kling
parent 6dbc3044bd
commit ef1e942f3e
6 changed files with 7 additions and 7 deletions

View file

@ -43,9 +43,9 @@ void MediaQueryList::visit_edges(Cell::Visitor& visitor)
}
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-media
DeprecatedString MediaQueryList::media() const
String MediaQueryList::media() const
{
return serialize_a_media_query_list(m_media).to_deprecated_string();
return serialize_a_media_query_list(m_media);
}
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-matches

View file

@ -22,7 +22,7 @@ public:
virtual ~MediaQueryList() override = default;
DeprecatedString media() const;
String media() const;
bool matches() const;
bool evaluate();

View file

@ -39,7 +39,7 @@ public:
return m_media;
}
void set_media(DeprecatedString media)
void set_media(String media)
{
m_media->set_media_text(media);
}

View file

@ -2181,7 +2181,7 @@ void Document::evaluate_media_queries_and_report_changes()
if (did_match != now_matches) {
CSS::MediaQueryListEventInit init;
init.media = String::from_deprecated_string(media_query_list->media()).release_value_but_fixme_should_propagate_errors();
init.media = media_query_list->media();
init.matches = now_matches;
auto event = CSS::MediaQueryListEvent::create(realm(), HTML::EventNames::change, init);
event->set_is_trusted(true);

View file

@ -95,7 +95,7 @@ void StyleElementUtils::create_a_css_style_sheet(DOM::Document& document, Deprec
sheet.set_owner_css_rule(owner_rule);
sheet.set_owner_node(owner_node);
sheet.set_type(MUST(String::from_deprecated_string(type)));
sheet.set_media(move(media));
sheet.set_media(MUST(String::from_deprecated_string(media)));
sheet.set_title(MUST(String::from_deprecated_string(title)));
sheet.set_alternate(alternate);
sheet.set_origin_clean(origin_clean);

View file

@ -369,7 +369,7 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru
if (m_loaded_style_sheet) {
m_loaded_style_sheet->set_owner_node(this);
m_loaded_style_sheet->set_media(deprecated_attribute(HTML::AttributeNames::media));
m_loaded_style_sheet->set_media(attribute(HTML::AttributeNames::media).value_or({}));
document().style_sheets().add_sheet(*m_loaded_style_sheet);
} else {
dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Failed to parse stylesheet: {}", resource()->url());