mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibWeb: Port MediaList interface from DeprecatedString to String
This commit is contained in:
parent
72f54eca26
commit
ff45874d4e
4 changed files with 14 additions and 14 deletions
|
@ -37,7 +37,7 @@ void CSSMediaRule::visit_edges(Cell::Visitor& visitor)
|
|||
|
||||
DeprecatedString CSSMediaRule::condition_text() const
|
||||
{
|
||||
return m_media->media_text();
|
||||
return m_media->media_text().to_deprecated_string();
|
||||
}
|
||||
|
||||
void CSSMediaRule::set_condition_text(DeprecatedString text)
|
||||
|
|
|
@ -31,13 +31,13 @@ void MediaList::initialize(JS::Realm& realm)
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
|
||||
DeprecatedString MediaList::media_text() const
|
||||
String MediaList::media_text() const
|
||||
{
|
||||
return serialize_a_media_query_list(m_media).to_deprecated_string();
|
||||
return serialize_a_media_query_list(m_media);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
|
||||
void MediaList::set_media_text(DeprecatedString const& text)
|
||||
void MediaList::set_media_text(StringView text)
|
||||
{
|
||||
m_media.clear();
|
||||
if (text.is_empty())
|
||||
|
@ -51,16 +51,16 @@ bool MediaList::is_supported_property_index(u32 index) const
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-item
|
||||
DeprecatedString MediaList::item(u32 index) const
|
||||
Optional<String> MediaList::item(u32 index) const
|
||||
{
|
||||
if (!is_supported_property_index(index))
|
||||
return {};
|
||||
|
||||
return m_media[index]->to_string().to_deprecated_string();
|
||||
return m_media[index]->to_string();
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-appendmedium
|
||||
void MediaList::append_medium(DeprecatedString medium)
|
||||
void MediaList::append_medium(StringView medium)
|
||||
{
|
||||
// 1. Let m be the result of parsing the given value.
|
||||
auto m = parse_media_query(Parser::ParsingContext { realm() }, medium);
|
||||
|
@ -81,7 +81,7 @@ void MediaList::append_medium(DeprecatedString medium)
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-deletemedium
|
||||
void MediaList::delete_medium(DeprecatedString medium)
|
||||
void MediaList::delete_medium(StringView medium)
|
||||
{
|
||||
auto m = parse_media_query(Parser::ParsingContext { realm() }, medium);
|
||||
if (!m)
|
||||
|
|
|
@ -23,12 +23,12 @@ public:
|
|||
[[nodiscard]] static JS::NonnullGCPtr<MediaList> create(JS::Realm&, Vector<NonnullRefPtr<MediaQuery>>&&);
|
||||
~MediaList() = default;
|
||||
|
||||
DeprecatedString media_text() const;
|
||||
void set_media_text(DeprecatedString const&);
|
||||
String media_text() const;
|
||||
void set_media_text(StringView);
|
||||
size_t length() const { return m_media.size(); }
|
||||
DeprecatedString item(u32 index) const;
|
||||
void append_medium(DeprecatedString);
|
||||
void delete_medium(DeprecatedString);
|
||||
Optional<String> item(u32 index) const;
|
||||
void append_medium(StringView);
|
||||
void delete_medium(StringView);
|
||||
|
||||
virtual bool is_supported_property_index(u32 index) const override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Exposed=Window]
|
||||
[Exposed=Window, UseNewAKString]
|
||||
interface MediaList {
|
||||
[LegacyNullToEmptyString] stringifier attribute CSSOMString mediaText;
|
||||
readonly attribute unsigned long length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue