bug 1019470 - restore space after list-style-image bullet. r=mats
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -1536,45 +1536,56 @@ nsBulletFrame::GetDesiredSize(nsPresCont
nsHTMLReflowMetrics& aMetrics,
float aFontSizeInflation)
{
// Reset our padding. If we need it, we'll set it below.
mPadding.SizeTo(0, 0, 0, 0);
const nsStyleList* myList = StyleList();
nscoord ascent;
+ nsRefPtr<nsFontMetrics> fm;
+ nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
+ aFontSizeInflation);
RemoveStateBits(BULLET_FRAME_IMAGE_LOADING);
if (myList->GetListStyleImage() && mImageRequest) {
uint32_t status;
mImageRequest->GetImageStatus(&status);
if (status & imgIRequest::STATUS_SIZE_AVAILABLE &&
!(status & imgIRequest::STATUS_ERROR)) {
// auto size the image
aMetrics.Width() = mIntrinsicSize.width;
aMetrics.SetTopAscent(aMetrics.Height() = mIntrinsicSize.height);
+ // Add spacing to the padding.
+ nscoord halfEm = fm->EmHeight() / 2;
+ WritingMode wm = GetWritingMode();
+ if (wm.IsVertical()) {
+ mPadding.bottom += halfEm;
+ } else if (wm.IsBidiLTR()) {
+ mPadding.right += halfEm;
+ } else {
+ mPadding.left += halfEm;
+ }
+
AddStateBits(BULLET_FRAME_IMAGE_LOADING);
return;
}
}
// If we're getting our desired size and don't have an image, reset
// mIntrinsicSize to (0,0). Otherwise, if we used to have an image, it
// changed, and the new one is coming in, but we're reflowing before it's
// fully there, we'll end up with mIntrinsicSize not matching our size, but
// won't trigger a reflow in OnStartContainer (because mIntrinsicSize will
// match the image size).
mIntrinsicSize.SizeTo(0, 0);
- nsRefPtr<nsFontMetrics> fm;
- nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
- aFontSizeInflation);
nscoord bulletSize;
nsAutoString text;
switch (myList->mListStyleType) {
case NS_STYLE_LIST_STYLE_NONE:
aMetrics.Width() = aMetrics.Height() = 0;
aMetrics.SetTopAscent(0);
break;
@@ -1584,17 +1595,17 @@ nsBulletFrame::GetDesiredSize(nsPresCont
case NS_STYLE_LIST_STYLE_SQUARE: {
ascent = fm->MaxAscent();
bulletSize = std::max(nsPresContext::CSSPixelsToAppUnits(MIN_BULLET_SIZE),
NSToCoordRound(0.8f * (float(ascent) / 2.0f)));
mPadding.bottom = NSToCoordRound(float(ascent) / 8.0f);
aMetrics.Width() = aMetrics.Height() = bulletSize;
aMetrics.SetTopAscent(bulletSize + mPadding.bottom);
- // Add spacing to the padding
+ // Add spacing to the padding.
nscoord halfEm = fm->EmHeight() / 2;
WritingMode wm = GetWritingMode();
if (wm.IsVertical()) {
mPadding.bottom += halfEm;
} else if (wm.IsBidiLTR()) {
mPadding.right += halfEm;
} else {
mPadding.left += halfEm;