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

LibWeb/MimeSniff: Add MimeType::is_image()

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

View file

@ -238,6 +238,13 @@ ErrorOr<void> MimeType::set_parameter(String name, String value)
return {}; return {};
} }
// https://mimesniff.spec.whatwg.org/#image-mime-type
bool MimeType::is_image() const
{
// An image MIME type is a MIME type whose type is "image".
return type() == "image"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

@ -26,6 +26,7 @@ public:
String const& subtype() const { return m_subtype; } String const& subtype() const { return m_subtype; }
OrderedHashMap<String, String> const& parameters() const { return m_parameters; } OrderedHashMap<String, String> const& parameters() const { return m_parameters; }
bool is_image() 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;