Bug 1148418 - Make nsDisplayBackgroundColor::Paint use a higher precision floating point type to avoid scrolling artifacts. r=mattwoodrow

This commit is contained in:
Jonathan Watt 2015-05-10 17:14:14 +01:00
parent 0c5ccc4f47
commit 798a360c0e

View File

@ -2938,11 +2938,28 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
#if 0
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1148418#c21 for why this
// results in a precision induced rounding issue that makes the rect one
// pixel shorter in rare cases. Disabled in favor of the old code for now.
// Note that the pref layout.css.devPixelsPerPx needs to be set to 1 to
// reproduce the bug.
Rect rect = NSRectToSnappedRect(borderBox,
mFrame->PresContext()->AppUnitsPerDevPixel(),
aDrawTarget);
ColorPattern color(ToDeviceColor(mColor));
aDrawTarget.FillRect(rect, color);
#else
gfxContext* ctx = aCtx->ThebesContext();
gfxRect bounds =
nsLayoutUtils::RectToGfxRect(borderBox, mFrame->PresContext()->AppUnitsPerDevPixel());
ctx->SetColor(mColor);
ctx->NewPath();
ctx->Rectangle(bounds, true);
ctx->Fill();
#endif
}
nsRegion