mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 695763. Part 5. Invalidate background images if they are not decoded and we are asked to do a sync decode. r=matt.woodrow
This commit is contained in:
parent
abee3da29a
commit
3efded2df1
@ -3036,19 +3036,29 @@ nsCSSRendering::GetBackgroundLayerRect(nsPresContext* aPresContext,
|
||||
return state.mFillArea;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsCSSRendering::IsBackgroundImageDecodedForStyleContextAndLayer(
|
||||
const nsStyleBackground *aBackground, uint32_t aLayer)
|
||||
{
|
||||
const nsStyleImage* image = &aBackground->mLayers[aLayer].mImage;
|
||||
if (image->GetType() == eStyleImageType_Image) {
|
||||
nsCOMPtr<imgIContainer> img;
|
||||
if (NS_SUCCEEDED(image->GetImageData()->GetImage(getter_AddRefs(img)))) {
|
||||
if (!img->IsDecoded()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsCSSRendering::AreAllBackgroundImagesDecodedForFrame(nsIFrame* aFrame)
|
||||
{
|
||||
const nsStyleBackground *bg = aFrame->StyleContext()->StyleBackground();
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
const nsStyleImage* image = &bg->mLayers[i].mImage;
|
||||
if (image->GetType() == eStyleImageType_Image) {
|
||||
nsCOMPtr<imgIContainer> img;
|
||||
if (NS_SUCCEEDED(image->GetImageData()->GetImage(getter_AddRefs(img)))) {
|
||||
if (!img->IsDecoded()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!IsBackgroundImageDecodedForStyleContextAndLayer(bg, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -396,6 +396,12 @@ struct nsCSSRendering {
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
uint32_t aFlags);
|
||||
|
||||
/**
|
||||
* Checks if image in layer aLayer of aBackground is currently decoded.
|
||||
*/
|
||||
static bool IsBackgroundImageDecodedForStyleContextAndLayer(
|
||||
const nsStyleBackground *aBackground, uint32_t aLayer);
|
||||
|
||||
/**
|
||||
* Checks if all images that are part of the background for aFrame are
|
||||
* currently decoded.
|
||||
|
@ -2193,6 +2193,12 @@ void nsDisplayBackgroundImage::ComputeInvalidationRegion(nsDisplayListBuilder* a
|
||||
aInvalidRegion->Or(bounds, geometry->mBounds);
|
||||
return;
|
||||
}
|
||||
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||
if (mBackgroundStyle &&
|
||||
!nsCSSRendering::IsBackgroundImageDecodedForStyleContextAndLayer(mBackgroundStyle, mLayer)) {
|
||||
aInvalidRegion->Or(*aInvalidRegion, bounds);
|
||||
}
|
||||
}
|
||||
if (!bounds.IsEqualInterior(geometry->mBounds)) {
|
||||
// Positioning area is unchanged, so invalidate just the change in the
|
||||
// painting area.
|
||||
|
Loading…
Reference in New Issue
Block a user