Bug 867770 - Add a pref as to whether we layerize animated images, disabled by default. r=mattwoodrow

This commit is contained in:
Joe Drew 2013-05-30 21:33:17 -04:00
Родитель 64fe79505a
Коммит 46f4aef1d0
5 изменённых файлов: 27 добавлений и 1 удалений

Просмотреть файл

@ -1846,6 +1846,7 @@ nsDisplayBackgroundImage::GetLayerState(nsDisplayListBuilder* aBuilder,
const FrameLayerBuilder::ContainerParameters& aParameters)
{
if (!TryOptimizeToImageLayer(aManager, aBuilder) ||
!nsLayoutUtils::AnimatedImageLayersEnabled() ||
!mIsAnimated) {
if (!aManager->IsCompositingCheap() ||
!nsLayoutUtils::GPUImageScalingEnabled()) {

Просмотреть файл

@ -382,6 +382,22 @@ nsLayoutUtils::GPUImageScalingEnabled()
return sGPUImageScalingEnabled;
}
bool
nsLayoutUtils::AnimatedImageLayersEnabled()
{
static bool sAnimatedImageLayersEnabled;
static bool sAnimatedImageLayersPrefCached = false;
if (!sAnimatedImageLayersPrefCached) {
sAnimatedImageLayersPrefCached = true;
Preferences::AddBoolVarCache(&sAnimatedImageLayersEnabled,
"layout.animated-image-layers.enabled",
false);
}
return sAnimatedImageLayersEnabled;
}
void
nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame,
nsOverflowAreas& aOverflowAreas)

Просмотреть файл

@ -1613,6 +1613,11 @@ public:
*/
static bool GPUImageScalingEnabled();
/**
* Checks whether we want to layerize animated images whenever possible.
*/
static bool AnimatedImageLayersEnabled();
/**
* Unions the overflow areas of all non-popup children of aFrame with
* aOverflowAreas.

Просмотреть файл

@ -1259,7 +1259,8 @@ nsDisplayImage::GetLayerState(nsDisplayListBuilder* aBuilder,
const FrameLayerBuilder::ContainerParameters& aParameters)
{
bool animated = false;
if (mImage->GetType() != imgIContainer::TYPE_RASTER ||
if (!nsLayoutUtils::AnimatedImageLayersEnabled() ||
mImage->GetType() != imgIContainer::TYPE_RASTER ||
NS_FAILED(mImage->GetAnimated(&animated)) ||
!animated) {
if (!aManager->IsCompositingCheap() ||

Просмотреть файл

@ -4078,6 +4078,9 @@ pref("dom.event.handling-user-input-time-limit", 1000);
//3D Transforms
pref("layout.3d-transforms.enabled", true);
// Whether we should layerize all animated images (if otherwise possible).
pref("layout.animated-image-layers.enabled", false);
pref("dom.vibrator.enabled", true);
pref("dom.vibrator.max_vibrate_ms", 10000);
pref("dom.vibrator.max_vibrate_list_len", 128);