Bug 823483 patch 4 - Make a percentage max-width override a fixed width for replaced element intrinsic size computation. r=dholbert

This just reorders the if-else chain to change which conditions are
tested first.  Prior to patch 1, the order didn't matter, but with patch
1, the order does matter, and the order that we happened to have was the
opposite of the one that matches Chromium and Edge.

--HG--
extra : commitid : 6sFft3gnM2g
This commit is contained in:
L. David Baron 2016-02-04 09:43:02 +11:00
Родитель edba326f06
Коммит 76f4658435
1 изменённых файлов: 11 добавлений и 9 удалений

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

@ -4542,18 +4542,20 @@ AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext,
pctTotal += pctOutsideSize;
nscoord size;
if (GetAbsoluteCoord(aStyleSize, size) ||
GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
PROP_WIDTH, size)) {
result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
pctOutsideSize);
} else if (aType == nsLayoutUtils::MIN_ISIZE &&
(aStyleSize.HasPercent() ||
aStyleMaxSize.HasPercent()) &&
aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) {
if (aType == nsLayoutUtils::MIN_ISIZE &&
(aStyleSize.HasPercent() ||
aStyleMaxSize.HasPercent()) &&
aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) {
// A percentage width or max-width on replaced elements means they
// can shrink to 0.
// Note that if this is max-width, this overrides the fixed-width
// rule in the next condition.
result = 0; // let |min| handle padding/border/margin
} else if (GetAbsoluteCoord(aStyleSize, size) ||
GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
PROP_WIDTH, size)) {
result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
pctOutsideSize);
} else {
// NOTE: We could really do a lot better for percents and for some
// cases of calc() containing percent (certainly including any where