Bug 1679819 Part 1 - Move the computation of border and margin closer to its usage in ReflowAbsoluteFrame(). r=emilio

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D98226
This commit is contained in:
Ting-Yu Lin 2020-11-30 22:04:37 +00:00
Родитель ca8fd6da81
Коммит 28ddd5d88d
1 изменённых файлов: 15 добавлений и 16 удалений

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

@ -716,22 +716,6 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
LogicalSize(wm, availISize, NS_UNCONSTRAINEDSIZE),
Some(logicalCBSize), initFlags);
// Get the border values
WritingMode outerWM = aReflowInput.GetWritingMode();
const LogicalMargin border(outerWM, aDelegatingFrame->GetUsedBorder());
LogicalMargin margin = kidReflowInput.ComputedLogicalMargin(outerWM);
// If we're doing CSS Box Alignment in either axis, that will apply the
// margin for us in that axis (since the thing that's aligned is the margin
// box). So, we clear out the margin here to avoid applying it twice.
if (kidReflowInput.mFlags.mIOffsetsNeedCSSAlign) {
margin.IStart(outerWM) = margin.IEnd(outerWM) = 0;
}
if (kidReflowInput.mFlags.mBOffsetsNeedCSSAlign) {
margin.BStart(outerWM) = margin.BEnd(outerWM) = 0;
}
bool constrainBSize =
(aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) &&
@ -751,6 +735,10 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
(aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
aReflowInput.AvailableBSize());
// Get the border values
const WritingMode outerWM = aReflowInput.GetWritingMode();
const LogicalMargin border = aDelegatingFrame->GetLogicalUsedBorder(outerWM);
if (constrainBSize) {
kidReflowInput.AvailableBSize() =
aReflowInput.AvailableBSize() -
@ -770,6 +758,17 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
const LogicalSize kidSize = kidDesiredSize.Size(outerWM);
LogicalMargin offsets = kidReflowInput.ComputedLogicalOffsets(outerWM);
LogicalMargin margin = kidReflowInput.ComputedLogicalMargin(outerWM);
// If we're doing CSS Box Alignment in either axis, that will apply the
// margin for us in that axis (since the thing that's aligned is the margin
// box). So, we clear out the margin here to avoid applying it twice.
if (kidReflowInput.mFlags.mIOffsetsNeedCSSAlign) {
margin.IStart(outerWM) = margin.IEnd(outerWM) = 0;
}
if (kidReflowInput.mFlags.mBOffsetsNeedCSSAlign) {
margin.BStart(outerWM) = margin.BEnd(outerWM) = 0;
}
// If we're solving for start in either inline or block direction,
// then compute it now that we know the dimensions.