mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +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>
|
||||
|
|
21
tests/wpt/meta/MANIFEST.json
vendored
21
tests/wpt/meta/MANIFEST.json
vendored
|
@ -380751,6 +380751,21 @@
|
|||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"top-level-document": {
|
||||
"svg-image-document-svg-xml-mime-type.tentative.html": [
|
||||
"d5e09d234a4e6de481a43a05f2d8ce0b40af2f5f",
|
||||
[
|
||||
null,
|
||||
[
|
||||
[
|
||||
"/svg/top-level-document/svg-image-document-svg-xml-mime-type-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"visual-viewport": {
|
||||
|
@ -517989,6 +518004,12 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"top-level-document": {
|
||||
"svg-image-document-svg-xml-mime-type-ref.html": [
|
||||
"ce7462f10d87730479d5488fd9a98a453a342177",
|
||||
[]
|
||||
]
|
||||
},
|
||||
"types": {
|
||||
"helper-SVGElement.ownerSVGElement-02.svg": [
|
||||
"2335bb42c5142ca96a63a4ec457d67ea439638ab",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[Document-createElement-svg.svg]
|
||||
expected: ERROR
|
||||
expected: TIMEOUT
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[parser-uses-create-an-element-for-a-token-svg.svg]
|
||||
expected: ERROR
|
||||
expected: TIMEOUT
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[user-interaction-editing-designMode-svg.svg]
|
||||
expected: ERROR
|
||||
expected: TIMEOUT
|
||||
|
|
3
tests/wpt/tests/svg/top-level-document/svg-image-document-svg-xml-mime-type-ref.html
vendored
Normal file
3
tests/wpt/tests/svg/top-level-document/svg-image-document-svg-xml-mime-type-ref.html
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<iframe src="../shapes/circle-01.svg?pipe=header(Content-Type,image/svg)">
|
6
tests/wpt/tests/svg/top-level-document/svg-image-document-svg-xml-mime-type.tentative.html
vendored
Normal file
6
tests/wpt/tests/svg/top-level-document/svg-image-document-svg-xml-mime-type.tentative.html
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Display image/svg+xml top level documents</title>
|
||||
<link rel='match' href='svg-image-document-svg-xml-mime-type-ref.html'>
|
||||
<link rel="author" title="webbeef" href="mailto:me@webbeef.org">
|
||||
<iframe src="../shapes/circle-01.svg?pipe=header(Content-Type,image/svg+xml)">
|
Loading…
Add table
Add a link
Reference in a new issue