зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311246 - Remove support for the -moz-samplesize media fragment; r=jrmuizel
This removes the feature added in bug 854795 for Tarako b2g devices.
This commit is contained in:
Родитель
be505bec4e
Коммит
ba68896bf9
|
@ -439,7 +439,6 @@ private:
|
|||
DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb", ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
|
||||
DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
|
||||
DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor", ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
|
||||
DECL_GFX_PREF(Live, "image.mozsamplesize.enabled", ImageMozSampleSizeEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
|
||||
|
||||
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, bool, false);
|
||||
|
|
|
@ -215,14 +215,6 @@ public:
|
|||
*/
|
||||
Maybe<gfx::IntSize> ExplicitOutputSize() const;
|
||||
|
||||
/**
|
||||
* Set the requested sample size for this decoder. Used to implement the
|
||||
* -moz-sample-size media fragment.
|
||||
*
|
||||
* XXX(seth): Support for -moz-sample-size will be removed in bug 1120056.
|
||||
*/
|
||||
virtual void SetSampleSize(int aSampleSize) { }
|
||||
|
||||
/**
|
||||
* Set an iterator to the SourceBuffer which will feed data to this decoder.
|
||||
* This must always be called before calling Init(). (And only before Init().)
|
||||
|
|
|
@ -114,8 +114,7 @@ DecoderFactory::CreateDecoder(DecoderType aType,
|
|||
const IntSize& aIntrinsicSize,
|
||||
const IntSize& aOutputSize,
|
||||
DecoderFlags aDecoderFlags,
|
||||
SurfaceFlags aSurfaceFlags,
|
||||
int aSampleSize)
|
||||
SurfaceFlags aSurfaceFlags)
|
||||
{
|
||||
if (aType == DecoderType::UNKNOWN) {
|
||||
return nullptr;
|
||||
|
@ -133,7 +132,6 @@ DecoderFactory::CreateDecoder(DecoderType aType,
|
|||
decoder->SetOutputSize(aOutputSize);
|
||||
decoder->SetDecoderFlags(aDecoderFlags | DecoderFlags::FIRST_FRAME_ONLY);
|
||||
decoder->SetSurfaceFlags(aSurfaceFlags);
|
||||
decoder->SetSampleSize(aSampleSize);
|
||||
|
||||
if (NS_FAILED(decoder->Init())) {
|
||||
return nullptr;
|
||||
|
@ -212,8 +210,7 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
|
|||
/* static */ already_AddRefed<IDecodingTask>
|
||||
DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
||||
NotNull<RasterImage*> aImage,
|
||||
NotNull<SourceBuffer*> aSourceBuffer,
|
||||
int aSampleSize)
|
||||
NotNull<SourceBuffer*> aSourceBuffer)
|
||||
{
|
||||
if (aType == DecoderType::UNKNOWN) {
|
||||
return nullptr;
|
||||
|
@ -226,7 +223,6 @@ DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
|||
// Initialize the decoder.
|
||||
decoder->SetMetadataDecode(true);
|
||||
decoder->SetIterator(aSourceBuffer->Iterator());
|
||||
decoder->SetSampleSize(aSampleSize);
|
||||
|
||||
if (NS_FAILED(decoder->Init())) {
|
||||
return nullptr;
|
||||
|
|
|
@ -63,8 +63,6 @@ public:
|
|||
* @param aDecoderFlags Flags specifying the behavior of this decoder.
|
||||
* @param aSurfaceFlags Flags specifying the type of output this decoder
|
||||
* should produce.
|
||||
* @param aSampleSize The sample size requested using #-moz-samplesize (or 0
|
||||
* if none).
|
||||
*/
|
||||
static already_AddRefed<IDecodingTask>
|
||||
CreateDecoder(DecoderType aType,
|
||||
|
@ -73,8 +71,7 @@ public:
|
|||
const gfx::IntSize& aIntrinsicSize,
|
||||
const gfx::IntSize& aOutputSize,
|
||||
DecoderFlags aDecoderFlags,
|
||||
SurfaceFlags aSurfaceFlags,
|
||||
int aSampleSize);
|
||||
SurfaceFlags aSurfaceFlags);
|
||||
|
||||
/**
|
||||
* Creates and initializes a decoder for animated images of type @aType.
|
||||
|
@ -110,14 +107,11 @@ public:
|
|||
* notifications as decoding progresses.
|
||||
* @param aSourceBuffer The SourceBuffer which the decoder will read its data
|
||||
* from.
|
||||
* @param aSampleSize The sample size requested using #-moz-samplesize (or 0
|
||||
* if none).
|
||||
*/
|
||||
static already_AddRefed<IDecodingTask>
|
||||
CreateMetadataDecoder(DecoderType aType,
|
||||
NotNull<RasterImage*> aImage,
|
||||
NotNull<SourceBuffer*> aSourceBuffer,
|
||||
int aSampleSize);
|
||||
NotNull<SourceBuffer*> aSourceBuffer);
|
||||
|
||||
/**
|
||||
* Creates and initializes a decoder for an ICO resource, which may be either
|
||||
|
|
|
@ -144,7 +144,7 @@ ImageCacheKey::ComputeHash(ImageURL* aURI,
|
|||
if (aBlobSerial) {
|
||||
// For blob URIs, we hash the serial number of the underlying blob, so that
|
||||
// different blob URIs which point to the same blob share a cache entry. We
|
||||
// also include the ref portion of the URI to support -moz-samplesize, which
|
||||
// also include the ref portion of the URI to support media fragments which
|
||||
// requires us to create different Image objects even if the source data is
|
||||
// the same.
|
||||
nsAutoCString ref;
|
||||
|
|
|
@ -205,25 +205,6 @@ ImageFactory::CreateRasterImage(nsIRequest* aRequest,
|
|||
aProgressTracker->SetImage(newImage);
|
||||
newImage->SetProgressTracker(aProgressTracker);
|
||||
|
||||
nsAutoCString ref;
|
||||
aURI->GetRef(ref);
|
||||
net::nsMediaFragmentURIParser parser(ref);
|
||||
if (parser.HasSampleSize()) {
|
||||
/* Get our principal */
|
||||
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (chan) {
|
||||
nsContentUtils::GetSecurityManager()
|
||||
->GetChannelResultPrincipal(chan, getter_AddRefs(principal));
|
||||
}
|
||||
|
||||
if ((principal &&
|
||||
principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED) ||
|
||||
gfxPrefs::ImageMozSampleSizeEnabled()) {
|
||||
newImage->SetRequestedSampleSize(parser.GetSampleSize());
|
||||
}
|
||||
}
|
||||
|
||||
rv = newImage->Init(aMimeType.get(), aImageFlags);
|
||||
if (NS_FAILED(rv)) {
|
||||
return BadImage("RasterImage::Init failed", newImage);
|
||||
|
|
|
@ -73,7 +73,6 @@ RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
|
|||
mSize(0,0),
|
||||
mLockCount(0),
|
||||
mDecodeCount(0),
|
||||
mRequestedSampleSize(0),
|
||||
mImageProducerID(ImageContainer::AllocateProducerID()),
|
||||
mLastFrameID(0),
|
||||
mLastImageContainerDrawResult(DrawResult::NOT_READY),
|
||||
|
@ -1164,8 +1163,7 @@ RasterImage::Decode(const IntSize& aSize,
|
|||
} else {
|
||||
task = DecoderFactory::CreateDecoder(mDecoderType, WrapNotNull(this),
|
||||
mSourceBuffer, mSize, aSize,
|
||||
decoderFlags, surfaceFlags,
|
||||
mRequestedSampleSize);
|
||||
decoderFlags, surfaceFlags);
|
||||
}
|
||||
|
||||
// Make sure DecoderFactory was able to create a decoder successfully.
|
||||
|
@ -1192,7 +1190,7 @@ RasterImage::DecodeMetadata(uint32_t aFlags)
|
|||
// Create a decoder.
|
||||
RefPtr<IDecodingTask> task =
|
||||
DecoderFactory::CreateMetadataDecoder(mDecoderType, WrapNotNull(this),
|
||||
mSourceBuffer, mRequestedSampleSize);
|
||||
mSourceBuffer);
|
||||
|
||||
// Make sure DecoderFactory was able to create a decoder successfully.
|
||||
if (!task) {
|
||||
|
|
|
@ -264,11 +264,6 @@ public:
|
|||
*/
|
||||
nsresult SetSourceSizeHint(uint32_t aSizeHint);
|
||||
|
||||
/* Provide a hint for the requested dimension of the resulting image. */
|
||||
void SetRequestedSampleSize(int requestedSampleSize) {
|
||||
mRequestedSampleSize = requestedSampleSize;
|
||||
}
|
||||
|
||||
nsCString GetURIString() {
|
||||
nsCString spec;
|
||||
if (GetURI()) {
|
||||
|
@ -406,9 +401,6 @@ private: // data
|
|||
// This is currently only used for statistics
|
||||
int32_t mDecodeCount;
|
||||
|
||||
// A hint for image decoder that directly scale the image to smaller buffer
|
||||
int mRequestedSampleSize;
|
||||
|
||||
// A weak pointer to our ImageContainer, which stays alive only as long as
|
||||
// the layer system needs it.
|
||||
WeakPtr<layers::ImageContainer> mImageContainer;
|
||||
|
|
|
@ -77,7 +77,6 @@ nsJPEGDecoder::nsJPEGDecoder(RasterImage* aImage,
|
|||
SIZE_MAX),
|
||||
Transition::TerminateSuccess())
|
||||
, mDecodeStyle(aDecodeStyle)
|
||||
, mSampleSize(0)
|
||||
{
|
||||
mState = JPEG_HEADER;
|
||||
mReading = true;
|
||||
|
@ -242,17 +241,8 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
|||
return Transition::ContinueUnbuffered(State::JPEG_DATA); // I/O suspension
|
||||
}
|
||||
|
||||
// If we have a sample size specified for -moz-sample-size, use it.
|
||||
if (mSampleSize > 0) {
|
||||
mInfo.scale_num = 1;
|
||||
mInfo.scale_denom = mSampleSize;
|
||||
}
|
||||
|
||||
// Used to set up image size so arrays can be allocated
|
||||
jpeg_calc_output_dimensions(&mInfo);
|
||||
|
||||
// Post our size to the superclass
|
||||
PostSize(mInfo.output_width, mInfo.output_height,
|
||||
PostSize(mInfo.image_width, mInfo.image_height,
|
||||
ReadOrientationFromEXIF());
|
||||
if (HasError()) {
|
||||
// Setting the size led to an error.
|
||||
|
@ -387,6 +377,9 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
|||
mInfo.buffered_image = mDecodeStyle == PROGRESSIVE &&
|
||||
jpeg_has_multiple_scans(&mInfo);
|
||||
|
||||
/* Used to set up image size so arrays can be allocated */
|
||||
jpeg_calc_output_dimensions(&mInfo);
|
||||
|
||||
MOZ_ASSERT(!mImageData, "Already have a buffer allocated?");
|
||||
nsresult rv = AllocateFrame(/* aFrameNum = */ 0, OutputSize(),
|
||||
FullOutputFrame(), SurfaceFormat::B8G8R8X8);
|
||||
|
@ -412,7 +405,7 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
|||
MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
|
||||
(" JPEGDecoderAccounting: nsJPEGDecoder::"
|
||||
"Write -- created image frame with %ux%u pixels",
|
||||
mInfo.output_width, mInfo.output_height));
|
||||
mInfo.image_width, mInfo.image_height));
|
||||
|
||||
mState = JPEG_START_DECOMPRESS;
|
||||
MOZ_FALLTHROUGH; // to start decompressing.
|
||||
|
|
|
@ -52,11 +52,6 @@ class nsJPEGDecoder : public Decoder
|
|||
public:
|
||||
virtual ~nsJPEGDecoder();
|
||||
|
||||
virtual void SetSampleSize(int aSampleSize) override
|
||||
{
|
||||
mSampleSize = aSampleSize;
|
||||
}
|
||||
|
||||
void NotifyDone();
|
||||
|
||||
protected:
|
||||
|
@ -115,8 +110,6 @@ public:
|
|||
const Decoder::DecodeStyle mDecodeStyle;
|
||||
|
||||
uint32_t mCMSMode;
|
||||
|
||||
int mSampleSize;
|
||||
};
|
||||
|
||||
} // namespace image
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html class="reftest-wait">
|
||||
|
||||
<body>
|
||||
<img id="test">
|
||||
</body>
|
||||
|
||||
<script>
|
||||
var image = new Image;
|
||||
|
||||
image.onload = function() {
|
||||
// Create a canvas.
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = 100;
|
||||
canvas.height = 100;
|
||||
|
||||
// Draw the image into the canvas.
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
// Convert the image into a blob URI and use it as #test's src.
|
||||
canvas.toBlob(function(blob) {
|
||||
var uri = window.URL.createObjectURL(blob);
|
||||
uri += '#-moz-samplesize=8';
|
||||
var testImage = document.getElementById('test');
|
||||
|
||||
testImage.onload = testImage.onerror = function() {
|
||||
// Take the snapshot.
|
||||
document.documentElement.removeAttribute('class');
|
||||
};
|
||||
|
||||
testImage.src = uri;
|
||||
}, 'image/jpeg', 0.99);
|
||||
}
|
||||
|
||||
// Start loading the image.
|
||||
image.src = 'image.png';
|
||||
</script>
|
||||
|
||||
</html>
|
|
@ -1,40 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html class="reftest-wait">
|
||||
|
||||
<body>
|
||||
<img id="test">
|
||||
</body>
|
||||
|
||||
<script>
|
||||
var image = new Image;
|
||||
|
||||
image.onload = function() {
|
||||
// Create a canvas.
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = 100;
|
||||
canvas.height = 100;
|
||||
|
||||
// Draw the image into the canvas.
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(image, 0, 0);
|
||||
|
||||
// Convert the image into a blob URI and use it as #test's src.
|
||||
canvas.toBlob(function(blob) {
|
||||
var uri = window.URL.createObjectURL(blob);
|
||||
var testImage = document.getElementById('test');
|
||||
|
||||
testImage.onload = testImage.onerror = function() {
|
||||
// Take the snapshot.
|
||||
document.documentElement.removeAttribute('class');
|
||||
};
|
||||
|
||||
testImage.src = uri;
|
||||
}, 'image/jpeg', 0.99);
|
||||
}
|
||||
|
||||
// Start loading the image.
|
||||
image.src = 'image.png';
|
||||
</script>
|
||||
|
||||
</html>
|
Двоичные данные
image/test/reftest/blob/image.png
Двоичные данные
image/test/reftest/blob/image.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 840 B |
|
@ -1,8 +0,0 @@
|
|||
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
|
||||
# Blob URI tests
|
||||
|
||||
# Test that blob URIs don't get merged if they have different ref params.
|
||||
# (We run the test twice to check both cached and non-cached cases.)
|
||||
default-preferences pref(image.mozsamplesize.enabled,true)
|
||||
== blob-uri-with-ref-param.html blob-uri-with-ref-param.html
|
||||
== blob-uri-with-ref-param.html blob-uri-with-ref-param.html
|
|
@ -1,7 +0,0 @@
|
|||
# Blob URI tests
|
||||
|
||||
# Test that blob URIs don't get merged if they have different ref params.
|
||||
# (We run the test twice to check both cached and non-cached cases.)
|
||||
default-preferences pref(image.mozsamplesize.enabled,true)
|
||||
!= blob-uri-with-ref-param.html blob-uri-with-ref-param-notref.html
|
||||
!= blob-uri-with-ref-param.html blob-uri-with-ref-param-notref.html
|
|
@ -53,5 +53,3 @@ fails random-if(Android) == jpg-srgb-icc.jpg jpg-srgb-icc.jpg
|
|||
# "Here is the beginning of a boundary," and --$(boundary)-- means "All done
|
||||
# sending you parts.")
|
||||
skip HTTP == webcam-simulacrum.mjpg webcam-simulacrum.mjpg
|
||||
skip pref(image.mozsamplesize.enabled,true) == jpg-size-32x32.jpg#-moz-samplesize=2 jpg-size-32x32.jpg#-moz-samplesize=2
|
||||
skip pref(image.mozsamplesize.enabled,true) == jpg-size-32x32.jpg#-moz-samplesize=8 jpg-size-32x32.jpg#-moz-samplesize=8
|
||||
|
|
|
@ -52,5 +52,3 @@ random-if(Android) == jpg-srgb-icc.jpg jpg-srgb-icc.png
|
|||
# "Here is the beginning of a boundary," and --$(boundary)-- means "All done
|
||||
# sending you parts.")
|
||||
HTTP == webcam-simulacrum.mjpg blue.jpg
|
||||
pref(image.mozsamplesize.enabled,true) fuzzy(21,256) == jpg-size-32x32.jpg#-moz-samplesize=2 jpg-size-16x16.png
|
||||
pref(image.mozsamplesize.enabled,true) fuzzy(92,16) == jpg-size-32x32.jpg#-moz-samplesize=8 jpg-size-4x4.png
|
||||
|
|
|
@ -57,9 +57,6 @@ include color-management/reftest-stylo.list
|
|||
# Downscaling tests
|
||||
# include downscaling/reftest-stylo.list
|
||||
|
||||
# Blob URI tests
|
||||
include blob/reftest-stylo.list
|
||||
|
||||
# Lossless encoders
|
||||
# skip-if(Android||B2G) include encoders-lossless/reftest-stylo.list
|
||||
# bug 783621
|
||||
|
|
|
@ -43,8 +43,5 @@ include color-management/reftest.list
|
|||
# Downscaling tests
|
||||
include downscaling/reftest.list
|
||||
|
||||
# Blob URI tests
|
||||
include blob/reftest.list
|
||||
|
||||
# Lossless encoders
|
||||
skip-if(Android) include encoders-lossless/reftest.list
|
||||
|
|
|
@ -5214,9 +5214,6 @@ pref("dom.wakelock.enabled", false);
|
|||
// The URL of the Firefox Accounts auth server backend
|
||||
pref("identity.fxaccounts.auth.uri", "https://api.accounts.firefox.com/v1");
|
||||
|
||||
// disable mozsample size for now
|
||||
pref("image.mozsamplesize.enabled", false);
|
||||
|
||||
pref("beacon.enabled", true);
|
||||
|
||||
// Camera prefs
|
||||
|
|
|
@ -335,19 +335,6 @@ bool nsMediaFragmentURIParser::ParseXYWH(nsDependentSubstring aString)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool nsMediaFragmentURIParser::ParseMozSampleSize(nsDependentSubstring aString)
|
||||
{
|
||||
int32_t sampleSize;
|
||||
|
||||
// Read and validate coordinates.
|
||||
if (ParseInteger(aString, sampleSize) && sampleSize > 0) {
|
||||
mSampleSize.emplace(sampleSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
||||
{
|
||||
// Create an array of possibly-invalid media fragments.
|
||||
|
@ -368,9 +355,9 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
|||
}
|
||||
|
||||
// Parse the media fragment values.
|
||||
bool gotTemporal = false, gotSpatial = false, gotSampleSize = false;
|
||||
bool gotTemporal = false, gotSpatial = false;
|
||||
for (int i = fragments.Length() - 1 ; i >= 0 ; --i) {
|
||||
if (gotTemporal && gotSpatial && gotSampleSize) {
|
||||
if (gotTemporal && gotSpatial) {
|
||||
// We've got one of each possible type. No need to look at the rest.
|
||||
break;
|
||||
} else if (!gotTemporal && fragments[i].first.EqualsLiteral("t")) {
|
||||
|
@ -379,9 +366,6 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
|||
} else if (!gotSpatial && fragments[i].first.EqualsLiteral("xywh")) {
|
||||
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
|
||||
gotSpatial = ParseXYWH(nsDependentSubstring(value, 0));
|
||||
} else if (!gotSampleSize && fragments[i].first.EqualsLiteral("-moz-samplesize")) {
|
||||
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
|
||||
gotSampleSize = ParseMozSampleSize(nsDependentSubstring(value, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,10 +64,6 @@ public:
|
|||
// returns the unit used.
|
||||
ClipUnit GetClipUnit() const { return mClipUnit; }
|
||||
|
||||
bool HasSampleSize() const { return mSampleSize.isSome(); }
|
||||
|
||||
int GetSampleSize() const { return *mSampleSize; }
|
||||
|
||||
private:
|
||||
// Parse the URI ref provided, looking for media fragments. This is
|
||||
// the top-level parser the invokes the others below.
|
||||
|
@ -90,14 +86,12 @@ private:
|
|||
bool ParseNPTSS(nsDependentSubstring& aString, uint32_t& aSecond);
|
||||
bool ParseXYWH(nsDependentSubstring aString);
|
||||
bool ParseMozResolution(nsDependentSubstring aString);
|
||||
bool ParseMozSampleSize(nsDependentSubstring aString);
|
||||
|
||||
// Media fragment information.
|
||||
Maybe<double> mStart;
|
||||
Maybe<double> mEnd;
|
||||
Maybe<nsIntRect> mClip;
|
||||
ClipUnit mClipUnit;
|
||||
Maybe<int> mSampleSize;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
Загрузка…
Ссылка в новой задаче