Bug 365414 overflowed decoration lines are not erased/painted r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@232046 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
masayuki%d-toybox.com
2007-08-14 16:39:55 +00:00
parent ac08a83d0d
commit 89c1b72449
3 changed files with 15 additions and 1 deletions

View File

@@ -347,7 +347,9 @@ gfxFont::Measure(gfxTextRun *aTextRun,
metrics.mAdvanceWidth = floatAdvance;
const PRUint32 appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
metrics.mAscent = fontMetrics.maxAscent*appUnitsPerDevUnit;
metrics.mDescent = fontMetrics.maxDescent*appUnitsPerDevUnit;
gfxFloat descentForUnderline =
NS_round(fontMetrics.underlineSize) + NS_round(metrics.mAscent - fontMetrics.underlineOffset) - metrics.mAscent;
metrics.mDescent = PR_MAX(fontMetrics.maxDescent, descentForUnderline)*appUnitsPerDevUnit;
metrics.mBoundingBox =
gfxRect(0, -metrics.mAscent, floatAdvance, metrics.mAscent + metrics.mDescent);
return metrics;

View File

@@ -518,6 +518,9 @@ public:
float AppUnitsToPoints(nscoord aAppUnits) const
{ return (float)aAppUnits / mDeviceContext->AppUnitsPerInch() * 72.0f; }
nscoord RoundAppUnitsToNearestDevPixels(nscoord aAppUnits) const
{ return DevPixelsToAppUnits(AppUnitsToDevPixels(aAppUnits)); }
/**
* Get the language-specific transform type for the current document.
* This tells us whether we need to perform special language-dependent

View File

@@ -559,6 +559,15 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
// affect our height.
fm->GetMaxAscent(aMetrics.ascent);
fm->GetHeight(aMetrics.height);
// Include the text-decoration lines to the height.
// Currently, only undeline is overflowable.
nscoord offset, size;
fm->GetUnderline(offset, size);
nscoord ascentAndUnderline =
aPresContext->RoundAppUnitsToNearestDevPixels(aMetrics.ascent - offset) +
aPresContext->RoundAppUnitsToNearestDevPixels(size);
if (ascentAndUnderline > aMetrics.height)
aMetrics.height = ascentAndUnderline;
} else {
NS_WARNING("Cannot get font metrics - defaulting sizes to 0");
aMetrics.ascent = aMetrics.height = 0;