зеркало из https://github.com/mozilla/gecko-dev.git
Bug 654641. Make nsDisplaySolidColor::GetBounds reflect any snapping that's going on. r=tnikkel
This commit is contained in:
Родитель
ffe5279729
Коммит
e8bdea28a0
|
@ -828,8 +828,32 @@ PRBool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx) {
|
||||
// Note that even if the rectangle we draw and snap is smaller than aRect,
|
||||
// it's OK to call this to get a bounding rect for what we'll draw, because
|
||||
// snapping a rectangle which is contained in R always gives you a
|
||||
// rectangle which is contained in the snapped R.
|
||||
static nsRect
|
||||
SnapBounds(PRBool aSnappingEnabled, nsPresContext* aPresContext,
|
||||
const nsRect& aRect) {
|
||||
nsRect r = aRect;
|
||||
if (aSnappingEnabled) {
|
||||
nscoord appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel();
|
||||
r = r.ToNearestPixels(appUnitsPerDevPixel).ToAppUnits(appUnitsPerDevPixel);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsDisplaySolidColor::GetBounds(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
return SnapBounds(mSnappingEnabled, presContext, mBounds);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
aCtx->SetColor(mColor);
|
||||
aCtx->FillRect(mVisibleRect);
|
||||
}
|
||||
|
@ -1025,21 +1049,6 @@ nsDisplayBackground::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||
nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC);
|
||||
}
|
||||
|
||||
// Note that even if the rectangle we draw and snap is smaller than aRect,
|
||||
// it's OK to call this to get a bounding rect for what we'll draw, because
|
||||
// snapping a rectangle which is contained in R always gives you a
|
||||
// rectangle which is contained in the snapped R.
|
||||
static nsRect
|
||||
SnapBounds(PRBool aSnappingEnabled, nsPresContext* aPresContext,
|
||||
const nsRect& aRect) {
|
||||
nsRect r = aRect;
|
||||
if (aSnappingEnabled) {
|
||||
nscoord appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel();
|
||||
r = r.ToNearestPixels(appUnitsPerDevPixel).ToAppUnits(appUnitsPerDevPixel);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
nsRegion
|
||||
nsDisplayBackground::GetInsideClipRegion(nsPresContext* aPresContext,
|
||||
PRUint8 aClip, const nsRect& aRect)
|
||||
|
|
|
@ -1457,7 +1457,8 @@ public:
|
|||
const nsRect& aBounds, nscolor aColor,
|
||||
PRBool aIsRootContentDocBackground = PR_FALSE)
|
||||
: nsDisplayItem(aBuilder, aFrame), mBounds(aBounds), mColor(aColor),
|
||||
mIsRootContentDocBackground(aIsRootContentDocBackground) {
|
||||
mIsRootContentDocBackground(aIsRootContentDocBackground),
|
||||
mSnappingEnabled(aBuilder->IsSnappingEnabled() && !aBuilder->IsInTransform()) {
|
||||
NS_ASSERTION(NS_GET_A(aColor) > 0, "Don't create invisible nsDisplaySolidColors!");
|
||||
MOZ_COUNT_CTOR(nsDisplaySolidColor);
|
||||
}
|
||||
|
@ -1467,7 +1468,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) { return mBounds; }
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
|
||||
|
||||
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
PRBool* aOutTransparentBackground = nsnull) {
|
||||
|
@ -1504,6 +1505,7 @@ private:
|
|||
nsRect mBounds;
|
||||
nscolor mColor;
|
||||
PRPackedBool mIsRootContentDocBackground;
|
||||
PRPackedBool mSnappingEnabled;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче