From 9a38e7f2ebab1e15df92261f67a249d1cb7d228d Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 12 Mar 2014 20:33:21 -0700 Subject: [PATCH] Bug 349259 patch 2: Prevent html:input elements from having a line-height smaller than 1. r=bz --- layout/generic/nsHTMLReflowState.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 1918320c0b7..23fe476d0a3 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -2485,6 +2485,16 @@ nsHTMLReflowState::CalcLineHeight(nsIContent* aContent, NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up"); + if (aContent && aContent->IsHTML(nsGkAtoms::input)) { + // For Web-compatibility, input elements cannot have a line-height + // smaller than one. + nscoord lineHeightOne = + aFontSizeInflation * aStyleContext->StyleFont()->mFont.size; + if (lineHeight < lineHeightOne) { + lineHeight = lineHeightOne; + } + } + return lineHeight; }