mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 01:08:21 +00:00
Bug 1160200 - APNG can't be used with type switching. r=mcaceres, r=jrmuizel, r=johns
This commit is contained in:
parent
823b42df5f
commit
4b42312a6f
BIN
dom/tests/mochitest/general/fail.png
Normal file
BIN
dom/tests/mochitest/general/fail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 B |
@ -1,6 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
497633.html
|
||||
fail.png
|
||||
file_bug628069.html
|
||||
file_clonewrapper.html
|
||||
file_domWindowUtils_scrollbarSize.html
|
||||
@ -13,6 +14,7 @@ support-files =
|
||||
image_50.png
|
||||
image_100.png
|
||||
image_200.png
|
||||
pass.apng
|
||||
performance_timeline_main_test.html
|
||||
resource_timing_iframe.html
|
||||
resource_timing_main_test.html
|
||||
@ -139,3 +141,4 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || toolkit == 'android' # Mou
|
||||
[test_WebKitCSSMatrix.html]
|
||||
[test_resource_timing_frameset.html]
|
||||
[test_bug1208217.html]
|
||||
[test_picture_apng.html]
|
||||
|
BIN
dom/tests/mochitest/general/pass.apng
Normal file
BIN
dom/tests/mochitest/general/pass.apng
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 B |
77
dom/tests/mochitest/general/test_picture_apng.html
Normal file
77
dom/tests/mochitest/general/test_picture_apng.html
Normal file
@ -0,0 +1,77 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Image srcset mutations</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
window.onload = function() {
|
||||
// Smoke test, check picture working as expected
|
||||
const t0 = document.querySelector("#test0 img");
|
||||
ok(t0.currentSrc.endsWith("apng"), `t0: expected pass.apng, got '${t0.currentSrc}'`);
|
||||
|
||||
// Test that the apng is selected over bogus types.
|
||||
const t1 = document.querySelector("#test1 img");
|
||||
ok(t1.currentSrc.endsWith("apng"), `t1: expected pass.apng, got '${t1.currentSrc}'`);
|
||||
|
||||
// Test that tree order precedence applies
|
||||
const t2 = document.querySelector("#test2 img");
|
||||
ok(t2.currentSrc.endsWith("apng"), `t2: expected pass.apng, got '${t2.currentSrc}'`);
|
||||
|
||||
// Test that apng doesn't alway win
|
||||
const t3 = document.querySelector("#test3 img");
|
||||
ok(t3.currentSrc.endsWith("apng"), `t3: expected pass.apng, got '${t3.currentSrc}'`);
|
||||
|
||||
// Test dynamically constructed picture, where apng is selected over a bogus
|
||||
// source or the img src attribute
|
||||
const pic = document.createElement("picture");
|
||||
pic.id = "test4";
|
||||
const t4 = document.createElement("img");
|
||||
const bogusSource = document.createElement("source");
|
||||
bogusSource.type = "bogus/bogus";
|
||||
bogusSource.srcset = "fail.png";
|
||||
const legitSource = document.createElement("source");
|
||||
legitSource.type = "image/apng";
|
||||
legitSource.srcset = "pass.apng";
|
||||
pic.appendChild(bogusSource);
|
||||
pic.appendChild(legitSource);
|
||||
pic.appendChild(t4);
|
||||
t4.src = "fail.png";
|
||||
document.body.appendChild(pic);
|
||||
t4.onload = ()=>{
|
||||
ok(t4.currentSrc.endsWith("apng"), `t4: Expected pass.apng, got '${t4.currentSrc}'`);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<picture id="test0">
|
||||
<srouce>
|
||||
<img src="pass.apng">
|
||||
</picture>
|
||||
<picture id="test1">
|
||||
<source type="bogus/type" srcset="fail.png">
|
||||
<source type="image/apng" srcset="pass.apng">
|
||||
<source type="image/jpeg" srcset="fail.png">
|
||||
<img src="fail-fallback">
|
||||
</picture>
|
||||
<picture id="test2">
|
||||
<source type="image/png" srcset="pass.apng">
|
||||
<source srcset="fail.png">
|
||||
<source type="bogus/type" srcset="fail.png">
|
||||
<img src="fail-fallback">
|
||||
</picture>
|
||||
<picture id="test3">
|
||||
<source type="image/jpeg" srcset="pass.apng">
|
||||
<source type="image/apng" srcset="fail.png">
|
||||
<img src="fail-fallback">
|
||||
</picture>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -34,6 +34,8 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
|
||||
type = DecoderType::PNG;
|
||||
} else if (!strcmp(aMimeType, IMAGE_X_PNG)) {
|
||||
type = DecoderType::PNG;
|
||||
} else if (!strcmp(aMimeType, IMAGE_APNG)) {
|
||||
type = DecoderType::PNG;
|
||||
|
||||
// GIF
|
||||
} else if (!strcmp(aMimeType, IMAGE_GIF)) {
|
||||
|
@ -80,6 +80,7 @@ static const mozilla::Module::CategoryEntry kImageCategories[] = {
|
||||
{ "Gecko-Content-Viewers", IMAGE_BMP_MS, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_ICON_MS, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_APNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "Gecko-Content-Viewers", IMAGE_X_PNG, "@mozilla.org/content/document-loader-factory;1" },
|
||||
{ "content-sniffing-services", "@mozilla.org/image/loader;1", "@mozilla.org/image/loader;1" },
|
||||
{ nullptr }
|
||||
|
BIN
layout/reftests/apng-mime/animated.apng
Normal file
BIN
layout/reftests/apng-mime/animated.apng
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 B |
3
layout/reftests/apng-mime/expected.html
Normal file
3
layout/reftests/apng-mime/expected.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!doctype html>
|
||||
<title>apng expected</title>
|
||||
<img src="animated.apng">
|
1
layout/reftests/apng-mime/reftest.list
Normal file
1
layout/reftests/apng-mime/reftest.list
Normal file
@ -0,0 +1 @@
|
||||
== test.html expected.html
|
BIN
layout/reftests/apng-mime/static.png
Normal file
BIN
layout/reftests/apng-mime/static.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 B |
6
layout/reftests/apng-mime/test.html
Normal file
6
layout/reftests/apng-mime/test.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!doctype html>
|
||||
<title>apng test</title>
|
||||
<picture>
|
||||
<source type="image/apng" srcset="animated.apng">
|
||||
<img src="static.png">
|
||||
</picture>
|
@ -19,6 +19,9 @@ include w3c-css/received/reftest.list
|
||||
include abs-pos/reftest.list
|
||||
include position-relative/reftest.list
|
||||
|
||||
# apng-mime
|
||||
include apng-mime/reftest.list
|
||||
|
||||
include async-scrolling/reftest.list
|
||||
|
||||
# backgrounds/
|
||||
|
@ -95,6 +95,7 @@
|
||||
#define IMAGE_JPG "image/jpg"
|
||||
#define IMAGE_PJPEG "image/pjpeg"
|
||||
#define IMAGE_PNG "image/png"
|
||||
#define IMAGE_APNG "image/apng"
|
||||
#define IMAGE_X_PNG "image/x-png"
|
||||
#define IMAGE_PPM "image/x-portable-pixmap"
|
||||
#define IMAGE_XBM "image/x-xbitmap"
|
||||
|
@ -582,6 +582,7 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] =
|
||||
{ IMAGE_ICO, "ico,cur", "ICO Image" },
|
||||
{ IMAGE_JPEG, "jpeg,jpg,jfif,pjpeg,pjp", "JPEG Image" },
|
||||
{ IMAGE_PNG, "png", "PNG Image" },
|
||||
{ IMAGE_APNG, "apng", "APNG Image" },
|
||||
{ IMAGE_TIFF, "tiff,tif", "TIFF Image" },
|
||||
{ IMAGE_XBM, "xbm", "XBM Image" },
|
||||
{ IMAGE_SVG_XML, "svg", "Scalable Vector Graphics" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user