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

LibWeb: Add MediaList wrapper

Most of the pieces were already there, I'd just forgotten to actually
wire them up.
This commit is contained in:
Sam Atkins 2022-04-22 14:10:59 +01:00 committed by Andreas Kling
parent b8c0ebccfd
commit bc4c185aef
6 changed files with 27 additions and 6 deletions

View file

@ -29,10 +29,15 @@ void MediaList::set_media_text(String const& text)
m_media = parse_media_query_list({}, text);
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-item
Optional<String> MediaList::item(size_t index) const
bool MediaList::is_supported_property_index(u32 index) const
{
if (index >= length())
return index < length();
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-item
String MediaList::item(u32 index) const
{
if (!is_supported_property_index(index))
return {};
return m_media[index].to_string();