Bug 1269046 part 9: Add a flag to control whether CSSAlignUtils::AlignJustifySelf() expands "auto" margins. r=mats

MozReview-Commit-ID: I0UdEIfiOqX
This commit is contained in:
Daniel Holbert 2016-10-31 08:59:40 -07:00
Родитель 8a46fab5d0
Коммит 0d6dda2ff4
3 изменённых файлов: 11 добавлений и 3 удалений

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

@ -84,10 +84,14 @@ CSSAlignUtils::AlignJustifySelf(uint8_t aAlignment, LogicalAxis aAxis,
const auto& styleMargin = aRI.mStyleMargin->mMargin; const auto& styleMargin = aRI.mStyleMargin->mMargin;
bool hasAutoMarginStart; bool hasAutoMarginStart;
bool hasAutoMarginEnd; bool hasAutoMarginEnd;
if (aAxis == eLogicalAxisBlock) { if (aFlags & AlignJustifyFlags::eIgnoreAutoMargins) {
// (Note: ReflowInput will have treated "auto" margins as 0, so we
// don't need to do anything special to avoid expanding them.)
hasAutoMarginStart = hasAutoMarginEnd = false;
} else if (aAxis == eLogicalAxisBlock) {
hasAutoMarginStart = styleMargin.GetBStartUnit(wm) == eStyleUnit_Auto; hasAutoMarginStart = styleMargin.GetBStartUnit(wm) == eStyleUnit_Auto;
hasAutoMarginEnd = styleMargin.GetBEndUnit(wm) == eStyleUnit_Auto; hasAutoMarginEnd = styleMargin.GetBEndUnit(wm) == eStyleUnit_Auto;
} else { } else { /* aAxis == eLogicalAxisInline */
hasAutoMarginStart = styleMargin.GetIStartUnit(wm) == eStyleUnit_Auto; hasAutoMarginStart = styleMargin.GetIStartUnit(wm) == eStyleUnit_Auto;
hasAutoMarginEnd = styleMargin.GetIEndUnit(wm) == eStyleUnit_Auto; hasAutoMarginEnd = styleMargin.GetIEndUnit(wm) == eStyleUnit_Auto;
} }

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

@ -24,6 +24,10 @@ public:
// Indicates that the container's start side in aAxis is the same // Indicates that the container's start side in aAxis is the same
// as the child's start side in the child's parallel axis. // as the child's start side in the child's parallel axis.
eSameSide = 1 << 1, eSameSide = 1 << 1,
// Indicates that AlignJustifySelf() shouldn't expand "auto" margins.
// (By default, AlignJustifySelf() *will* expand such margins, to fill the
// available space before any alignment is done.)
eIgnoreAutoMargins = 1 << 2,
}; };
/** /**

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

@ -423,7 +423,7 @@ OffsetToAlignedStaticPos(const ReflowInput& aKidReflowInput,
? alignAreaSize.ISize(pcWM) ? alignAreaSize.ISize(pcWM)
: alignAreaSize.BSize(pcWM); : alignAreaSize.BSize(pcWM);
AlignJustifyFlags flags = AlignJustifyFlags::eNoFlags; AlignJustifyFlags flags = AlignJustifyFlags::eIgnoreAutoMargins;
uint16_t alignConst = uint16_t alignConst =
aPlaceholderContainer->CSSAlignmentForAbsPosChild(aKidReflowInput, pcAxis); aPlaceholderContainer->CSSAlignmentForAbsPosChild(aKidReflowInput, pcAxis);
// XXXdholbert: Handle <overflow-position> in bug 1311892 (by conditionally // XXXdholbert: Handle <overflow-position> in bug 1311892 (by conditionally