#501: add toggle pref

This commit is contained in:
Cameron Kaiser 2019-02-07 21:29:43 -08:00
parent 630d191905
commit ac0300a558
3 changed files with 8 additions and 2 deletions

View File

@ -295,6 +295,7 @@ private:
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(Live, "image.single-color-optimization.enabled", ImageSingleColorOptimizationEnabled, bool, true);
DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabled, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);

View File

@ -65,7 +65,8 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
type = DecoderType::ICON;
// WEBP
} else if (!strcmp(aMimeType, IMAGE_WEBP)) {
} else if (!strcmp(aMimeType, IMAGE_WEBP) &&
MOZ_LIKELY(gfxPrefs::ImageWebPEnabled())) {
type = DecoderType::WEBP;
}
@ -161,7 +162,8 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
return nullptr;
}
MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG,
MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG ||
aType == DecoderType::WEBP,
"Calling CreateAnimationDecoder for non-animating DecoderType");
RefPtr<Decoder> decoder =

View File

@ -4193,6 +4193,9 @@ pref("image.mem.surfacecache.discard_factor", 1);
// automatically determined based on the system's number of cores.
pref("image.multithreaded_decoding.limit", -1);
// Whether we attempt to decode WebP images or not.
pref("image.webp.enabled", true);
// Limit for the canvas image cache. 0 means we don't limit the size of the
// cache.
pref("canvas.image.cache.limit", 0);