summaryrefslogtreecommitdiffstats
path: root/layout/generic
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2019-03-14 19:40:42 +0200
committerJustOff <Off.Just.Off@gmail.com>2019-03-14 19:40:42 +0200
commitc427cf64a8c13b13ce39fecf9db71672df622038 (patch)
tree5f4e6db6450062aa58dfd6ce926e1f7abb5004c5 /layout/generic
parent973b9cace810263b3f7d617f377f912dc3b06e4f (diff)
downloadUXP-c427cf64a8c13b13ce39fecf9db71672df622038.tar
UXP-c427cf64a8c13b13ce39fecf9db71672df622038.tar.gz
UXP-c427cf64a8c13b13ce39fecf9db71672df622038.tar.lz
UXP-c427cf64a8c13b13ce39fecf9db71672df622038.tar.xz
UXP-c427cf64a8c13b13ce39fecf9db71672df622038.zip
Handle the special case of a flex frame being the absolute containing block correctly from the CSS align code
Diffstat (limited to 'layout/generic')
-rw-r--r--layout/generic/nsAbsoluteContainingBlock.cpp28
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);