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

LibWeb/MimeSniff: Add MimeType::is_audio_or_video()

This commit is contained in:
Kemal Zebari 2023-09-19 23:46:31 -07:00 committed by Sam Atkins
parent d2c88faf00
commit 3a0fa0e471
2 changed files with 8 additions and 0 deletions

View file

@ -245,6 +245,13 @@ bool MimeType::is_image() const
return type() == "image"sv; return type() == "image"sv;
} }
// https://mimesniff.spec.whatwg.org/#audio-or-video-mime-type
bool MimeType::is_audio_or_video() const
{
// An audio or video MIME type is any MIME type whose type is "audio" or "video", or whose essence is "application/ogg".
return type().is_one_of("audio"sv, "video"sv) || essence() == "application/ogg"sv;
}
// https://mimesniff.spec.whatwg.org/#xml-mime-type // https://mimesniff.spec.whatwg.org/#xml-mime-type
bool MimeType::is_xml() const bool MimeType::is_xml() const
{ {

View file

@ -27,6 +27,7 @@ public:
OrderedHashMap<String, String> const& parameters() const { return m_parameters; } OrderedHashMap<String, String> const& parameters() const { return m_parameters; }
bool is_image() const; bool is_image() const;
bool is_audio_or_video() const;
bool is_xml() const; bool is_xml() const;
bool is_html() const; bool is_html() const;
bool is_javascript() const; bool is_javascript() const;