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

LibWeb: Implement the :buffering and :stalled pseudo-classes

Currently, HTMLMediaElement doesn't implement the stall timeout, so
`:stalled` always returns false.
This commit is contained in:
Sam Atkins 2023-08-01 15:26:56 +01:00 committed by Tim Flynn
parent eb7cda1172
commit f6e4caf197
7 changed files with 42 additions and 2 deletions

View file

@ -406,6 +406,18 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
// Once we do, implement this!
return false;
}
case CSS::Selector::SimpleSelector::PseudoClass::Type::Buffering: {
if (!is<HTML::HTMLMediaElement>(element))
return false;
auto const& media_element = static_cast<HTML::HTMLMediaElement const&>(element);
return media_element.blocked();
}
case CSS::Selector::SimpleSelector::PseudoClass::Type::Stalled: {
if (!is<HTML::HTMLMediaElement>(element))
return false;
auto const& media_element = static_cast<HTML::HTMLMediaElement const&>(element);
return media_element.stalled();
}
}
return false;