From 38ffd75c2ec270411f7b8cf7f677d8861a34d436 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Tue, 1 Nov 2011 12:36:50 +0530 Subject: [PATCH] Bug 536758 - window.getComputedStyle().lineHeight to skip font size ratio adjustment for minimum font size when font sizes are 0. r=dbaron --- layout/style/nsComputedDOMStyle.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 723afa35fa21..d85f2dcbacd6 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3541,9 +3541,11 @@ nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord) // font->mSize as the font size. Adjust for that. Also adjust for // the text zoom, if any. const nsStyleFont* font = GetStyleFont(); - aCoord = NSToCoordRound((float(aCoord) * - (float(font->mSize) / float(font->mFont.size))) / - mPresShell->GetPresContext()->TextZoom()); + float fCoord = float(aCoord) / mPresShell->GetPresContext()->TextZoom(); + if (font->mFont.size != font->mSize) { + fCoord = fCoord * (float(font->mSize) / float(font->mFont.size)); + } + aCoord = NSToCoordRound(fCoord); return true; }