mirror of
https://github.com/servo/servo.git
synced 2025-10-02 17:49:16 +01:00
script: display top-level SVG image documents. (#39494)
SVG images served with the image/svg+xml mime type were recognized as XML documents instead of images, so were not displayed. Testing: compare the results of `./mach run https://raw.githubusercontent.com/servo/servo/467821598b59bd84273d91c9d8a33651e10578b8/resources/resource_protocol/servo-color-negative-no-container.svg` Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
parent
7a7129edd7
commit
47382e0c2c
8 changed files with 41 additions and 7 deletions
|
@ -1000,7 +1000,8 @@ impl ParserContext {
|
|||
},
|
||||
// Return the result of loading a media document given navigationParams and type.
|
||||
MediaType::Image | MediaType::AudioVideo => {
|
||||
self.load_media_document(parser, media_type, &mime_type)
|
||||
self.load_media_document(parser, media_type, &mime_type);
|
||||
return;
|
||||
},
|
||||
MediaType::Font => {
|
||||
let page = format!(
|
||||
|
|
|
@ -238,10 +238,13 @@ impl MimeClassifier {
|
|||
}
|
||||
|
||||
/// <https://mimesniff.spec.whatwg.org/#xml-mime-type>
|
||||
/// SVG is worth distinguishing from other XML MIME types:
|
||||
/// <https://mimesniff.spec.whatwg.org/#mime-type-miscellaneous>
|
||||
fn is_xml(mt: &Mime) -> bool {
|
||||
mt.suffix() == Some(mime::XML) ||
|
||||
mt.essence_str() == "text/xml" ||
|
||||
mt.essence_str() == "application/xml"
|
||||
!Self::is_image(mt) &&
|
||||
(mt.suffix() == Some(mime::XML) ||
|
||||
mt.essence_str() == "text/xml" ||
|
||||
mt.essence_str() == "application/xml")
|
||||
}
|
||||
|
||||
/// <https://mimesniff.spec.whatwg.org/#html-mime-type>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue