mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
Issue #2657 - Remove -moz-samplesize resize-decoding for low-vram mobiles
Resolves #2657
This commit is contained in:
parent
75d698133f
commit
ef5f052d97
18 changed files with 13 additions and 193 deletions
|
|
@ -446,7 +446,6 @@ private:
|
||||||
DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb", ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
|
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.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
|
||||||
DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor", ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
|
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, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
|
||||||
DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, true);
|
DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, true);
|
||||||
#ifdef MOZ_JXL
|
#ifdef MOZ_JXL
|
||||||
|
|
|
||||||
|
|
@ -179,14 +179,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Maybe<gfx::IntSize> ExplicitOutputSize() const;
|
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.
|
* 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().)
|
* This must always be called before calling Init(). (And only before Init().)
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,7 @@ DecoderFactory::CreateDecoder(DecoderType aType,
|
||||||
const IntSize& aIntrinsicSize,
|
const IntSize& aIntrinsicSize,
|
||||||
const IntSize& aOutputSize,
|
const IntSize& aOutputSize,
|
||||||
DecoderFlags aDecoderFlags,
|
DecoderFlags aDecoderFlags,
|
||||||
SurfaceFlags aSurfaceFlags,
|
SurfaceFlags aSurfaceFlags)
|
||||||
int aSampleSize)
|
|
||||||
{
|
{
|
||||||
if (aType == DecoderType::UNKNOWN) {
|
if (aType == DecoderType::UNKNOWN) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -163,7 +162,6 @@ DecoderFactory::CreateDecoder(DecoderType aType,
|
||||||
decoder->SetOutputSize(aOutputSize);
|
decoder->SetOutputSize(aOutputSize);
|
||||||
decoder->SetDecoderFlags(aDecoderFlags | DecoderFlags::FIRST_FRAME_ONLY);
|
decoder->SetDecoderFlags(aDecoderFlags | DecoderFlags::FIRST_FRAME_ONLY);
|
||||||
decoder->SetSurfaceFlags(aSurfaceFlags);
|
decoder->SetSurfaceFlags(aSurfaceFlags);
|
||||||
decoder->SetSampleSize(aSampleSize);
|
|
||||||
|
|
||||||
if (NS_FAILED(decoder->Init())) {
|
if (NS_FAILED(decoder->Init())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -275,8 +273,7 @@ DecoderFactory::CloneAnimationDecoder(Decoder* aDecoder)
|
||||||
/* static */ already_AddRefed<IDecodingTask>
|
/* static */ already_AddRefed<IDecodingTask>
|
||||||
DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
||||||
NotNull<RasterImage*> aImage,
|
NotNull<RasterImage*> aImage,
|
||||||
NotNull<SourceBuffer*> aSourceBuffer,
|
NotNull<SourceBuffer*> aSourceBuffer)
|
||||||
int aSampleSize)
|
|
||||||
{
|
{
|
||||||
if (aType == DecoderType::UNKNOWN) {
|
if (aType == DecoderType::UNKNOWN) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -289,7 +286,6 @@ DecoderFactory::CreateMetadataDecoder(DecoderType aType,
|
||||||
// Initialize the decoder.
|
// Initialize the decoder.
|
||||||
decoder->SetMetadataDecode(true);
|
decoder->SetMetadataDecode(true);
|
||||||
decoder->SetIterator(aSourceBuffer->Iterator());
|
decoder->SetIterator(aSourceBuffer->Iterator());
|
||||||
decoder->SetSampleSize(aSampleSize);
|
|
||||||
|
|
||||||
if (NS_FAILED(decoder->Init())) {
|
if (NS_FAILED(decoder->Init())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,6 @@ public:
|
||||||
* @param aDecoderFlags Flags specifying the behavior of this decoder.
|
* @param aDecoderFlags Flags specifying the behavior of this decoder.
|
||||||
* @param aSurfaceFlags Flags specifying the type of output this decoder
|
* @param aSurfaceFlags Flags specifying the type of output this decoder
|
||||||
* should produce.
|
* should produce.
|
||||||
* @param aSampleSize The sample size requested using #-moz-samplesize (or 0
|
|
||||||
* if none).
|
|
||||||
*/
|
*/
|
||||||
static already_AddRefed<IDecodingTask>
|
static already_AddRefed<IDecodingTask>
|
||||||
CreateDecoder(DecoderType aType,
|
CreateDecoder(DecoderType aType,
|
||||||
|
|
@ -76,8 +74,7 @@ public:
|
||||||
const gfx::IntSize& aIntrinsicSize,
|
const gfx::IntSize& aIntrinsicSize,
|
||||||
const gfx::IntSize& aOutputSize,
|
const gfx::IntSize& aOutputSize,
|
||||||
DecoderFlags aDecoderFlags,
|
DecoderFlags aDecoderFlags,
|
||||||
SurfaceFlags aSurfaceFlags,
|
SurfaceFlags aSurfaceFlags);
|
||||||
int aSampleSize);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and initializes a decoder for animated images of type @aType.
|
* Creates and initializes a decoder for animated images of type @aType.
|
||||||
|
|
@ -124,14 +121,11 @@ public:
|
||||||
* notifications as decoding progresses.
|
* notifications as decoding progresses.
|
||||||
* @param aSourceBuffer The SourceBuffer which the decoder will read its data
|
* @param aSourceBuffer The SourceBuffer which the decoder will read its data
|
||||||
* from.
|
* from.
|
||||||
* @param aSampleSize The sample size requested using #-moz-samplesize (or 0
|
|
||||||
* if none).
|
|
||||||
*/
|
*/
|
||||||
static already_AddRefed<IDecodingTask>
|
static already_AddRefed<IDecodingTask>
|
||||||
CreateMetadataDecoder(DecoderType aType,
|
CreateMetadataDecoder(DecoderType aType,
|
||||||
NotNull<RasterImage*> aImage,
|
NotNull<RasterImage*> aImage,
|
||||||
NotNull<SourceBuffer*> aSourceBuffer,
|
NotNull<SourceBuffer*> aSourceBuffer);
|
||||||
int aSampleSize);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and initializes a decoder for an ICO resource, which may be either
|
* Creates and initializes a decoder for an ICO resource, which may be either
|
||||||
|
|
|
||||||
|
|
@ -230,25 +230,6 @@ ImageFactory::CreateRasterImage(nsIRequest* aRequest,
|
||||||
aProgressTracker->SetImage(newImage);
|
aProgressTracker->SetImage(newImage);
|
||||||
newImage->SetProgressTracker(aProgressTracker);
|
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);
|
rv = newImage->Init(aMimeType.get(), aImageFlags);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return BadImage("RasterImage::Init failed", newImage);
|
return BadImage("RasterImage::Init failed", newImage);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
|
||||||
mSize(0,0),
|
mSize(0,0),
|
||||||
mLockCount(0),
|
mLockCount(0),
|
||||||
mDecodeCount(0),
|
mDecodeCount(0),
|
||||||
mRequestedSampleSize(0),
|
|
||||||
mImageProducerID(ImageContainer::AllocateProducerID()),
|
mImageProducerID(ImageContainer::AllocateProducerID()),
|
||||||
mLastFrameID(0),
|
mLastFrameID(0),
|
||||||
mLastImageContainerDrawResult(DrawResult::NOT_READY),
|
mLastImageContainerDrawResult(DrawResult::NOT_READY),
|
||||||
|
|
@ -1200,8 +1199,7 @@ RasterImage::Decode(const IntSize& aSize,
|
||||||
} else {
|
} else {
|
||||||
task = DecoderFactory::CreateDecoder(mDecoderType, WrapNotNull(this),
|
task = DecoderFactory::CreateDecoder(mDecoderType, WrapNotNull(this),
|
||||||
mSourceBuffer, mSize, aSize,
|
mSourceBuffer, mSize, aSize,
|
||||||
decoderFlags, surfaceFlags,
|
decoderFlags, surfaceFlags);
|
||||||
mRequestedSampleSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure DecoderFactory was able to create a decoder successfully.
|
// Make sure DecoderFactory was able to create a decoder successfully.
|
||||||
|
|
@ -1228,7 +1226,7 @@ RasterImage::DecodeMetadata(uint32_t aFlags)
|
||||||
// Create a decoder.
|
// Create a decoder.
|
||||||
RefPtr<IDecodingTask> task =
|
RefPtr<IDecodingTask> task =
|
||||||
DecoderFactory::CreateMetadataDecoder(mDecoderType, WrapNotNull(this),
|
DecoderFactory::CreateMetadataDecoder(mDecoderType, WrapNotNull(this),
|
||||||
mSourceBuffer, mRequestedSampleSize);
|
mSourceBuffer);
|
||||||
|
|
||||||
// Make sure DecoderFactory was able to create a decoder successfully.
|
// Make sure DecoderFactory was able to create a decoder successfully.
|
||||||
if (!task) {
|
if (!task) {
|
||||||
|
|
|
||||||
|
|
@ -261,11 +261,6 @@ public:
|
||||||
*/
|
*/
|
||||||
nsresult SetSourceSizeHint(uint32_t aSizeHint);
|
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 GetURIString() {
|
||||||
nsCString spec;
|
nsCString spec;
|
||||||
if (GetURI()) {
|
if (GetURI()) {
|
||||||
|
|
@ -407,9 +402,6 @@ private: // data
|
||||||
// This is currently only used for statistics
|
// This is currently only used for statistics
|
||||||
int32_t mDecodeCount;
|
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
|
// A weak pointer to our ImageContainer, which stays alive only as long as
|
||||||
// the layer system needs it.
|
// the layer system needs it.
|
||||||
WeakPtr<layers::ImageContainer> mImageContainer;
|
WeakPtr<layers::ImageContainer> mImageContainer;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ nsJPEGDecoder::nsJPEGDecoder(RasterImage* aImage,
|
||||||
SIZE_MAX),
|
SIZE_MAX),
|
||||||
Transition::TerminateSuccess())
|
Transition::TerminateSuccess())
|
||||||
, mDecodeStyle(aDecodeStyle)
|
, mDecodeStyle(aDecodeStyle)
|
||||||
, mSampleSize(0)
|
|
||||||
{
|
{
|
||||||
mState = JPEG_HEADER;
|
mState = JPEG_HEADER;
|
||||||
mReading = true;
|
mReading = true;
|
||||||
|
|
@ -239,17 +238,8 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
||||||
return Transition::ContinueUnbuffered(State::JPEG_DATA); // I/O suspension
|
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
|
// Post our size to the superclass
|
||||||
PostSize(mInfo.output_width, mInfo.output_height,
|
PostSize(mInfo.image_width, mInfo.image_height,
|
||||||
ReadOrientationFromEXIF());
|
ReadOrientationFromEXIF());
|
||||||
if (HasError()) {
|
if (HasError()) {
|
||||||
// Setting the size led to an error.
|
// Setting the size led to an error.
|
||||||
|
|
@ -384,6 +374,9 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
||||||
mInfo.buffered_image = mDecodeStyle == PROGRESSIVE &&
|
mInfo.buffered_image = mDecodeStyle == PROGRESSIVE &&
|
||||||
jpeg_has_multiple_scans(&mInfo);
|
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?");
|
MOZ_ASSERT(!mImageData, "Already have a buffer allocated?");
|
||||||
nsresult rv = AllocateFrame(OutputSize(), FullOutputFrame(),
|
nsresult rv = AllocateFrame(OutputSize(), FullOutputFrame(),
|
||||||
SurfaceFormat::B8G8R8X8);
|
SurfaceFormat::B8G8R8X8);
|
||||||
|
|
@ -409,7 +402,7 @@ nsJPEGDecoder::ReadJPEGData(const char* aData, size_t aLength)
|
||||||
MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
|
MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
|
||||||
(" JPEGDecoderAccounting: nsJPEGDecoder::"
|
(" JPEGDecoderAccounting: nsJPEGDecoder::"
|
||||||
"Write -- created image frame with %ux%u pixels",
|
"Write -- created image frame with %ux%u pixels",
|
||||||
mInfo.output_width, mInfo.output_height));
|
mInfo.image_width, mInfo.image_height));
|
||||||
|
|
||||||
mState = JPEG_START_DECOMPRESS;
|
mState = JPEG_START_DECOMPRESS;
|
||||||
MOZ_FALLTHROUGH; // to start decompressing.
|
MOZ_FALLTHROUGH; // to start decompressing.
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,6 @@ public:
|
||||||
|
|
||||||
DecoderType GetType() const override { return DecoderType::JPEG; }
|
DecoderType GetType() const override { return DecoderType::JPEG; }
|
||||||
|
|
||||||
virtual void SetSampleSize(int aSampleSize) override
|
|
||||||
{
|
|
||||||
mSampleSize = aSampleSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyDone();
|
void NotifyDone();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -115,8 +110,6 @@ public:
|
||||||
const Decoder::DecodeStyle mDecodeStyle;
|
const Decoder::DecodeStyle mDecodeStyle;
|
||||||
|
|
||||||
uint32_t mCMSMode;
|
uint32_t mCMSMode;
|
||||||
|
|
||||||
int mSampleSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace image
|
} // 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>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 840 B |
|
|
@ -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
|
|
||||||
|
|
@ -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
|
# "Here is the beginning of a boundary," and --$(boundary)-- means "All done
|
||||||
# sending you parts.")
|
# sending you parts.")
|
||||||
HTTP == webcam-simulacrum.mjpg blue.jpg
|
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
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,5 @@ include color-management/reftest.list
|
||||||
# Downscaling tests
|
# Downscaling tests
|
||||||
include downscaling/reftest.list
|
include downscaling/reftest.list
|
||||||
|
|
||||||
# Blob URI tests
|
|
||||||
include blob/reftest.list
|
|
||||||
|
|
||||||
# Lossless encoders
|
# Lossless encoders
|
||||||
skip-if(Android) include encoders-lossless/reftest.list
|
skip-if(Android) include encoders-lossless/reftest.list
|
||||||
|
|
|
||||||
|
|
@ -5038,9 +5038,6 @@ pref("layout.accessiblecaret.hide_carets_for_mouse_input", true);
|
||||||
// Wakelock is disabled by default.
|
// Wakelock is disabled by default.
|
||||||
pref("dom.wakelock.enabled", false);
|
pref("dom.wakelock.enabled", false);
|
||||||
|
|
||||||
// disable mozsample size for now
|
|
||||||
pref("image.mozsamplesize.enabled", false);
|
|
||||||
|
|
||||||
pref("beacon.enabled", true);
|
pref("beacon.enabled", true);
|
||||||
|
|
||||||
// Camera prefs
|
// Camera prefs
|
||||||
|
|
|
||||||
|
|
@ -334,19 +334,6 @@ bool nsMediaFragmentURIParser::ParseXYWH(nsDependentSubstring aString)
|
||||||
return false;
|
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)
|
void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
||||||
{
|
{
|
||||||
// Create an array of possibly-invalid media fragments.
|
// Create an array of possibly-invalid media fragments.
|
||||||
|
|
@ -367,9 +354,9 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the media fragment values.
|
// 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) {
|
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.
|
// We've got one of each possible type. No need to look at the rest.
|
||||||
break;
|
break;
|
||||||
} else if (!gotTemporal && fragments[i].first.EqualsLiteral("t")) {
|
} else if (!gotTemporal && fragments[i].first.EqualsLiteral("t")) {
|
||||||
|
|
@ -378,9 +365,6 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
|
||||||
} else if (!gotSpatial && fragments[i].first.EqualsLiteral("xywh")) {
|
} else if (!gotSpatial && fragments[i].first.EqualsLiteral("xywh")) {
|
||||||
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
|
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
|
||||||
gotSpatial = ParseXYWH(nsDependentSubstring(value, 0));
|
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,6 @@ public:
|
||||||
// returns the unit used.
|
// returns the unit used.
|
||||||
ClipUnit GetClipUnit() const { return mClipUnit; }
|
ClipUnit GetClipUnit() const { return mClipUnit; }
|
||||||
|
|
||||||
bool HasSampleSize() const { return mSampleSize.isSome(); }
|
|
||||||
|
|
||||||
int GetSampleSize() const { return *mSampleSize; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Parse the URI ref provided, looking for media fragments. This is
|
// Parse the URI ref provided, looking for media fragments. This is
|
||||||
// the top-level parser the invokes the others below.
|
// the top-level parser the invokes the others below.
|
||||||
|
|
@ -88,14 +84,12 @@ private:
|
||||||
bool ParseNPTMM(nsDependentSubstring& aString, uint32_t& aMinute);
|
bool ParseNPTMM(nsDependentSubstring& aString, uint32_t& aMinute);
|
||||||
bool ParseNPTSS(nsDependentSubstring& aString, uint32_t& aSecond);
|
bool ParseNPTSS(nsDependentSubstring& aString, uint32_t& aSecond);
|
||||||
bool ParseXYWH(nsDependentSubstring aString);
|
bool ParseXYWH(nsDependentSubstring aString);
|
||||||
bool ParseMozSampleSize(nsDependentSubstring aString);
|
|
||||||
|
|
||||||
// Media fragment information.
|
// Media fragment information.
|
||||||
Maybe<double> mStart;
|
Maybe<double> mStart;
|
||||||
Maybe<double> mEnd;
|
Maybe<double> mEnd;
|
||||||
Maybe<nsIntRect> mClip;
|
Maybe<nsIntRect> mClip;
|
||||||
ClipUnit mClipUnit;
|
ClipUnit mClipUnit;
|
||||||
Maybe<int> mSampleSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue