Bug 1201327 - Let DLBI detect background-position changes. r=mattwoodrow

--HG--
extra : commitid : CDTUZNG0PYF
extra : rebase_source : 0f5db6e4a5cde5fe8faeb77e15f95d12f6753fac
This commit is contained in:
Markus Stange 2015-10-28 22:52:15 +01:00
Родитель 0beffda503
Коммит ec2e30835a
5 изменённых файлов: 37 добавлений и 1 удалений

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

@ -2141,6 +2141,25 @@ nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilde
MOZ_COUNT_CTOR(nsDisplayBackgroundImage);
mBounds = GetBoundsInternal(aBuilder);
mDestArea = GetDestAreaInternal(aBuilder);
}
nsRect
nsDisplayBackgroundImage::GetDestAreaInternal(nsDisplayListBuilder* aBuilder)
{
if (!mBackgroundStyle) {
return nsRect();
}
nsPresContext* presContext = mFrame->PresContext();
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
nsBackgroundLayerState state =
nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
borderArea, borderArea, layer);
return state.mDestArea;
}
nsDisplayBackgroundImage::~nsDisplayBackgroundImage()
@ -2791,6 +2810,13 @@ void nsDisplayBackgroundImage::ComputeInvalidationRegion(nsDisplayListBuilder* a
}
return;
}
if (!mDestArea.IsEqualInterior(geometry->mDestArea)) {
// Dest area changed in a way that could cause everything to change,
// so invalidate everything (both old and new painting areas).
aInvalidRegion->Or(bounds, geometry->mBounds);
NotifyRenderingChanged();
return;
}
if (aBuilder->ShouldSyncDecodeImages()) {
const nsStyleImage& image = mBackgroundStyle->mLayers[mLayer].mImage;
if (image.GetType() == eStyleImageType_Image &&

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

@ -2575,6 +2575,11 @@ public:
*/
nsRect GetPositioningArea();
/**
* Return the destination area of one instance of the image.
*/
nsRect GetDestArea() const { return mDestArea; }
/**
* Returns true if existing rendered pixels of this display item may need
* to be redrawn if the positioning area size changes but its position does
@ -2615,6 +2620,7 @@ protected:
gfxRect* aDestRect);
bool IsNonEmptyFixedImage() const;
nsRect GetBoundsInternal(nsDisplayListBuilder* aBuilder);
nsRect GetDestAreaInternal(nsDisplayListBuilder* aBuilder);
void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
const nsRect& aBounds, nsRect* aClipRect);
@ -2637,6 +2643,7 @@ protected:
LayoutDeviceRect mImageLayerDestRect;
/* Bounds of this display item */
nsRect mBounds;
nsRect mDestArea;
uint32_t mLayer;
};

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

@ -63,6 +63,7 @@ nsDisplayBackgroundGeometry::nsDisplayBackgroundGeometry(nsDisplayBackgroundImag
: nsDisplayItemGeometry(aItem, aBuilder)
, nsImageGeometryMixin(aItem, aBuilder)
, mPositioningArea(aItem->GetPositioningArea())
, mDestArea(aItem->GetDestArea())
{}
void
@ -70,6 +71,7 @@ nsDisplayBackgroundGeometry::MoveBy(const nsPoint& aOffset)
{
nsDisplayItemGeometry::MoveBy(aOffset);
mPositioningArea.MoveBy(aOffset);
mDestArea.MoveBy(aOffset);
}
nsDisplayThemedBackgroundGeometry::nsDisplayThemedBackgroundGeometry(nsDisplayThemedBackground* aItem,

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

@ -194,6 +194,7 @@ public:
virtual void MoveBy(const nsPoint& aOffset) override;
nsRect mPositioningArea;
nsRect mDestArea;
};
class nsDisplayThemedBackgroundGeometry : public nsDisplayItemGeometry

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

@ -3,7 +3,7 @@ skip-if(B2G||Mulet) == background-common-usage-floating-point.html background-co
== background-common-usage-pixel.html background-common-usage-ref.html
== background-draw-nothing-empty-rect.html background-draw-nothing-ref.html
== background-draw-nothing-invalid-syntax.html background-draw-nothing-ref.html
asserts(0-4) == background-draw-nothing-malformed-images.html background-draw-nothing-ref.html # Bug 576419
asserts(0-6) == background-draw-nothing-malformed-images.html background-draw-nothing-ref.html # Bug 576419
== background-monster-rect.html background-monster-rect-ref.html
== background-over-size-rect.html background-over-size-rect-ref.html
== background-test-parser.html background-test-parser-ref.html