mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
LibWeb: Use String for getting/setting MediaQueryList media
This commit is contained in:
parent
6dbc3044bd
commit
ef1e942f3e
6 changed files with 7 additions and 7 deletions
|
@ -43,9 +43,9 @@ void MediaQueryList::visit_edges(Cell::Visitor& visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-media
|
// 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
|
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-matches
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
virtual ~MediaQueryList() override = default;
|
virtual ~MediaQueryList() override = default;
|
||||||
|
|
||||||
DeprecatedString media() const;
|
String media() const;
|
||||||
bool matches() const;
|
bool matches() const;
|
||||||
bool evaluate();
|
bool evaluate();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
return m_media;
|
return m_media;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_media(DeprecatedString media)
|
void set_media(String media)
|
||||||
{
|
{
|
||||||
m_media->set_media_text(media);
|
m_media->set_media_text(media);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2181,7 +2181,7 @@ void Document::evaluate_media_queries_and_report_changes()
|
||||||
|
|
||||||
if (did_match != now_matches) {
|
if (did_match != now_matches) {
|
||||||
CSS::MediaQueryListEventInit init;
|
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;
|
init.matches = now_matches;
|
||||||
auto event = CSS::MediaQueryListEvent::create(realm(), HTML::EventNames::change, init);
|
auto event = CSS::MediaQueryListEvent::create(realm(), HTML::EventNames::change, init);
|
||||||
event->set_is_trusted(true);
|
event->set_is_trusted(true);
|
||||||
|
|
|
@ -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_css_rule(owner_rule);
|
||||||
sheet.set_owner_node(owner_node);
|
sheet.set_owner_node(owner_node);
|
||||||
sheet.set_type(MUST(String::from_deprecated_string(type)));
|
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_title(MUST(String::from_deprecated_string(title)));
|
||||||
sheet.set_alternate(alternate);
|
sheet.set_alternate(alternate);
|
||||||
sheet.set_origin_clean(origin_clean);
|
sheet.set_origin_clean(origin_clean);
|
||||||
|
|
|
@ -369,7 +369,7 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru
|
||||||
|
|
||||||
if (m_loaded_style_sheet) {
|
if (m_loaded_style_sheet) {
|
||||||
m_loaded_style_sheet->set_owner_node(this);
|
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);
|
document().style_sheets().add_sheet(*m_loaded_style_sheet);
|
||||||
} else {
|
} else {
|
||||||
dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Failed to parse stylesheet: {}", resource()->url());
|
dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Failed to parse stylesheet: {}", resource()->url());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue