Ensure square list bullets are always square. (Bug 376690) r=roc

This commit is contained in:
L. David Baron 2010-02-18 12:26:54 -05:00
Родитель 6d197cb006
Коммит d5e88ef60c
1 изменённых файлов: 19 добавлений и 3 удалений

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

@ -273,9 +273,25 @@ nsBulletFrame::PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
break;
case NS_STYLE_LIST_STYLE_SQUARE:
aRenderingContext.FillRect(mPadding.left + aPt.x, mPadding.top + aPt.y,
mRect.width - (mPadding.left + mPadding.right),
mRect.height - (mPadding.top + mPadding.bottom));
{
nsRect rect(mPadding.TopLeft() + aPt,
nsSize(mRect.width - mPadding.LeftRight(),
mRect.height - mPadding.TopBottom()));
// Snap the height and the width of the rectangle to device pixels,
// and then center the result within the original rectangle, so that
// all square bullets at the same font size have the same visual
// size (bug 376690).
// FIXME: We should really only do this if we're not transformed
// (like gfxContext::UserToDevicePixelSnapped does).
nsPresContext *pc = PresContext();
nsRect snapRect(rect.x, rect.y,
pc->RoundAppUnitsToNearestDevPixels(rect.width),
pc->RoundAppUnitsToNearestDevPixels(rect.height));
snapRect.MoveBy((rect.width - snapRect.width) / 2,
(rect.height - snapRect.height) / 2);
aRenderingContext.FillRect(snapRect.x, snapRect.y,
snapRect.width, snapRect.height);
}
break;
case NS_STYLE_LIST_STYLE_DECIMAL: