Bug 1148418 - Make nsDisplayBackgroundColor::Paint use a higher precision floating point type to avoid scrolling artifacts. r=mattwoodrow
This commit is contained in:
@@ -2938,11 +2938,28 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
|
|
||||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
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,
|
Rect rect = NSRectToSnappedRect(borderBox,
|
||||||
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||||
aDrawTarget);
|
aDrawTarget);
|
||||||
ColorPattern color(ToDeviceColor(mColor));
|
ColorPattern color(ToDeviceColor(mColor));
|
||||||
aDrawTarget.FillRect(rect, color);
|
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
|
nsRegion
|
||||||
|
|||||||
Reference in New Issue
Block a user