mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00
Bug 1571764 - Subtract combobox display frame border-padding when inferring the height from line-height. r=mats,jfkthame
This fixes it and seems to be an acceptable fix... Should I make it conditional on box-sizing: border-box for completeness? The display frame has border-box box-sizing, and not having it would be a bug, I'd think... Differential Revision: https://phabricator.services.mozilla.com/D41939 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b1b4f894c9
commit
21744a9708
@ -1237,19 +1237,27 @@ void nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
|
||||
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
||||
|
||||
ReflowInput state(aReflowInput);
|
||||
WritingMode wm = aReflowInput.GetWritingMode();
|
||||
LogicalMargin bp = state.ComputedLogicalBorderPadding();
|
||||
if (state.ComputedBSize() == NS_UNCONSTRAINEDSIZE) {
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(mComboBox);
|
||||
// We intentionally use the combobox frame's style here, which has
|
||||
// the 'line-height' specified by the author, if any.
|
||||
// (This frame has 'line-height: -moz-block-height' in the UA
|
||||
// sheet which is suitable when there's a specified block-size.)
|
||||
auto lh = ReflowInput::CalcLineHeight(mComboBox->GetContent(),
|
||||
mComboBox->Style(), aPresContext,
|
||||
NS_UNCONSTRAINEDSIZE, inflation);
|
||||
nscoord lh = ReflowInput::CalcLineHeight(mComboBox->GetContent(),
|
||||
mComboBox->Style(), aPresContext,
|
||||
NS_UNCONSTRAINEDSIZE, inflation);
|
||||
if (!mComboBox->StyleText()->mLineHeight.IsNormal()) {
|
||||
// If the author specified a different line-height than normal, or a
|
||||
// different appearance, subtract the border-padding from the
|
||||
// comboboxdisplay frame, so as to respect that line-height rather than
|
||||
// that line-height + 2px (from the UA sheet).
|
||||
lh = std::max(0, lh - bp.BStartEnd(wm));
|
||||
}
|
||||
state.SetComputedBSize(lh);
|
||||
}
|
||||
WritingMode wm = aReflowInput.GetWritingMode();
|
||||
nscoord inlineBp = state.ComputedLogicalBorderPadding().IStartEnd(wm);
|
||||
nscoord inlineBp = bp.IStartEnd(wm);
|
||||
nscoord computedISize = mComboBox->mDisplayISize - inlineBp;
|
||||
|
||||
// Other UAs ignore padding in some (but not all) platforms for (themed only)
|
||||
|
@ -19,7 +19,7 @@
|
||||
<select style="overflow: hidden"><option>XXXXXXXXXXXXXXXXX</option></select>
|
||||
|
||||
<!-- Test that this only affects themed comboboxes -->
|
||||
<div class="unthemed" style="padding-right: 15ch"><div style="padding: 1px 4px; overflow: hidden;">XXXXXXXXXX</div></div>
|
||||
<div class="unthemed" style="padding-right: 15ch"><div style="padding: 0 4px; overflow: hidden;">XXXXXXXXXX</div></div>
|
||||
|
||||
<select id="src" style="padding-left: 10ch; padding-right: 10ch"><option>XXXXXXXXXX</option></select>
|
||||
<select id="ref" style="padding-left: 10ch;"><option>XXXXXXXXXX</option></select>
|
||||
|
@ -0,0 +1,2 @@
|
||||
[select-1-block-size-001-2.html]
|
||||
fuzzy: maxDifference=48;totalPixels=0-4
|
@ -0,0 +1,2 @@
|
||||
[select-1-block-size-001.html]
|
||||
fuzzy: maxDifference=48;totalPixels=0-4
|
@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<title>Select block size when line-height is specified</title>
|
||||
<!--
|
||||
FIXME: This is just a copy of select-1-block-size-001.html, but if I move the
|
||||
<link rel="match"> in this file to select-1-block-size-001-ref.html (which is
|
||||
the "right" way to do this), fuzzy annotations do not work.
|
||||
-->
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1571764">
|
||||
<link rel="match" href="select-1-block-size-001-ref-2.html">
|
||||
<style>
|
||||
select {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
background: black;
|
||||
color: black;
|
||||
|
||||
line-height: 100px;
|
||||
width: 100px;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<select></select>
|
||||
<select><option>A</option></select>
|
@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1571764">
|
||||
<style>
|
||||
div {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
background: black;
|
||||
color: black;
|
||||
|
||||
line-height: 100px;
|
||||
width: 100px;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
<div>A</div>
|
||||
<div>A</div>
|
@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1571764">
|
||||
<style>
|
||||
button {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
background: black;
|
||||
color: black;
|
||||
|
||||
line-height: 100px;
|
||||
width: 100px;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<button>A</button>
|
||||
<button>A</button>
|
@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<title>Select block size when line-height is specified</title>
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1571764">
|
||||
<link rel="match" href="select-1-block-size-001-ref.html">
|
||||
<style>
|
||||
select {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
background: black;
|
||||
color: black;
|
||||
|
||||
line-height: 100px;
|
||||
width: 100px;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<select></select>
|
||||
<select><option>A</option></select>
|
Loading…
x
Reference in New Issue
Block a user