diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-18 08:14:23 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-18 08:14:23 +0100 |
commit | a36c3f69c82e1a38b43f0c5f36c562fb08615c62 (patch) | |
tree | 78f9875465a215447e28f1a2c8363c2ea05b3a87 /layout/generic/nsAbsoluteContainingBlock.cpp | |
parent | c7c3c8600febd196152e5b23f687cbe8aa493627 (diff) | |
parent | b0c7cca308a4321dea734044ccdb511dbedea83b (diff) | |
download | UXP-a36c3f69c82e1a38b43f0c5f36c562fb08615c62.tar UXP-a36c3f69c82e1a38b43f0c5f36c562fb08615c62.tar.gz UXP-a36c3f69c82e1a38b43f0c5f36c562fb08615c62.tar.lz UXP-a36c3f69c82e1a38b43f0c5f36c562fb08615c62.tar.xz UXP-a36c3f69c82e1a38b43f0c5f36c562fb08615c62.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP
Diffstat (limited to 'layout/generic/nsAbsoluteContainingBlock.cpp')
-rw-r--r-- | layout/generic/nsAbsoluteContainingBlock.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index 7c48aae92..e3c847d01 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -409,14 +409,30 @@ OffsetToAlignedStaticPos(const ReflowInput& aKidReflowInput, ? GetOrthogonalAxis(aAbsPosCBAxis) : aAbsPosCBAxis); + const bool placeholderContainerIsContainingBlock = + aPlaceholderContainer == aKidReflowInput.mCBReflowInput->mFrame; + nsIAtom* parentType = aPlaceholderContainer->GetType(); LogicalSize alignAreaSize(pcWM); if (parentType == nsGkAtoms::flexContainerFrame) { - // The alignment container is the flex container's content box: - alignAreaSize = aPlaceholderContainer->GetLogicalSize(pcWM); - LogicalMargin pcBorderPadding = - aPlaceholderContainer->GetLogicalUsedBorderAndPadding(pcWM); - alignAreaSize -= pcBorderPadding.Size(pcWM); + // We store the frame rect in FinishAndStoreOverflow, which runs _after_ + // reflowing the absolute frames, so handle the special case of the frame + // being the actual containing block here, by getting the size from + // aAbsPosCBSize. + // + // The alignment container is the flex container's content box. + if (placeholderContainerIsContainingBlock) { + alignAreaSize = aAbsPosCBSize.ConvertTo(pcWM, aAbsPosCBWM); + // aAbsPosCBSize is the padding-box, so substract the padding to get the + // content box. + alignAreaSize -= + aPlaceholderContainer->GetLogicalUsedPadding(pcWM).Size(pcWM); + } else { + alignAreaSize = aPlaceholderContainer->GetLogicalSize(pcWM); + LogicalMargin pcBorderPadding = + aPlaceholderContainer->GetLogicalUsedBorderAndPadding(pcWM); + alignAreaSize -= pcBorderPadding.Size(pcWM); + } } else if (parentType == nsGkAtoms::gridContainerFrame) { // This abspos elem's parent is a grid container. Per CSS Grid 10.1 & 10.2: // - If the grid container *also* generates the abspos containing block (a @@ -424,7 +440,7 @@ OffsetToAlignedStaticPos(const ReflowInput& aKidReflowInput, // the alignment container, too. (And its size is aAbsPosCBSize.) // - Otherwise, we use the grid's padding box as the alignment container. // https://drafts.csswg.org/css-grid/#static-position - if (aPlaceholderContainer == aKidReflowInput.mCBReflowInput->mFrame) { + if (placeholderContainerIsContainingBlock) { // The alignment container is the grid area that we're using as the // absolute containing block. alignAreaSize = aAbsPosCBSize.ConvertTo(pcWM, aAbsPosCBWM); |