LibWeb/MimeSniff: Add MimeType::is_audio_or_video()
This commit is contained in:
parent
d2c88faf00
commit
3a0fa0e471
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/kemzeb Commit: https://github.com/SerenityOS/serenity/commit/3a0fa0e471 Pull-request: https://github.com/SerenityOS/serenity/pull/21165 Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 8 additions and 0 deletions
|
@ -245,6 +245,13 @@ bool MimeType::is_image() const
|
|||
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
|
||||
bool MimeType::is_xml() const
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
OrderedHashMap<String, String> const& parameters() const { return m_parameters; }
|
||||
|
||||
bool is_image() const;
|
||||
bool is_audio_or_video() const;
|
||||
bool is_xml() const;
|
||||
bool is_html() const;
|
||||
bool is_javascript() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue