Bug 1067748. When a solid-color display item covers everything else in its layer, make it a ColorLayer. r=tn

--HG--
extra : rebase_source : e0fdaddfd24c59531ffef865b46f948ba203acaa
This commit is contained in:
Robert O'Callahan 2014-09-16 16:27:14 +12:00
Родитель c0b6c35cc7
Коммит 7758b7fe56
1 изменённых файлов: 10 добавлений и 4 удалений

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

@ -2349,7 +2349,11 @@ ThebesLayerData::Accumulate(ContainerState* aState,
bool clipMatches = mItemClip == aClip;
mItemClip = aClip;
if (!mIsSolidColorInVisibleRegion && mOpaqueRegion.Contains(aDrawRect) &&
nscolor uniformColor;
bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor);
if (!mIsSolidColorInVisibleRegion && !isUniform &&
mOpaqueRegion.Contains(aDrawRect) &&
mVisibleRegion.Contains(aVisibleRect)) {
// A very common case! Most pages have a ThebesLayer with the page
// background (opaque) visible and most or all of the page content over the
@ -2363,9 +2367,6 @@ ThebesLayerData::Accumulate(ContainerState* aState,
return;
}
nscolor uniformColor;
bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor);
// Some display items have to exist (so they can set forceTransparentSurface
// below) but don't draw anything. They'll return true for isUniform but
// a color with opacity 0.
@ -2386,6 +2387,11 @@ ThebesLayerData::Accumulate(ContainerState* aState,
// This color is all we have
mSolidColor = uniformColor;
mIsSolidColorInVisibleRegion = true;
} else if (NS_GET_A(uniformColor) == 255 &&
aVisibleRect.Contains(mVisibleRegion.GetBounds())) {
// This color covers everything else in the layer
mSolidColor = uniformColor;
mIsSolidColorInVisibleRegion = true;
} else if (mIsSolidColorInVisibleRegion &&
mVisibleRegion.IsEqual(nsIntRegion(aVisibleRect)) &&
clipMatches) {