Bug 1247929 patch 2 - Hard-code the Web-compatible set of form controls whose intrinsic minimum inline-size shrinks to 0 when inline-size (width) is specified as a percentage. r=dholbert

This adjusts the behavior previously modified by bug 823483 patch 2 and
bug 823483 patch 5.

MozReview-Commit-ID: 5IjYhFLUr68
This commit is contained in:
L. David Baron 2016-02-24 10:40:29 -08:00
Родитель 19ebacc921
Коммит 80475d611d
1 изменённых файлов: 38 добавлений и 1 удалений

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

@ -4506,6 +4506,43 @@ GetIntrinsicCoord(const nsStyleCoord& aStyle,
static int32_t gNoiseIndent = 0;
#endif
// Return true for form controls whose minimum intrinsic inline-size
// shrinks to 0 when they have a percentage inline-size (but not
// percentage max-inline-size). (Proper replaced elements, whose
// intrinsic minimium inline-size shrinks to 0 for both percentage
// inline-size and percentage max-inline-size, are handled elsewhere.)
inline static bool
FormControlShrinksForPercentISize(nsIFrame* aFrame)
{
if (!aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
// Quick test to reject most frames.
return false;
}
nsIAtom* fType = aFrame->GetType();
if (fType == nsGkAtoms::meterFrame || fType == nsGkAtoms::progressFrame) {
// progress and meter do have this shrinking behavior
// FIXME: Maybe these should be nsIFormControlFrame?
return true;
}
if (!static_cast<nsIFormControlFrame*>(do_QueryFrame(aFrame))) {
// Not a form control. This includes fieldsets, which do not
// shrink.
return false;
}
if (fType == nsGkAtoms::gfxButtonControlFrame ||
fType == nsGkAtoms::HTMLButtonControlFrame) {
// Buttons don't have this shrinking behavior. (Note that color
// inputs do, even though they inherit from button, so we can't use
// do_QueryFrame here.)
return false;
}
return true;
}
/**
* Add aOffsets which describes what to add on outside of the content box
* aContentSize (controlled by 'box-sizing') and apply min/max properties.
@ -4586,7 +4623,7 @@ AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext,
(((aStyleSize.HasPercent() || aStyleMaxSize.HasPercent()) &&
aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) ||
(aStyleSize.HasPercent() &&
aFrame->GetType() == nsGkAtoms::textInputFrame))) {
FormControlShrinksForPercentISize(aFrame)))) {
// A percentage width or max-width on replaced elements means they
// can shrink to 0.
// This is also true for percentage widths (but not max-widths) on