Bug 1623124 - Min used line-height for a single-line input element should be the font's 'normal' line-height. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D67180

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2020-03-17 19:46:57 +00:00
Родитель 2b5e255589
Коммит 90df20f928
3 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -2864,11 +2864,15 @@ nscoord ReflowInput::CalcLineHeight(nsIContent* aContent,
HTMLInputElement* input = HTMLInputElement::FromNodeOrNull(aContent);
if (input && input->IsSingleLineTextControl()) {
// For Web-compatibility, single-line text input elements cannot
// have a line-height smaller than one.
nscoord lineHeightOne =
aFontSizeInflation * aComputedStyle->StyleFont()->mFont.size;
if (lineHeight < lineHeightOne) {
lineHeight = lineHeightOne;
// have a line-height smaller than 'normal'.
const StyleLineHeight& lh = aComputedStyle->StyleText()->mLineHeight;
if (!lh.IsNormal()) {
RefPtr<nsFontMetrics> fm = nsLayoutUtils::GetFontMetricsForComputedStyle(
aComputedStyle, aPresContext, aFontSizeInflation);
nscoord normal = GetNormalLineHeight(fm);
if (lineHeight < normal) {
lineHeight = normal;
}
}
}

Просмотреть файл

@ -8,7 +8,7 @@
<title>Reference: stretching input items with auto-margins and/or orthogonal writing-mode</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1317168">
<style type="text/css">
* { color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0; }
* { color:black; background-color:white; font:10px/1.5 monospace; padding:0; margin:0; }
* { vertical-align: top; }
.grid {
display: inline-grid;
@ -65,13 +65,13 @@ input {
<div class="grid"><input class="mxw m" style="height:20px"></div>
<div class="grid"><input class="mxw hma10 je" style="height:20px"></div>
<div class="grid"><input class="mxw hmaa jc" style="height:20px"></div>
<div class="grid"><input class="mxw vr hma10 je" style="width:10px; height:20px"></div>
<div class="grid"><input class="mxw vr hma10 je" style="width:15px; height:20px"></div>
<div class="grid"><input class="mxw vr" style="height:28px"></div>
<div class="grid"><input class="mxh m je" style="width:190px"></div>
<div class="grid"><input class="mxh hma10 je"></div>
<div class="grid"><input class="mxh hmaa jc"></div>
<div class="grid"><input class="mxh vr hmaa jc" style="width:10px"></div>
<div class="grid"><input class="mxh vr hmaa jc" style="width:15px"></div>
<div class="grid"><input class="mxh vr" style="width:198px"></div>
<div class="grid" style="grid:auto/auto; padding:0;"><input></div>

Просмотреть файл

@ -10,7 +10,7 @@
<link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-normal">
<link rel="match" href="grid-item-input-stretch-001-ref.html">
<style type="text/css">
* { color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0; }
* { color:black; background-color:white; font:10px/1.5 monospace; padding:0; margin:0; }
* { vertical-align: top; }
.grid {
display: inline-grid;