summaryrefslogtreecommitdiff
path: root/layout/generic/nsFrame.cpp
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2022-08-16 16:11:48 -0500
committerJeremy Andrews <athenian200@outlook.com>2022-08-16 16:11:48 -0500
commitef4eb3f926821fe87bf9a64be29d859ab5e0a6f5 (patch)
tree588fba7657f9488b72393bc3ee682a375f1a4c87 /layout/generic/nsFrame.cpp
parent2a57b39dbc1cc8b2bb32dedd87707680a1025430 (diff)
downloaduxp-ef4eb3f926821fe87bf9a64be29d859ab5e0a6f5.tar.gz
Issue #1986 - Part 2: Add IsItemInlineAxisMainAxis() and rework some nsFrame code.
It turns out part 10 was actually needed, but Bug 1449838 had a significantly better version of what that code does that was easy enough to backport to what we have. As far as I can tell, this passes the relevant reftests now.
Diffstat (limited to 'layout/generic/nsFrame.cpp')
-rw-r--r--layout/generic/nsFrame.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 43ad970890..9bc4941e0b 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -39,6 +39,7 @@
#include "mozilla/Logging.h"
#include "mozilla/Sprintf.h"
#include "nsFrameManager.h"
+#include "nsFlexContainerFrame.h"
#include "nsLayoutUtils.h"
#include "LayoutLogging.h"
#include "mozilla/RestyleManager.h"
@@ -4752,12 +4753,11 @@ nsFrame::ComputeSize(nsRenderingContext* aRenderingContext,
}
bool isFlexItem = (parentFrameType == nsGkAtoms::flexContainerFrame &&
!(GetStateBits() & NS_FRAME_OUT_OF_FLOW));
+
bool isInlineFlexItem = false;
if (isFlexItem) {
- uint32_t flexDirection = GetParent()->StylePosition()->mFlexDirection;
isInlineFlexItem =
- flexDirection == NS_STYLE_FLEX_DIRECTION_ROW ||
- flexDirection == NS_STYLE_FLEX_DIRECTION_ROW_REVERSE;
+ nsFlexContainerFrame::IsItemInlineAxisMainAxis(this);
const nsStyleCoord* flexBasis = &(stylePos->mFlexBasis);
SetCoordToFlexBasis(isInlineFlexItem, false, flexBasis,
@@ -4973,11 +4973,8 @@ nsFrame::ComputeSizeWithIntrinsicDimensions(nsRenderingContext* aRenderingConte
// from our style struct. (Otherwise, we'll be using an irrelevant value in
// the aspect-ratio calculations below.)
if (isFlexItem) {
- uint32_t flexDirection =
- GetParent()->StylePosition()->mFlexDirection;
isInlineFlexItem =
- flexDirection == NS_STYLE_FLEX_DIRECTION_ROW ||
- flexDirection == NS_STYLE_FLEX_DIRECTION_ROW_REVERSE;
+ nsFlexContainerFrame::IsItemInlineAxisMainAxis(this);
// If FlexItemMainSizeOverride frame-property is set, then that means the
// flex container is imposing a main-size on this flex item for it to use