Bug 1566632 - Part 2: Prevent buttons from becoming font inflation containers. r=emilio

A similar reasoning as in bug 1540176 applies here as well: Pending a possible
rework of the AutoMaybeDisableFontInflation logic (bug 1619749), inflation
containers generally cannot take the (I)size increase of font inflation into
account during shrink-wrapping, and form controls like buttons are particularly
hard hit, as
a) they often contain only small amounts of text and
b) unlike regular "inline-block" elements such as <div>s, they aren't font
   inflation flow roots either, and as such are therefore subject to the full
   amount of font inflation from their surrounding contents,
so they are more likely to end up with a situation were the inflated text won't
fit the ISize of the button even with word wrapping applied.

Therefore, as a quicker fix,  buttons will now also specifically prevented from
becoming font inflation containers.
This also has the added advantage that they thereby become subject to the logic
from bug 708175 - i.e. if the button has a fixed width, we will no now no longer
inflate its text.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan Henning 2020-03-09 20:28:23 +00:00
Родитель ecac6b1824
Коммит 686525b211
2 изменённых файлов: 4 добавлений и 3 удалений

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

@ -568,7 +568,8 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
(content &&
// Form controls shouldn't become inflation containers.
(content->IsAnyOfHTMLElements(nsGkAtoms::option, nsGkAtoms::optgroup,
nsGkAtoms::select, nsGkAtoms::input)))) &&
nsGkAtoms::select, nsGkAtoms::input,
nsGkAtoms::button)))) &&
!(aFrame->IsXULBoxFrame() && aFrame->GetParent()->IsXULBoxFrame());
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) || isInline ||
// br frames and mathml frames report being line

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

@ -67,8 +67,8 @@ test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceE
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == fixed-height-body-child.html fixed-height-body-child-ref.html # Bug 1392106
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == consecutive-inline.html consecutive-inline-ref.html
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == form-button-fixed-height.html form-button-fixed-height-ref.html
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) fails == form-button-fixed-width.html form-button-fixed-width-ref.html
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) fails == form-button.html form-button-ref.html
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == form-button-fixed-width.html form-button-fixed-width-ref.html
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == form-button.html form-button-ref.html
# Ordinarily, reftests use a browser.viewport.desktopWidth of 800px, same as the
# size of the reftest document. The failure condition of the test below however