Bug 1298008 Part 3: Update ReflowInput::CalculateBlockSideMargins to store computed values in the UsedMargin property. r=dholbert

MozReview-Commit-ID: 74u7rFkiVln

--HG--
extra : rebase_source : 896f1ee98c78d94ea47c4a11ba87d4f516d0319e
This commit is contained in:
Brad Werth 2018-03-23 12:09:48 -07:00
Родитель 0c04a5bbab
Коммит 6910a2c333
1 изменённых файлов: 15 добавлений и 6 удалений

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

@ -2531,7 +2531,7 @@ static void
UpdateProp(nsIFrame* aFrame,
const FramePropertyDescriptor<nsMargin>* aProperty,
bool aNeeded,
nsMargin& aNewValue)
const nsMargin& aNewValue)
{
if (aNeeded) {
nsMargin* propValue = aFrame->GetProperty(aProperty);
@ -2566,10 +2566,10 @@ SizeComputationInput::InitOffsets(WritingMode aWM,
// XXX fix to provide 0,0 for the top&bottom margins for
// inline-non-replaced elements
bool needMarginProp = ComputeMargin(aWM, aPercentBasis);
// XXX We need to include 'auto' horizontal margins in this too!
// ... but if we did that, we'd need to fix nsFrame::GetUsedMargin
// to use it even when the margins are all zero (since sometimes
// they get treated as auto)
// Note that ComputeMargin() simplistically resolves 'auto' margins to 0.
// In formatting contexts where this isn't correct, some later code will
// need to update the UsedMargin() property with the actual resolved value.
// One example of this is ::CalculateBlockSideMargins().
::UpdateProp(mFrame, nsIFrame::UsedMarginProperty(), needMarginProp,
ComputedPhysicalMargin());
@ -2800,7 +2800,16 @@ ReflowInput::CalculateBlockSideMargins(LayoutFrameType aFrameType)
} else if (isAutoEndMargin) {
margin.IEnd(cbWM) += availMarginSpace;
}
SetComputedLogicalMargin(margin.ConvertTo(mWritingMode, cbWM));
LogicalMargin marginInOurWM = margin.ConvertTo(mWritingMode, cbWM);
SetComputedLogicalMargin(marginInOurWM);
if (isAutoStartMargin || isAutoEndMargin) {
// Update the UsedMargin property if we were tracking it already.
nsMargin* propValue = mFrame->GetProperty(nsIFrame::UsedMarginProperty());
if (propValue) {
*propValue = marginInOurWM.GetPhysicalMargin(mWritingMode);
}
}
}
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight