Bug 1335806 part 2 - Refactor the intrinsic size calculations a bit (idempotent patch). r=dholbert

MozReview-Commit-ID: JRYx7sWFcPA
This commit is contained in:
Mats Palmgren 2017-03-16 15:24:56 +01:00
Родитель 987c2fde4b
Коммит 26ed1865cd
1 изменённых файлов: 10 добавлений и 18 удалений

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

@ -5200,33 +5200,25 @@ nsFrame::ComputeSizeWithIntrinsicDimensions(nsRenderingContext* aRenderingConte
const bool isVertical = aWM.IsVertical();
const nsStyleCoord& isizeCoord =
isVertical ? aIntrinsicSize.height : aIntrinsicSize.width;
const nsStyleCoord& bsizeCoord =
isVertical ? aIntrinsicSize.width : aIntrinsicSize.height;
bool hasIntrinsicISize, hasIntrinsicBSize;
nscoord intrinsicISize, intrinsicBSize;
if (isizeCoord.GetUnit() == eStyleUnit_Coord) {
hasIntrinsicISize = true;
intrinsicISize = isizeCoord.GetCoordValue();
if (intrinsicISize < 0)
intrinsicISize = 0;
const bool hasIntrinsicISize = isizeCoord.GetUnit() == eStyleUnit_Coord;
nscoord intrinsicISize;
if (hasIntrinsicISize) {
intrinsicISize = std::max(nscoord(0), isizeCoord.GetCoordValue());
} else {
NS_ASSERTION(isizeCoord.GetUnit() == eStyleUnit_None,
"unexpected unit");
hasIntrinsicISize = false;
intrinsicISize = 0;
}
if (bsizeCoord.GetUnit() == eStyleUnit_Coord) {
hasIntrinsicBSize = true;
intrinsicBSize = bsizeCoord.GetCoordValue();
if (intrinsicBSize < 0)
intrinsicBSize = 0;
const nsStyleCoord& bsizeCoord =
isVertical ? aIntrinsicSize.width : aIntrinsicSize.height;
const bool hasIntrinsicBSize = bsizeCoord.GetUnit() == eStyleUnit_Coord;
nscoord intrinsicBSize;
if (hasIntrinsicBSize) {
intrinsicBSize = std::max(nscoord(0), bsizeCoord.GetCoordValue());
} else {
NS_ASSERTION(bsizeCoord.GetUnit() == eStyleUnit_None,
"unexpected unit");
hasIntrinsicBSize = false;
intrinsicBSize = 0;
}