Bug 1269046 part 10: Skip the normal margin-adding codepath for abspos frames that undergo CSS Box Alignment (which takes care of margins). r?mats
MozReview-Commit-ID: Ha0o1rwFzE9
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -622,18 +622,29 @@ nsAbsoluteContainingBlock::ReflowAbsolut
LogicalSize(wm, availISize,
NS_UNCONSTRAINEDSIZE),
&logicalCBSize, rsFlags);
// Get the border values
WritingMode outerWM = aReflowInput.GetWritingMode();
const LogicalMargin border(outerWM,
aReflowInput.mStyleBorder->GetComputedBorder());
- const LogicalMargin margin =
+ LogicalMargin margin =
kidReflowInput.ComputedLogicalMargin().ConvertTo(outerWM, wm);
+
+ // 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)
&& (aFlags & AbsPosReflowFlags::eConstrainHeight)
// Don't split if told not to (e.g. for fixed frames)
&& (aDelegatingFrame->GetType() != nsGkAtoms::inlineFrame)
//XXX we don't handle splitting frames for inline absolute containing blocks yet
&& (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
aReflowInput.AvailableBSize());
// Don't split things below the fold. (Ideally we shouldn't *have*