diff --git a/mozilla/gfx/thebes/src/gfxFont.cpp b/mozilla/gfx/thebes/src/gfxFont.cpp index a9928c82c92..606c5d24e09 100644 --- a/mozilla/gfx/thebes/src/gfxFont.cpp +++ b/mozilla/gfx/thebes/src/gfxFont.cpp @@ -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; diff --git a/mozilla/layout/base/nsPresContext.h b/mozilla/layout/base/nsPresContext.h index 7c48a269d67..88639cd874b 100644 --- a/mozilla/layout/base/nsPresContext.h +++ b/mozilla/layout/base/nsPresContext.h @@ -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 diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 24afa010e0d..4a34f8e1ec9 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -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;