summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsGridContainerFrame.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /layout/generic/nsGridContainerFrame.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/nsGridContainerFrame.cpp')
-rw-r--r--layout/generic/nsGridContainerFrame.cpp502
1 files changed, 263 insertions, 239 deletions
diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp
index 5eb9cde7da..bb6e2150ce 100644
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -28,6 +28,7 @@
#include "nsCSSFrameConstructor.h"
#include "nsDisplayList.h"
#include "nsFieldSetFrame.h"
+#include "nsHTMLButtonControlFrame.h"
#include "nsGfxScrollFrame.h"
#include "nsHashKeys.h"
#include "nsIFrameInlines.h" // for nsIFrame::GetLogicalNormalPosition (don't remove)
@@ -168,7 +169,7 @@ static nscoord ResolveToDefiniteSize(const StyleTrackBreadth& aBreadth,
// block axis; e.g. for English horizontal-tb text, a traditional baseline
// would be a y-axis measurement. But in some cases (e.g. orthogonal WMs), we
// may need to synthesize a baseline in a child's inline axis, which is when
-// this function might receive an aAxis of eLogicalAxisInline. In that case, we
+// this function might receive an aAxis of LogicalAxis::Inline. In that case, we
// assume that the writing mode's preference for central vs. alphabetic
// baselines is irrelevant, since that's a choice about its block-axis
// baselines, and we just unconditionally use the alphabetic baseline
@@ -178,7 +179,7 @@ static nscoord SynthesizeBaselineFromBorderBox(BaselineSharingGroup aGroup,
LogicalAxis aAxis,
nscoord aBorderBoxSize) {
const bool useAlphabeticBaseline =
- (aAxis == eLogicalAxisInline) ? true : aWM.IsAlphabeticalBaseline();
+ (aAxis == LogicalAxis::Inline) ? true : aWM.IsAlphabeticalBaseline();
if (aGroup == BaselineSharingGroup::First) {
return useAlphabeticBaseline ? aBorderBoxSize : aBorderBoxSize / 2;
@@ -218,7 +219,7 @@ struct RepeatTrackSizingInput {
// We can use zero percentage basis since this is only called from
// intrinsic sizing code.
const nscoord percentageBasis = 0;
- if (aAxis == eLogicalAxisInline) {
+ if (aAxis == LogicalAxis::Inline) {
bp = std::max(padding.GetIStart(aWM).Resolve(percentageBasis), 0) +
std::max(padding.GetIEnd(aWM).Resolve(percentageBasis), 0) +
border.IStartEnd(aWM);
@@ -234,17 +235,17 @@ struct RepeatTrackSizingInput {
nscoord& size = mSize.Size(aAxis, aWM);
nscoord& max = mMax.Size(aAxis, aWM);
const auto& minCoord =
- aAxis == eLogicalAxisInline ? pos->MinISize(aWM) : pos->MinBSize(aWM);
+ aAxis == LogicalAxis::Inline ? pos->MinISize(aWM) : pos->MinBSize(aWM);
if (minCoord.ConvertsToLength()) {
min = adjustForBoxSizing(minCoord.ToLength());
}
const auto& maxCoord =
- aAxis == eLogicalAxisInline ? pos->MaxISize(aWM) : pos->MaxBSize(aWM);
+ aAxis == LogicalAxis::Inline ? pos->MaxISize(aWM) : pos->MaxBSize(aWM);
if (maxCoord.ConvertsToLength()) {
max = std::max(min, adjustForBoxSizing(maxCoord.ToLength()));
}
const auto& sizeCoord =
- aAxis == eLogicalAxisInline ? pos->ISize(aWM) : pos->BSize(aWM);
+ aAxis == LogicalAxis::Inline ? pos->ISize(aWM) : pos->BSize(aWM);
if (sizeCoord.ConvertsToLength()) {
size = Clamp(adjustForBoxSizing(sizeCoord.ToLength()), min, max);
}
@@ -576,10 +577,10 @@ struct nsGridContainerFrame::GridArea {
: mCols(aCols), mRows(aRows) {}
bool IsDefinite() const { return mCols.IsDefinite() && mRows.IsDefinite(); }
LineRange& LineRangeForAxis(LogicalAxis aAxis) {
- return aAxis == eLogicalAxisInline ? mCols : mRows;
+ return aAxis == LogicalAxis::Inline ? mCols : mRows;
}
const LineRange& LineRangeForAxis(LogicalAxis aAxis) const {
- return aAxis == eLogicalAxisInline ? mCols : mRows;
+ return aAxis == LogicalAxis::Inline ? mCols : mRows;
}
LineRange mCols;
LineRange mRows;
@@ -665,12 +666,12 @@ struct nsGridContainerFrame::GridItemInfo {
*/
GridItemInfo Transpose() const {
GridItemInfo info(mFrame, GridArea(mArea.mRows, mArea.mCols));
- info.mState[eLogicalAxisBlock] = mState[eLogicalAxisInline];
- info.mState[eLogicalAxisInline] = mState[eLogicalAxisBlock];
- info.mBaselineOffset[eLogicalAxisBlock] =
- mBaselineOffset[eLogicalAxisInline];
- info.mBaselineOffset[eLogicalAxisInline] =
- mBaselineOffset[eLogicalAxisBlock];
+ info.mState[LogicalAxis::Block] = mState[LogicalAxis::Inline];
+ info.mState[LogicalAxis::Inline] = mState[LogicalAxis::Block];
+ info.mBaselineOffset[LogicalAxis::Block] =
+ mBaselineOffset[LogicalAxis::Inline];
+ info.mBaselineOffset[LogicalAxis::Inline] =
+ mBaselineOffset[LogicalAxis::Block];
return info;
}
@@ -684,7 +685,7 @@ struct nsGridContainerFrame::GridItemInfo {
// Is this item a subgrid in either axis?
bool IsSubgrid() const {
- return IsSubgrid(eLogicalAxisInline) || IsSubgrid(eLogicalAxisBlock);
+ return IsSubgrid(LogicalAxis::Inline) || IsSubgrid(LogicalAxis::Block);
}
// Return the (inner) grid container frame associated with this subgrid item.
@@ -725,7 +726,7 @@ struct nsGridContainerFrame::GridItemInfo {
bool ShouldApplyAutoMinSize(WritingMode aContainerWM,
LogicalAxis aContainerAxis,
nscoord aPercentageBasis) const {
- const bool isInlineAxis = aContainerAxis == eLogicalAxisInline;
+ const bool isInlineAxis = aContainerAxis == LogicalAxis::Inline;
const auto* pos =
mFrame->IsTableWrapperFrame()
? mFrame->PrincipalChildList().FirstChild()->StylePosition()
@@ -793,9 +794,9 @@ struct nsGridContainerFrame::GridItemInfo {
return isContinuationA;
}
auto masonryA = a->mArea.mRows.mStart;
- auto gridA = a->mState[eLogicalAxisInline] & StateBits::eAutoPlacement;
+ auto gridA = a->mState[LogicalAxis::Inline] & StateBits::eAutoPlacement;
auto masonryB = b->mArea.mRows.mStart;
- auto gridB = b->mState[eLogicalAxisInline] & StateBits::eAutoPlacement;
+ auto gridB = b->mState[LogicalAxis::Inline] & StateBits::eAutoPlacement;
return (masonryA == 0 ? masonryB != 0 : (masonryB != 0 && gridA < gridB)) &&
!a->mFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
}
@@ -804,9 +805,9 @@ struct nsGridContainerFrame::GridItemInfo {
MOZ_ASSERT(!a->mFrame->GetPrevInFlow() && !b->mFrame->GetPrevInFlow(),
"fragmentation not supported in inline axis");
auto masonryA = a->mArea.mCols.mStart;
- auto gridA = a->mState[eLogicalAxisBlock] & StateBits::eAutoPlacement;
+ auto gridA = a->mState[LogicalAxis::Block] & StateBits::eAutoPlacement;
auto masonryB = b->mArea.mCols.mStart;
- auto gridB = b->mState[eLogicalAxisBlock] & StateBits::eAutoPlacement;
+ auto gridB = b->mState[LogicalAxis::Block] & StateBits::eAutoPlacement;
return (masonryA == 0 ? masonryB != 0 : (masonryB != 0 && gridA < gridB)) &&
!a->mFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
}
@@ -847,20 +848,20 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ItemState)
GridItemInfo::GridItemInfo(nsIFrame* aFrame, const GridArea& aArea)
: mFrame(aFrame), mArea(aArea), mBaselineOffset{0, 0} {
- mState[eLogicalAxisBlock] =
+ mState[LogicalAxis::Block] =
StateBits(mArea.mRows.mStart == kAutoLine ? eAutoPlacement : 0);
- mState[eLogicalAxisInline] =
+ mState[LogicalAxis::Inline] =
StateBits(mArea.mCols.mStart == kAutoLine ? eAutoPlacement : 0);
if (auto* gridFrame = GetGridContainerFrame(mFrame)) {
auto parentWM = aFrame->GetParent()->GetWritingMode();
bool isOrthogonal = parentWM.IsOrthogonalTo(gridFrame->GetWritingMode());
if (gridFrame->IsColSubgrid()) {
- mState[isOrthogonal ? eLogicalAxisBlock : eLogicalAxisInline] |=
+ mState[isOrthogonal ? LogicalAxis::Block : LogicalAxis::Inline] |=
StateBits::eIsSubgrid;
}
if (gridFrame->IsRowSubgrid()) {
- mState[isOrthogonal ? eLogicalAxisInline : eLogicalAxisBlock] |=
+ mState[isOrthogonal ? LogicalAxis::Inline : LogicalAxis::Block] |=
StateBits::eIsSubgrid;
}
}
@@ -884,7 +885,7 @@ void GridItemInfo::InhibitSubgrid(nsGridContainerFrame* aParent,
MOZ_ASSERT(IsSubgrid(aAxis));
auto bit = NS_STATE_GRID_IS_COL_SUBGRID;
if (aParent->GetWritingMode().IsOrthogonalTo(mFrame->GetWritingMode()) !=
- (aAxis == eLogicalAxisBlock)) {
+ (aAxis == LogicalAxis::Block)) {
bit = NS_STATE_GRID_IS_ROW_SUBGRID;
}
MOZ_ASSERT(SubgridFrame()->HasAnyStateBits(bit));
@@ -894,16 +895,18 @@ void GridItemInfo::InhibitSubgrid(nsGridContainerFrame* aParent,
void GridItemInfo::MaybeInhibitSubgridInMasonry(nsGridContainerFrame* aParent,
uint32_t aGridAxisTrackCount) {
- if (IsSubgrid(eLogicalAxisInline) && aParent->IsMasonry(eLogicalAxisBlock) &&
- mArea.mRows.mStart != 0 && mArea.mCols.Extent() != aGridAxisTrackCount &&
- (mState[eLogicalAxisInline] & eAutoPlacement)) {
- InhibitSubgrid(aParent, eLogicalAxisInline);
+ if (IsSubgrid(LogicalAxis::Inline) &&
+ aParent->IsMasonry(LogicalAxis::Block) && mArea.mRows.mStart != 0 &&
+ mArea.mCols.Extent() != aGridAxisTrackCount &&
+ (mState[LogicalAxis::Inline] & eAutoPlacement)) {
+ InhibitSubgrid(aParent, LogicalAxis::Inline);
return;
}
- if (IsSubgrid(eLogicalAxisBlock) && aParent->IsMasonry(eLogicalAxisInline) &&
- mArea.mCols.mStart != 0 && mArea.mRows.Extent() != aGridAxisTrackCount &&
- (mState[eLogicalAxisBlock] & eAutoPlacement)) {
- InhibitSubgrid(aParent, eLogicalAxisBlock);
+ if (IsSubgrid(LogicalAxis::Block) &&
+ aParent->IsMasonry(LogicalAxis::Inline) && mArea.mCols.mStart != 0 &&
+ mArea.mRows.Extent() != aGridAxisTrackCount &&
+ (mState[LogicalAxis::Block] & eAutoPlacement)) {
+ InhibitSubgrid(aParent, LogicalAxis::Block);
}
}
@@ -1061,9 +1064,9 @@ void nsGridContainerFrame::GridItemInfo::Dump() const {
printf("\n");
};
printf("grid-row: %d %d\n", mArea.mRows.mStart, mArea.mRows.mEnd);
- Dump1(" grid block-axis: ", eLogicalAxisBlock);
+ Dump1(" grid block-axis: ", LogicalAxis::Block);
printf("grid-column: %d %d\n", mArea.mCols.mStart, mArea.mCols.mEnd);
- Dump1(" grid inline-axis: ", eLogicalAxisInline);
+ Dump1(" grid inline-axis: ", LogicalAxis::Inline);
}
#endif
@@ -1150,8 +1153,9 @@ struct nsGridContainerFrame::TrackSizingFunctions {
parent->GetWritingMode().ParallelAxisStartsOnSameSide(parentAxis,
grandParentWM);
if (MOZ_UNLIKELY(!isSameDirInAxis)) {
- auto end = parentAxis == eLogicalAxisBlock ? parentSubgrid->mGridRowEnd
- : parentSubgrid->mGridColEnd;
+ auto end = parentAxis == LogicalAxis::Block
+ ? parentSubgrid->mGridRowEnd
+ : parentSubgrid->mGridColEnd;
range.ReverseDirection(end);
// range is now in the same direction as the grand-parent's axis
}
@@ -1166,7 +1170,7 @@ struct nsGridContainerFrame::TrackSizingFunctions {
parent = grandParent;
}
const auto* pos = parent->StylePosition();
- const auto isInlineAxis = parentAxis == eLogicalAxisInline;
+ const auto isInlineAxis = parentAxis == LogicalAxis::Inline;
const auto& szf =
isInlineAxis ? pos->mGridTemplateRows : pos->mGridTemplateColumns;
const auto& autoSizing =
@@ -2707,7 +2711,7 @@ struct nsGridContainerFrame::Tracks {
* gap before aRow to zero (and shift all rows after it by the removed gap).
*/
void BreakBeforeRow(uint32_t aRow) {
- MOZ_ASSERT(mAxis == eLogicalAxisBlock,
+ MOZ_ASSERT(mAxis == LogicalAxis::Block,
"Should only be fragmenting in the block axis (between rows)");
nscoord prevRowEndPos = 0;
if (aRow != 0) {
@@ -2728,7 +2732,7 @@ struct nsGridContainerFrame::Tracks {
* Set the size of aRow to aSize and adjust the position of all rows after it.
*/
void ResizeRow(uint32_t aRow, nscoord aNewSize) {
- MOZ_ASSERT(mAxis == eLogicalAxisBlock,
+ MOZ_ASSERT(mAxis == LogicalAxis::Block,
"Should only be fragmenting in the block axis (between rows)");
MOZ_ASSERT(aNewSize >= 0);
auto& sz = mSizes[aRow];
@@ -2775,7 +2779,7 @@ struct nsGridContainerFrame::Tracks {
#ifdef DEBUG
void nsGridContainerFrame::Tracks::Dump() const {
printf("%zu %s %s ", mSizes.Length(), mIsMasonry ? "masonry" : "grid",
- mAxis == eLogicalAxisBlock ? "rows" : "columns");
+ mAxis == LogicalAxis::Block ? "rows" : "columns");
TrackSize::DumpStateBits(mStateUnion);
printf("\n");
for (uint32_t i = 0, len = mSizes.Length(); i < len; ++i) {
@@ -2805,8 +2809,8 @@ void nsGridContainerFrame::Tracks::Dump() const {
*/
struct nsGridContainerFrame::SharedGridData {
SharedGridData()
- : mCols(eLogicalAxisInline),
- mRows(eLogicalAxisBlock),
+ : mCols(LogicalAxis::Inline),
+ mRows(LogicalAxis::Block),
mGenerateComputedGridInfo(false) {}
Tracks mCols;
Tracks mRows;
@@ -2884,7 +2888,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
}
}
if (mStartRow == numRows ||
- aGridContainerFrame->IsMasonry(eLogicalAxisBlock)) {
+ aGridContainerFrame->IsMasonry(LogicalAxis::Block)) {
// All of the grid's rows fit inside of previous grid-container fragments,
// or it's a masonry axis.
mFragBStart = aConsumedBSize;
@@ -2904,8 +2908,8 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
aGridContainerFrame->SetProperty(UsedTrackSizes::Prop(), prop);
}
prop->mCanResolveLineRangeSize = {true, true};
- prop->mSizes[eLogicalAxisInline].Assign(mCols.mSizes);
- prop->mSizes[eLogicalAxisBlock].Assign(mRows.mSizes);
+ prop->mSizes[LogicalAxis::Inline].Assign(mCols.mSizes);
+ prop->mSizes[LogicalAxis::Block].Assign(mRows.mSizes);
}
// Copy item data from each child's first-in-flow data in mSharedGridData.
@@ -2921,18 +2925,19 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
mGridItems.AppendElement(GridItemInfo(child, itemInfo.mArea));
// Copy the item's baseline data so that the item's last fragment can
// do 'last baseline' alignment if necessary.
- item->mState[eLogicalAxisBlock] |=
- itemInfo.mState[eLogicalAxisBlock] & ItemState::eAllBaselineBits;
- item->mState[eLogicalAxisInline] |=
- itemInfo.mState[eLogicalAxisInline] & ItemState::eAllBaselineBits;
- item->mBaselineOffset[eLogicalAxisBlock] =
- itemInfo.mBaselineOffset[eLogicalAxisBlock];
- item->mBaselineOffset[eLogicalAxisInline] =
- itemInfo.mBaselineOffset[eLogicalAxisInline];
- item->mState[eLogicalAxisBlock] |=
- itemInfo.mState[eLogicalAxisBlock] & ItemState::eAutoPlacement;
- item->mState[eLogicalAxisInline] |=
- itemInfo.mState[eLogicalAxisInline] & ItemState::eAutoPlacement;
+ item->mState[LogicalAxis::Block] |=
+ itemInfo.mState[LogicalAxis::Block] & ItemState::eAllBaselineBits;
+ item->mState[LogicalAxis::Inline] |=
+ itemInfo.mState[LogicalAxis::Inline] &
+ ItemState::eAllBaselineBits;
+ item->mBaselineOffset[LogicalAxis::Block] =
+ itemInfo.mBaselineOffset[LogicalAxis::Block];
+ item->mBaselineOffset[LogicalAxis::Inline] =
+ itemInfo.mBaselineOffset[LogicalAxis::Inline];
+ item->mState[LogicalAxis::Block] |=
+ itemInfo.mState[LogicalAxis::Block] & ItemState::eAutoPlacement;
+ item->mState[LogicalAxis::Inline] |=
+ itemInfo.mState[LogicalAxis::Inline] & ItemState::eAutoPlacement;
break;
}
}
@@ -2975,7 +2980,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
/**
* Return the percentage basis for a grid item in its writing-mode.
- * If aAxis is eLogicalAxisInline then we return NS_UNCONSTRAINEDSIZE in
+ * If aAxis is LogicalAxis::Inline then we return NS_UNCONSTRAINEDSIZE in
* both axes since we know all track sizes are indefinite at this point
* (we calculate column sizes before row sizes). Otherwise, assert that
* column sizes are known and calculate the size for aGridItem.mArea.mCols
@@ -3218,10 +3223,10 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
}
Tracks& TracksFor(LogicalAxis aAxis) {
- return aAxis == eLogicalAxisBlock ? mRows : mCols;
+ return aAxis == LogicalAxis::Block ? mRows : mCols;
}
const Tracks& TracksFor(LogicalAxis aAxis) const {
- return aAxis == eLogicalAxisBlock ? mRows : mCols;
+ return aAxis == LogicalAxis::Block ? mRows : mCols;
}
CSSOrderAwareFrameIterator mIter;
@@ -3275,13 +3280,13 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
const nsStylePosition* aGridStyle, const WritingMode& aWM)
: mIter(aFrame, FrameChildListID::Principal),
mGridStyle(aGridStyle),
- mCols(eLogicalAxisInline),
- mRows(eLogicalAxisBlock),
+ mCols(LogicalAxis::Inline),
+ mRows(LogicalAxis::Block),
mColFunctions(mGridStyle->mGridTemplateColumns,
mGridStyle->mGridAutoColumns,
- aFrame->IsSubgrid(eLogicalAxisInline)),
+ aFrame->IsSubgrid(LogicalAxis::Inline)),
mRowFunctions(mGridStyle->mGridTemplateRows, mGridStyle->mGridAutoRows,
- aFrame->IsSubgrid(eLogicalAxisBlock)),
+ aFrame->IsSubgrid(LogicalAxis::Block)),
mReflowInput(aReflowInput),
mRenderingContext(aRenderingContext),
mFrame(aFrame),
@@ -3299,8 +3304,8 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowInput {
mSkipSides = aFrame->PreReflowBlockLevelLogicalSkipSides();
mBorderPadding.ApplySkipSides(mSkipSides);
}
- mCols.mIsMasonry = aFrame->IsMasonry(eLogicalAxisInline);
- mRows.mIsMasonry = aFrame->IsMasonry(eLogicalAxisBlock);
+ mCols.mIsMasonry = aFrame->IsMasonry(LogicalAxis::Inline);
+ mRows.mIsMasonry = aFrame->IsMasonry(LogicalAxis::Block);
MOZ_ASSERT(!(mCols.mIsMasonry && mRows.mIsMasonry),
"can't have masonry layout in both axes");
}
@@ -3463,7 +3468,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid {
* @param aFromIndex the zero-based index to start counting from
* @param aLineNameList the explicit named lines
* @param aSide the axis+edge we're resolving names for (e.g. if we're
- resolving a grid-row-start line, pass eLogicalSideBStart)
+ resolving a grid-row-start line, pass LogicalSide::BStart)
* @param aExplicitGridEnd the last line in the explicit grid
* @param aStyle the StylePosition() for the grid container
* @return a definite line (1-based), clamped to
@@ -3546,7 +3551,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid {
if (!mParentGrid) {
return nullptr;
}
- bool isRows = aIsOrthogonal == (aAxis == eLogicalAxisInline);
+ bool isRows = aIsOrthogonal == (aAxis == LogicalAxis::Inline);
return isRows ? mParentGrid->mRowNameMap : mParentGrid->mColNameMap;
}
@@ -3684,38 +3689,56 @@ static Subgrid* SubgridComputeMarginBorderPadding(
SizeComputationInput sz(subgridFrame, nullptr, cbWM, pmPercentageBasis);
subgrid->mMarginBorderPadding =
sz.ComputedLogicalMargin(cbWM) + sz.ComputedLogicalBorderPadding(cbWM);
+ if (aGridItem.mFrame == subgridFrame) {
+ return subgrid;
+ }
- if (aGridItem.mFrame != subgridFrame) {
- nsHTMLScrollFrame* scrollFrame =
- do_QueryFrame(aGridItem.mFrame->GetScrollTargetFrame());
- if (scrollFrame) {
- MOZ_ASSERT(
- sz.ComputedLogicalMargin(cbWM) == LogicalMargin(cbWM) &&
- sz.ComputedLogicalBorder(cbWM) == LogicalMargin(cbWM),
- "A scrolled inner frame should not have any margin or border!");
-
- // Add the margin and border from the (outer) scroll frame.
- SizeComputationInput szScrollFrame(aGridItem.mFrame, nullptr, cbWM,
- pmPercentageBasis);
- subgrid->mMarginBorderPadding +=
- szScrollFrame.ComputedLogicalMargin(cbWM) +
- szScrollFrame.ComputedLogicalBorder(cbWM);
-
- nsMargin ssz = scrollFrame->IntrinsicScrollbarGutterSize();
+ bool scroller = false;
+ nsIFrame* outerFrame = [&]() -> nsIFrame* {
+ if (nsHTMLScrollFrame* scrollFrame =
+ do_QueryFrame(aGridItem.mFrame->GetScrollTargetFrame())) {
+ scroller = true;
+ return scrollFrame;
+ }
+ if (nsHTMLButtonControlFrame* f = do_QueryFrame(aGridItem.mFrame)) {
+ return f;
+ }
+ return nullptr;
+ }();
+
+ if (outerFrame) {
+ MOZ_ASSERT(sz.ComputedLogicalMargin(cbWM) == LogicalMargin(cbWM) &&
+ sz.ComputedLogicalBorder(cbWM) == LogicalMargin(cbWM),
+ "A scrolled inner frame / button content frame "
+ "should not have any margin or border / padding!");
+
+ // Add the margin and border from the (outer) frame. Padding is factored-in
+ // for scrollers already (except for the scrollbar gutter), but not for
+ // button-content.
+ SizeComputationInput szOuterFrame(outerFrame, nullptr, cbWM,
+ pmPercentageBasis);
+ subgrid->mMarginBorderPadding += szOuterFrame.ComputedLogicalMargin(cbWM) +
+ szOuterFrame.ComputedLogicalBorder(cbWM);
+ if (scroller) {
+ nsMargin ssz = static_cast<nsHTMLScrollFrame*>(outerFrame)
+ ->IntrinsicScrollbarGutterSize();
subgrid->mMarginBorderPadding += LogicalMargin(cbWM, ssz);
+ } else {
+ subgrid->mMarginBorderPadding +=
+ szOuterFrame.ComputedLogicalPadding(cbWM);
}
+ }
- if (aGridItem.mFrame->IsFieldSetFrame()) {
- const auto* f = static_cast<nsFieldSetFrame*>(aGridItem.mFrame);
- const auto* inner = f->GetInner();
- auto wm = inner->GetWritingMode();
- LogicalPoint pos = inner->GetLogicalPosition(aGridItem.mFrame->GetSize());
- // The legend is always on the BStart side and it inflates the fieldset's
- // "border area" size. The inner frame's b-start pos equals that size.
- LogicalMargin offsets(wm, pos.B(wm), 0, 0, 0);
- subgrid->mMarginBorderPadding += offsets.ConvertTo(cbWM, wm);
- }
+ if (nsFieldSetFrame* f = do_QueryFrame(aGridItem.mFrame)) {
+ const auto* inner = f->GetInner();
+ auto wm = inner->GetWritingMode();
+ LogicalPoint pos = inner->GetLogicalPosition(aGridItem.mFrame->GetSize());
+ // The legend is always on the BStart side and it inflates the fieldset's
+ // "border area" size. The inner frame's b-start pos equals that size.
+ LogicalMargin offsets(wm, pos.B(wm), 0, 0, 0);
+ subgrid->mMarginBorderPadding += offsets.ConvertTo(cbWM, wm);
}
+
return subgrid;
}
@@ -3727,8 +3750,9 @@ static void CopyUsedTrackSizes(nsTArray<TrackSize>& aResult,
LogicalAxis aSubgridAxis) {
MOZ_ASSERT(aSubgridFrame->ParentGridContainerForSubgrid() ==
aUsedTrackSizesFrame);
- aResult.SetLength(aSubgridAxis == eLogicalAxisInline ? aSubgrid->mGridColEnd
- : aSubgrid->mGridRowEnd);
+ aResult.SetLength(aSubgridAxis == LogicalAxis::Inline
+ ? aSubgrid->mGridColEnd
+ : aSubgrid->mGridRowEnd);
auto parentAxis =
aSubgrid->mIsOrthogonal ? GetOrthogonalAxis(aSubgridAxis) : aSubgridAxis;
const auto& parentSizes = aUsedTrackSizes->mSizes[parentAxis];
@@ -3740,7 +3764,7 @@ static void CopyUsedTrackSizes(nsTArray<TrackSize>& aResult,
const auto cbwm = aUsedTrackSizesFrame->GetWritingMode();
const auto wm = aSubgridFrame->GetWritingMode();
// Recompute the MBP to resolve percentages against the resolved track sizes.
- if (parentAxis == eLogicalAxisInline) {
+ if (parentAxis == LogicalAxis::Inline) {
// Find the subgrid's grid item frame in its parent grid container. This
// is usually the same as aSubgridFrame but it may also have a ScrollFrame,
// FieldSetFrame etc. We just loop until we see the first ancestor
@@ -3856,7 +3880,7 @@ void nsGridContainerFrame::UsedTrackSizes::ResolveSubgridTrackSizesForAxis(
grid.mGridRowEnd = aSubgrid->mGridRowEnd;
state.CalculateTrackSizesForAxis(aAxis, grid, aContentBoxSize,
SizingConstraint::NoConstraint);
- const auto& tracks = aAxis == eLogicalAxisInline ? state.mCols : state.mRows;
+ const auto& tracks = aAxis == LogicalAxis::Inline ? state.mCols : state.mRows;
mSizes[aAxis].Assign(tracks.mSizes);
mCanResolveLineRangeSize[aAxis] = tracks.mCanResolveLineRangeSize;
MOZ_ASSERT(mCanResolveLineRangeSize[aAxis]);
@@ -3865,11 +3889,11 @@ void nsGridContainerFrame::UsedTrackSizes::ResolveSubgridTrackSizesForAxis(
void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
LogicalAxis aAxis, const Grid& aGrid, nscoord aContentBoxSize,
SizingConstraint aConstraint) {
- auto& tracks = aAxis == eLogicalAxisInline ? mCols : mRows;
+ auto& tracks = aAxis == LogicalAxis::Inline ? mCols : mRows;
const auto& sizingFunctions =
- aAxis == eLogicalAxisInline ? mColFunctions : mRowFunctions;
- const auto& gapStyle = aAxis == eLogicalAxisInline ? mGridStyle->mColumnGap
- : mGridStyle->mRowGap;
+ aAxis == LogicalAxis::Inline ? mColFunctions : mRowFunctions;
+ const auto& gapStyle = aAxis == LogicalAxis::Inline ? mGridStyle->mColumnGap
+ : mGridStyle->mRowGap;
if (tracks.mIsMasonry) {
// See comment on nsGridContainerFrame::MasonryLayout().
tracks.Initialize(sizingFunctions, gapStyle, 2, aContentBoxSize);
@@ -3877,7 +3901,7 @@ void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
return;
}
uint32_t gridEnd =
- aAxis == eLogicalAxisInline ? aGrid.mGridColEnd : aGrid.mGridRowEnd;
+ aAxis == LogicalAxis::Inline ? aGrid.mGridColEnd : aGrid.mGridRowEnd;
Maybe<TrackSizingFunctions> fallbackTrackSizing;
bool useParentGaps = false;
@@ -3919,7 +3943,7 @@ void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
*this, mGridItems,
fallbackTrackSizing ? *fallbackTrackSizing : sizingFunctions,
aContentBoxSize,
- aAxis == eLogicalAxisInline ? &GridArea::mCols : &GridArea::mRows,
+ aAxis == LogicalAxis::Inline ? &GridArea::mCols : &GridArea::mRows,
aConstraint);
if (hasSubgridItems &&
@@ -3976,9 +4000,9 @@ void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
void nsGridContainerFrame::GridReflowInput::CalculateTrackSizes(
const Grid& aGrid, const LogicalSize& aContentBox,
SizingConstraint aConstraint) {
- CalculateTrackSizesForAxis(eLogicalAxisInline, aGrid, aContentBox.ISize(mWM),
+ CalculateTrackSizesForAxis(LogicalAxis::Inline, aGrid, aContentBox.ISize(mWM),
aConstraint);
- CalculateTrackSizesForAxis(eLogicalAxisBlock, aGrid, aContentBox.BSize(mWM),
+ CalculateTrackSizesForAxis(LogicalAxis::Block, aGrid, aContentBox.BSize(mWM),
aConstraint);
}
@@ -3999,7 +4023,7 @@ static void AlignJustifySelf(StyleAlignFlags aAlignment, LogicalAxis aAxis,
// Set the position (aPos) for the requested alignment.
if (offset != 0) {
WritingMode wm = aRI.GetWritingMode();
- nscoord& pos = aAxis == eLogicalAxisBlock ? aPos->B(wm) : aPos->I(wm);
+ nscoord& pos = aAxis == LogicalAxis::Block ? aPos->B(wm) : aPos->I(wm);
pos += MOZ_LIKELY(aFlags & AlignJustifyFlags::SameSide) ? offset : -offset;
}
}
@@ -4016,7 +4040,7 @@ static void AlignSelf(const nsGridContainerFrame::GridItemInfo& aGridItem,
aAlignSelf &= ~StyleAlignFlags::FLAG_BITS;
WritingMode childWM = aRI.GetWritingMode();
- if (aCBWM.ParallelAxisStartsOnSameSide(eLogicalAxisBlock, childWM)) {
+ if (aCBWM.ParallelAxisStartsOnSameSide(LogicalAxis::Block, childWM)) {
flags |= AlignJustifyFlags::SameSide;
}
@@ -4032,12 +4056,12 @@ static void AlignSelf(const nsGridContainerFrame::GridItemInfo& aGridItem,
nscoord baselineAdjust = 0;
if (aAlignSelf == StyleAlignFlags::BASELINE ||
aAlignSelf == StyleAlignFlags::LAST_BASELINE) {
- aAlignSelf = aGridItem.GetSelfBaseline(aAlignSelf, eLogicalAxisBlock,
+ aAlignSelf = aGridItem.GetSelfBaseline(aAlignSelf, LogicalAxis::Block,
&baselineAdjust);
}
bool isOrthogonal = aCBWM.IsOrthogonalTo(childWM);
- LogicalAxis axis = isOrthogonal ? eLogicalAxisInline : eLogicalAxisBlock;
+ LogicalAxis axis = isOrthogonal ? LogicalAxis::Inline : LogicalAxis::Block;
AlignJustifySelf(aAlignSelf, axis, flags, baselineAdjust, aCBSize, aRI, aSize,
aPos);
}
@@ -4054,7 +4078,7 @@ static void JustifySelf(const nsGridContainerFrame::GridItemInfo& aGridItem,
aJustifySelf &= ~StyleAlignFlags::FLAG_BITS;
WritingMode childWM = aRI.GetWritingMode();
- if (aCBWM.ParallelAxisStartsOnSameSide(eLogicalAxisInline, childWM)) {
+ if (aCBWM.ParallelAxisStartsOnSameSide(LogicalAxis::Inline, childWM)) {
flags |= AlignJustifyFlags::SameSide;
}
@@ -4073,12 +4097,12 @@ static void JustifySelf(const nsGridContainerFrame::GridItemInfo& aGridItem,
aCBWM.IsBidiLTR() ? StyleAlignFlags::END : StyleAlignFlags::START;
} else if (aJustifySelf == StyleAlignFlags::BASELINE ||
aJustifySelf == StyleAlignFlags::LAST_BASELINE) {
- aJustifySelf = aGridItem.GetSelfBaseline(aJustifySelf, eLogicalAxisInline,
+ aJustifySelf = aGridItem.GetSelfBaseline(aJustifySelf, LogicalAxis::Inline,
&baselineAdjust);
}
bool isOrthogonal = aCBWM.IsOrthogonalTo(childWM);
- LogicalAxis axis = isOrthogonal ? eLogicalAxisBlock : eLogicalAxisInline;
+ LogicalAxis axis = isOrthogonal ? LogicalAxis::Block : LogicalAxis::Inline;
AlignJustifySelf(aJustifySelf, axis, flags, baselineAdjust, aCBSize, aRI,
aSize, aPos);
}
@@ -4245,8 +4269,8 @@ void nsGridContainerFrame::InitImplicitNamedAreas(
AddImplicitNamedAreas(aTemplate.AsSubgrid()->line_names.AsSpan());
}
};
- Add(aStyle->mGridTemplateColumns, IsSubgrid(eLogicalAxisInline));
- Add(aStyle->mGridTemplateRows, IsSubgrid(eLogicalAxisBlock));
+ Add(aStyle->mGridTemplateColumns, IsSubgrid(LogicalAxis::Inline));
+ Add(aStyle->mGridTemplateRows, IsSubgrid(LogicalAxis::Block));
if (areas && areas->count() == 0) {
RemoveProperty(ImplicitNamedAreasProperty());
}
@@ -4485,10 +4509,10 @@ nsGridContainerFrame::GridArea nsGridContainerFrame::Grid::PlaceDefinite(
const nsStylePosition* itemStyle = aChild->StylePosition();
return GridArea(
ResolveLineRange(itemStyle->mGridColumnStart, itemStyle->mGridColumnEnd,
- aColLineNameMap, eLogicalAxisInline, mExplicitGridColEnd,
- aStyle),
+ aColLineNameMap, LogicalAxis::Inline,
+ mExplicitGridColEnd, aStyle),
ResolveLineRange(itemStyle->mGridRowStart, itemStyle->mGridRowEnd,
- aRowLineNameMap, eLogicalAxisBlock, mExplicitGridRowEnd,
+ aRowLineNameMap, LogicalAxis::Block, mExplicitGridRowEnd,
aStyle));
}
@@ -4548,11 +4572,11 @@ nsGridContainerFrame::GridArea nsGridContainerFrame::Grid::PlaceAbsPos(
int32_t gridRowStart = 1 - mExplicitGridOffsetRow;
return GridArea(ResolveAbsPosLineRange(
itemStyle->mGridColumnStart, itemStyle->mGridColumnEnd,
- aColLineNameMap, eLogicalAxisInline, mExplicitGridColEnd,
+ aColLineNameMap, LogicalAxis::Inline, mExplicitGridColEnd,
gridColStart, mGridColEnd, aStyle),
ResolveAbsPosLineRange(
itemStyle->mGridRowStart, itemStyle->mGridRowEnd,
- aRowLineNameMap, eLogicalAxisBlock, mExplicitGridRowEnd,
+ aRowLineNameMap, LogicalAxis::Block, mExplicitGridRowEnd,
gridRowStart, mGridRowEnd, aStyle));
}
@@ -4736,10 +4760,10 @@ void nsGridContainerFrame::Grid::SubgridPlaceGridItems(
MOZ_ASSERT(aGridItem.mArea.IsDefinite() ||
aGridItem.mFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
"the subgrid's lines should be resolved by now");
- if (aGridItem.IsSubgrid(eLogicalAxisInline)) {
+ if (aGridItem.IsSubgrid(LogicalAxis::Inline)) {
aParentState.mFrame->AddStateBits(NS_STATE_GRID_HAS_COL_SUBGRID_ITEM);
}
- if (aGridItem.IsSubgrid(eLogicalAxisBlock)) {
+ if (aGridItem.IsSubgrid(LogicalAxis::Block)) {
aParentState.mFrame->AddStateBits(NS_STATE_GRID_HAS_ROW_SUBGRID_ITEM);
}
auto* childGrid = aGridItem.SubgridFrame();
@@ -4787,11 +4811,11 @@ void nsGridContainerFrame::Grid::SubgridPlaceGridItems(
// computing them otherwise.
RepeatTrackSizingInput repeatSizing(state.mWM);
if (!childGrid->IsColSubgrid() && state.mColFunctions.mHasRepeatAuto) {
- repeatSizing.InitFromStyle(eLogicalAxisInline, state.mWM,
+ repeatSizing.InitFromStyle(LogicalAxis::Inline, state.mWM,
state.mFrame->Style());
}
if (!childGrid->IsRowSubgrid() && state.mRowFunctions.mHasRepeatAuto) {
- repeatSizing.InitFromStyle(eLogicalAxisBlock, state.mWM,
+ repeatSizing.InitFromStyle(LogicalAxis::Block, state.mWM,
state.mFrame->Style());
}
@@ -4812,8 +4836,8 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
if (aState.mFrame->HasSubgridItems() || aState.mFrame->IsSubgrid()) {
if (auto* uts = aState.mFrame->GetUsedTrackSizes()) {
uts->mCanResolveLineRangeSize = {false, false};
- uts->mSizes[eLogicalAxisInline].ClearAndRetainStorage();
- uts->mSizes[eLogicalAxisBlock].ClearAndRetainStorage();
+ uts->mSizes[LogicalAxis::Inline].ClearAndRetainStorage();
+ uts->mSizes[LogicalAxis::Block].ClearAndRetainStorage();
}
}
@@ -4847,11 +4871,11 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
uint32_t extent = subgridRange->Extent();
mExplicitGridColEnd = extent + 1; // the grid is 1-based at this point
parentLineNameMap =
- ParentLineMapForAxis(subgrid->mIsOrthogonal, eLogicalAxisInline);
+ ParentLineMapForAxis(subgrid->mIsOrthogonal, LogicalAxis::Inline);
auto parentWM =
aState.mFrame->ParentGridContainerForSubgrid()->GetWritingMode();
subgridAxisIsSameDirection =
- aState.mWM.ParallelAxisStartsOnSameSide(eLogicalAxisInline, parentWM);
+ aState.mWM.ParallelAxisStartsOnSameSide(LogicalAxis::Inline, parentWM);
}
mGridColEnd = mExplicitGridColEnd;
LineNameMap colLineNameMap(gridStyle, mAreas, aState.mColFunctions,
@@ -4882,11 +4906,11 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
uint32_t extent = subgridRange->Extent();
mExplicitGridRowEnd = extent + 1; // the grid is 1-based at this point
parentLineNameMap =
- ParentLineMapForAxis(subgrid->mIsOrthogonal, eLogicalAxisBlock);
+ ParentLineMapForAxis(subgrid->mIsOrthogonal, LogicalAxis::Block);
auto parentWM =
aState.mFrame->ParentGridContainerForSubgrid()->GetWritingMode();
subgridAxisIsSameDirection =
- aState.mWM.ParallelAxisStartsOnSameSide(eLogicalAxisBlock, parentWM);
+ aState.mWM.ParallelAxisStartsOnSameSide(LogicalAxis::Block, parentWM);
}
mGridRowEnd = mExplicitGridRowEnd;
LineNameMap rowLineNameMap(gridStyle, mAreas, aState.mRowFunctions,
@@ -4900,16 +4924,16 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
if (isSubgridOrItemInSubgrid) {
const auto& area = aItem.mArea;
if (area.mCols.mStart == 0) {
- aItem.mState[eLogicalAxisInline] |= ItemState::eStartEdge;
+ aItem.mState[LogicalAxis::Inline] |= ItemState::eStartEdge;
}
if (area.mCols.mEnd == mGridColEnd) {
- aItem.mState[eLogicalAxisInline] |= ItemState::eEndEdge;
+ aItem.mState[LogicalAxis::Inline] |= ItemState::eEndEdge;
}
if (area.mRows.mStart == 0) {
- aItem.mState[eLogicalAxisBlock] |= ItemState::eStartEdge;
+ aItem.mState[LogicalAxis::Block] |= ItemState::eStartEdge;
}
if (area.mRows.mEnd == mGridRowEnd) {
- aItem.mState[eLogicalAxisBlock] |= ItemState::eEndEdge;
+ aItem.mState[LogicalAxis::Block] |= ItemState::eEndEdge;
}
}
};
@@ -4945,8 +4969,8 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
aState.mRowFunctions.mExplicitGridOffset = mExplicitGridOffsetRow;
const int32_t offsetToColZero = int32_t(mExplicitGridOffsetCol) - 1;
const int32_t offsetToRowZero = int32_t(mExplicitGridOffsetRow) - 1;
- const bool isRowMasonry = aState.mFrame->IsMasonry(eLogicalAxisBlock);
- const bool isColMasonry = aState.mFrame->IsMasonry(eLogicalAxisInline);
+ const bool isRowMasonry = aState.mFrame->IsMasonry(LogicalAxis::Block);
+ const bool isColMasonry = aState.mFrame->IsMasonry(LogicalAxis::Inline);
const bool isMasonry = isColMasonry || isRowMasonry;
mGridColEnd += offsetToColZero;
mGridRowEnd += offsetToRowZero;
@@ -5100,7 +5124,7 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
// Force all items into the 1st/2nd track and have span 1 in the masonry axis.
// (See comment on nsGridContainerFrame::MasonryLayout().)
if (isMasonry) {
- auto masonryAxis = isRowMasonry ? eLogicalAxisBlock : eLogicalAxisInline;
+ auto masonryAxis = isRowMasonry ? LogicalAxis::Block : LogicalAxis::Inline;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
auto& item = aState.mGridItems[aState.mIter.ItemIndex()];
@@ -5168,16 +5192,16 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
// An abs.pos. subgrid with placement auto/1 or -1/auto technically
// doesn't span any parent tracks. Inhibit subgridding in this case.
- if (info->IsSubgrid(eLogicalAxisInline)) {
+ if (info->IsSubgrid(LogicalAxis::Inline)) {
if (info->mArea.mCols.mStart == zeroOffsetGridColEnd.SavedValue() ||
info->mArea.mCols.mEnd == 0) {
- info->InhibitSubgrid(aState.mFrame, eLogicalAxisInline);
+ info->InhibitSubgrid(aState.mFrame, LogicalAxis::Inline);
}
}
- if (info->IsSubgrid(eLogicalAxisBlock)) {
+ if (info->IsSubgrid(LogicalAxis::Block)) {
if (info->mArea.mRows.mStart == zeroOffsetGridRowEnd.SavedValue() ||
info->mArea.mRows.mEnd == 0) {
- info->InhibitSubgrid(aState.mFrame, eLogicalAxisBlock);
+ info->InhibitSubgrid(aState.mFrame, LogicalAxis::Block);
}
}
@@ -5219,18 +5243,18 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
// Adjust the line numbers in the grid areas.
for (auto& item : aState.mGridItems) {
if (numEmptyCols) {
- item.AdjustForRemovedTracks(eLogicalAxisInline, *colAdjust);
+ item.AdjustForRemovedTracks(LogicalAxis::Inline, *colAdjust);
}
if (numEmptyRows) {
- item.AdjustForRemovedTracks(eLogicalAxisBlock, *rowAdjust);
+ item.AdjustForRemovedTracks(LogicalAxis::Block, *rowAdjust);
}
}
for (auto& item : aState.mAbsPosItems) {
if (numEmptyCols) {
- item.AdjustForRemovedTracks(eLogicalAxisInline, *colAdjust);
+ item.AdjustForRemovedTracks(LogicalAxis::Inline, *colAdjust);
}
if (numEmptyRows) {
- item.AdjustForRemovedTracks(eLogicalAxisBlock, *rowAdjust);
+ item.AdjustForRemovedTracks(LogicalAxis::Block, *rowAdjust);
}
}
// Adjust the grid size.
@@ -5258,11 +5282,11 @@ void nsGridContainerFrame::Grid::PlaceGridItems(
LineRange columnLines =
ResolveLineRange(lineStartAndEnd, lineStartAndEnd, colLineNameMap,
- eLogicalAxisInline, mExplicitGridColEnd, gridStyle);
+ LogicalAxis::Inline, mExplicitGridColEnd, gridStyle);
LineRange rowLines =
ResolveLineRange(lineStartAndEnd, lineStartAndEnd, rowLineNameMap,
- eLogicalAxisBlock, mExplicitGridRowEnd, gridStyle);
+ LogicalAxis::Block, mExplicitGridRowEnd, gridStyle);
// Put the resolved line indices back into the area structure.
areaInfo.columns.start = columnLines.mStart + mExplicitGridOffsetCol;
@@ -5322,7 +5346,7 @@ static nscoord MeasuringReflow(nsIFrame* aChild,
ComputeSizeFlags csFlags = ComputeSizeFlag::IsGridMeasuringReflow;
// Shrink-wrap grid items that will be aligned (rather than stretched) in
// their own inline axis.
- if (!parent->GridItemShouldStretch(aChild, eLogicalAxisInline)) {
+ if (!parent->GridItemShouldStretch(aChild, LogicalAxis::Inline)) {
csFlags += ComputeSizeFlag::ShrinkWrap;
}
if (aAvailableSize.ISize(wm) == INFINITE_ISIZE_COORD) {
@@ -5434,7 +5458,7 @@ static void PostReflowStretchChild(
}
ReflowInput ri(pc, aReflowInput, aChild, aAvailableSize, Some(aCBSize), {},
{}, csFlags);
- if (aChildAxis == eLogicalAxisBlock) {
+ if (aChildAxis == LogicalAxis::Block) {
ri.SetComputedBSize(ri.ApplyMinMaxBSize(aNewContentBoxSize));
} else {
ri.SetComputedISize(ri.ApplyMinMaxISize(aNewContentBoxSize));
@@ -5542,18 +5566,18 @@ static nscoord ContentContribution(
auto subgridAxis = aCBWM.IsOrthogonalTo(subgridFrame->GetWritingMode())
? GetOrthogonalAxis(aAxis)
: aAxis;
- auto& gapStyle = subgridAxis == eLogicalAxisBlock
+ auto& gapStyle = subgridAxis == LogicalAxis::Block
? subgridFrame->StylePosition()->mRowGap
: subgridFrame->StylePosition()->mColumnGap;
if (!gapStyle.IsNormal()) {
- auto subgridExtent = subgridAxis == eLogicalAxisBlock
+ auto subgridExtent = subgridAxis == LogicalAxis::Block
? subgrid->mGridRowEnd
: subgrid->mGridColEnd;
if (subgridExtent > 1) {
nscoord subgridGap =
nsLayoutUtils::ResolveGapToLength(gapStyle, NS_UNCONSTRAINEDSIZE);
auto& tracks =
- aAxis == eLogicalAxisBlock ? aState.mRows : aState.mCols;
+ aAxis == LogicalAxis::Block ? aState.mRows : aState.mCols;
auto gapDelta = subgridGap - tracks.mGridGap;
if (!itemEdgeBits) {
extraMargin += gapDelta;
@@ -5572,7 +5596,7 @@ static nscoord ContentContribution(
auto childWM = child->GetWritingMode();
const bool isOrthogonal = childWM.IsOrthogonalTo(aCBWM);
auto childAxis = isOrthogonal ? GetOrthogonalAxis(aAxis) : aAxis;
- if (size == NS_INTRINSIC_ISIZE_UNKNOWN && childAxis == eLogicalAxisBlock) {
+ if (size == NS_INTRINSIC_ISIZE_UNKNOWN && childAxis == LogicalAxis::Block) {
// We need to reflow the child to find its BSize contribution.
// XXX this will give mostly correct results for now (until bug 1174569).
nscoord availISize = INFINITE_ISIZE_COORD;
@@ -5595,8 +5619,8 @@ static nscoord ContentContribution(
}
// The grid-item's inline-axis as expressed in the subgrid's WM.
auto subgridAxis = childWM.IsOrthogonalTo(subgridFrame->GetWritingMode())
- ? eLogicalAxisBlock
- : eLogicalAxisInline;
+ ? LogicalAxis::Block
+ : LogicalAxis::Inline;
uts->ResolveTrackSizesForAxis(subgridFrame, subgridAxis, *aRC);
if (uts->mCanResolveLineRangeSize[subgridAxis]) {
auto* subgrid =
@@ -5642,7 +5666,7 @@ static nscoord ContentContribution(
}
}
}
- if (isOrthogonal == (aAxis == eLogicalAxisInline)) {
+ if (isOrthogonal == (aAxis == LogicalAxis::Inline)) {
bMinSizeClamp = aMinSizeClamp;
} else {
iMinSizeClamp = aMinSizeClamp;
@@ -5739,7 +5763,8 @@ static nscoord MinSize(const GridItemInfo& aGridItem,
StyleSize sizeStyle =
axis == eAxisHorizontal ? stylePos->mWidth : stylePos->mHeight;
- auto ourInlineAxis = child->GetWritingMode().PhysicalAxis(eLogicalAxisInline);
+ auto ourInlineAxis =
+ child->GetWritingMode().PhysicalAxis(LogicalAxis::Inline);
// max-content and min-content should behave as initial value in block axis.
// FIXME: Bug 567039: moz-fit-content and -moz-available are not supported
// for block size dimension on sizing properties (e.g. height), so we
@@ -6006,7 +6031,7 @@ void nsGridContainerFrame::Tracks::InitializeItemBaselines(
const auto childWM = child->GetWritingMode();
const bool isOrthogonal = containerWM.IsOrthogonalTo(childWM);
- const bool isInlineAxis = mAxis == eLogicalAxisInline; // i.e. columns
+ const bool isInlineAxis = mAxis == LogicalAxis::Inline; // i.e. columns
// XXX update the line below to include orthogonal grid/table boxes
// XXX since they have baselines in both dimensions. And flexbox with
@@ -6281,7 +6306,7 @@ void nsGridContainerFrame::Tracks::InitializeItemBaselinesInMasonryAxis(
auto state = ItemState(0);
auto childWM = child->GetWritingMode();
const bool isOrthogonal = wm.IsOrthogonalTo(childWM);
- const bool isInlineAxis = mAxis == eLogicalAxisInline; // i.e. columns
+ const bool isInlineAxis = mAxis == LogicalAxis::Inline; // i.e. columns
// XXX update the line below to include orthogonal grid/table boxes
// XXX since they have baselines in both dimensions. And flexbox with
// XXX reversed main/cross axis?
@@ -6449,10 +6474,10 @@ void nsGridContainerFrame::Tracks::AlignBaselineSubtree(
const bool isFirstBaseline = state & ItemState::eFirstBaseline;
if (isFirstBaseline) {
baselineTrack =
- mAxis == eLogicalAxisBlock ? area.mRows.mStart : area.mCols.mStart;
+ mAxis == LogicalAxis::Block ? area.mRows.mStart : area.mCols.mStart;
} else {
baselineTrack =
- (mAxis == eLogicalAxisBlock ? area.mRows.mEnd : area.mCols.mEnd) - 1;
+ (mAxis == LogicalAxis::Block ? area.mRows.mEnd : area.mCols.mEnd) - 1;
}
const TrackSize& sz = mSizes[baselineTrack];
auto baselineGroup = isFirstBaseline ? BaselineSharingGroup::First
@@ -6855,7 +6880,7 @@ float nsGridContainerFrame::Tracks::FindUsedFlexFraction(
nscoord spaceToFill = ContentContribution(item, aState, rc, wm, mAxis, pb,
IntrinsicISizeType::PrefISize);
const LineRange& range =
- mAxis == eLogicalAxisInline ? item.mArea.mCols : item.mArea.mRows;
+ mAxis == LogicalAxis::Inline ? item.mArea.mCols : item.mArea.mRows;
MOZ_ASSERT(range.Extent() >= 1);
const auto spannedGaps = range.Extent() - 1;
if (spannedGaps > 0) {
@@ -6898,10 +6923,10 @@ void nsGridContainerFrame::Tracks::StretchFlexibleTracks(
nscoord maxSize = NS_UNCONSTRAINEDSIZE;
if (aState.mReflowInput) {
auto* ri = aState.mReflowInput;
- minSize = mAxis == eLogicalAxisBlock ? ri->ComputedMinBSize()
- : ri->ComputedMinISize();
- maxSize = mAxis == eLogicalAxisBlock ? ri->ComputedMaxBSize()
- : ri->ComputedMaxISize();
+ minSize = mAxis == LogicalAxis::Block ? ri->ComputedMinBSize()
+ : ri->ComputedMinISize();
+ maxSize = mAxis == LogicalAxis::Block ? ri->ComputedMaxBSize()
+ : ri->ComputedMaxISize();
}
Maybe<CopyableAutoTArray<TrackSize, 32>> origSizes;
bool applyMinMax = (minSize != 0 || maxSize != NS_UNCONSTRAINEDSIZE) &&
@@ -6958,7 +6983,7 @@ void nsGridContainerFrame::Tracks::StretchFlexibleTracks(
void nsGridContainerFrame::Tracks::AlignJustifyContent(
const nsStylePosition* aStyle, StyleContentDistribution aAligmentStyleValue,
WritingMode aWM, nscoord aContentBoxSize, bool aIsSubgriddedAxis) {
- const bool isAlign = mAxis == eLogicalAxisBlock;
+ const bool isAlign = mAxis == LogicalAxis::Block;
// Align-/justify-content doesn't apply in a subgridded axis.
// Gap properties do apply though so we need to stretch/position the tracks
// to center-align the gaps with the parent's gaps.
@@ -7223,25 +7248,25 @@ LogicalSize nsGridContainerFrame::GridReflowInput::PercentageBasisFor(
if (auto* uts = subgridFrame->GetUsedTrackSizes()) {
auto subgridWM = subgridFrame->GetWritingMode();
LogicalSize cbSize(subgridWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
- if (!subgridFrame->IsSubgrid(eLogicalAxisInline) &&
- uts->mCanResolveLineRangeSize[eLogicalAxisInline]) {
+ if (!subgridFrame->IsSubgrid(LogicalAxis::Inline) &&
+ uts->mCanResolveLineRangeSize[LogicalAxis::Inline]) {
// NOTE: At this point aGridItem.mArea is in this->mFrame coordinates
// and thus may have been transposed. The range values in a non-
// subgridded axis still has its original values in subgridFrame's
// coordinates though.
- auto rangeAxis = subgridWM.IsOrthogonalTo(mWM) ? eLogicalAxisBlock
- : eLogicalAxisInline;
+ auto rangeAxis = subgridWM.IsOrthogonalTo(mWM) ? LogicalAxis::Block
+ : LogicalAxis::Inline;
const auto& range = aGridItem.mArea.LineRangeForAxis(rangeAxis);
cbSize.ISize(subgridWM) =
- range.ToLength(uts->mSizes[eLogicalAxisInline]);
+ range.ToLength(uts->mSizes[LogicalAxis::Inline]);
}
- if (!subgridFrame->IsSubgrid(eLogicalAxisBlock) &&
- uts->mCanResolveLineRangeSize[eLogicalAxisBlock]) {
- auto rangeAxis = subgridWM.IsOrthogonalTo(mWM) ? eLogicalAxisInline
- : eLogicalAxisBlock;
+ if (!subgridFrame->IsSubgrid(LogicalAxis::Block) &&
+ uts->mCanResolveLineRangeSize[LogicalAxis::Block]) {
+ auto rangeAxis = subgridWM.IsOrthogonalTo(mWM) ? LogicalAxis::Inline
+ : LogicalAxis::Block;
const auto& range = aGridItem.mArea.LineRangeForAxis(rangeAxis);
cbSize.BSize(subgridWM) =
- range.ToLength(uts->mSizes[eLogicalAxisBlock]);
+ range.ToLength(uts->mSizes[LogicalAxis::Block]);
}
return cbSize.ConvertTo(wm, subgridWM);
}
@@ -7249,7 +7274,7 @@ LogicalSize nsGridContainerFrame::GridReflowInput::PercentageBasisFor(
return LogicalSize(wm, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
}
- if (aAxis == eLogicalAxisInline || !mCols.mCanResolveLineRangeSize) {
+ if (aAxis == LogicalAxis::Inline || !mCols.mCanResolveLineRangeSize) {
return LogicalSize(wm, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
}
// Note: for now, we only resolve transferred percentages to row sizing.
@@ -7428,7 +7453,7 @@ void nsGridContainerFrame::GridReflowInput::AlignJustifyTracksInMasonryAxis(
ContainingBlockFor(item->mArea).Size(wm).ConvertTo(childWM, wm);
LogicalSize availableSize = cb;
cb.Size(masonryChildAxis, childWM) = alignmentContainerSize;
- availableSize.Size(eLogicalAxisBlock, childWM) =
+ availableSize.Size(LogicalAxis::Block, childWM) =
NS_UNCONSTRAINEDSIZE;
const auto& bp = child->GetLogicalUsedBorderAndPadding(childWM);
newSize -= bp.StartEnd(masonryChildAxis, childWM);
@@ -7626,9 +7651,9 @@ void nsGridContainerFrame::ReflowInFlowChild(
aChild->RemoveProperty(aProp);
}
};
- SetProp(eLogicalAxisBlock,
+ SetProp(LogicalAxis::Block,
isOrthogonal ? IBaselinePadProperty() : BBaselinePadProperty());
- SetProp(eLogicalAxisInline,
+ SetProp(LogicalAxis::Inline,
isOrthogonal ? BBaselinePadProperty() : IBaselinePadProperty());
} else {
// By convention, for frames that perform CSS Box Alignment, we position
@@ -7654,9 +7679,9 @@ void nsGridContainerFrame::ReflowInFlowChild(
ComputeSizeFlags csFlags;
if (aGridItemInfo) {
const auto childIAxisInWM =
- isOrthogonal ? eLogicalAxisBlock : eLogicalAxisInline;
+ isOrthogonal ? LogicalAxis::Block : LogicalAxis::Inline;
// Clamp during reflow if we're stretching in that axis.
- if (GridItemShouldStretch(aChild, eLogicalAxisInline)) {
+ if (GridItemShouldStretch(aChild, LogicalAxis::Inline)) {
if (aGridItemInfo->mState[childIAxisInWM] &
ItemState::eClampMarginBoxMinSize) {
csFlags += ComputeSizeFlag::IClampMarginBoxMinSize;
@@ -7666,7 +7691,7 @@ void nsGridContainerFrame::ReflowInFlowChild(
}
const auto childBAxisInWM = GetOrthogonalAxis(childIAxisInWM);
- if (GridItemShouldStretch(aChild, eLogicalAxisBlock) &&
+ if (GridItemShouldStretch(aChild, LogicalAxis::Block) &&
aGridItemInfo->mState[childBAxisInWM] &
ItemState::eClampMarginBoxMinSize) {
csFlags += ComputeSizeFlag::BClampMarginBoxMinSize;
@@ -7702,7 +7727,7 @@ void nsGridContainerFrame::ReflowInFlowChild(
// nsBlockFrame::ComputeFinalSize the size.
if (isConstrainedBSize && !wm.IsOrthogonalTo(childWM)) {
const bool stretch = childRI.mStylePosition->BSize(childWM).IsAuto() &&
- GridItemShouldStretch(aChild, eLogicalAxisBlock);
+ GridItemShouldStretch(aChild, LogicalAxis::Block);
if (stretch) {
aChild->SetProperty(FragStretchBSizeProperty(), *aStretchBSize);
} else {
@@ -7750,7 +7775,7 @@ void nsGridContainerFrame::ReflowInFlowChild(
? StyleAlignFlags::SELF_START
: StyleAlignFlags::SELF_END};
}
- if (aAxis == eLogicalAxisBlock) {
+ if (aAxis == LogicalAxis::Block) {
AlignSelf(*aGridItemInfo, align, aCBSize, wm, childRI, size, flags,
&childPos);
} else {
@@ -7759,10 +7784,10 @@ void nsGridContainerFrame::ReflowInFlowChild(
}
};
if (aStatus.IsComplete()) {
- applyItemSelfAlignment(eLogicalAxisBlock,
+ applyItemSelfAlignment(LogicalAxis::Block,
cb.BSize(wm) - consumedGridAreaBSize);
}
- applyItemSelfAlignment(eLogicalAxisInline, cb.ISize(wm));
+ applyItemSelfAlignment(LogicalAxis::Inline, cb.ISize(wm));
} // else, nsAbsoluteContainingBlock.cpp will handle align/justify-self.
FinishReflowChild(aChild, pc, childSize, &childRI, childWM, childPos,
@@ -8006,7 +8031,7 @@ nscoord nsGridContainerFrame::ReflowRowsInFragmentainer(
const auto rowCount = aState.mRows.mSizes.Length();
nscoord masonryAxisGap;
const auto wm = aState.mWM;
- const bool isColMasonry = IsMasonry(eLogicalAxisInline);
+ const bool isColMasonry = IsMasonry(LogicalAxis::Inline);
if (isColMasonry) {
for (auto& sz : aState.mCols.mSizes) {
sz.mPosition = 0;
@@ -8174,15 +8199,15 @@ nscoord nsGridContainerFrame::ReflowRowsInFragmentainer(
}
if (isColMasonry) {
auto childWM = child->GetWritingMode();
- auto childAxis =
- !childWM.IsOrthogonalTo(wm) ? eLogicalAxisInline : eLogicalAxisBlock;
+ auto childAxis = !childWM.IsOrthogonalTo(wm) ? LogicalAxis::Inline
+ : LogicalAxis::Block;
auto normalPos = child->GetLogicalNormalPosition(wm, aContainerSize);
auto sz =
- childAxis == eLogicalAxisBlock ? child->BSize() : child->ISize();
- auto pos = normalPos.Pos(eLogicalAxisInline, wm) + sz +
+ childAxis == LogicalAxis::Block ? child->BSize() : child->ISize();
+ auto pos = normalPos.Pos(LogicalAxis::Inline, wm) + sz +
child->GetLogicalUsedMargin(childWM).End(childAxis, childWM);
masonryAxisPos.ref()[row] =
- pos + masonryAxisGap - aContentArea.Start(eLogicalAxisInline, wm);
+ pos + masonryAxisGap - aContentArea.Start(LogicalAxis::Inline, wm);
}
}
@@ -8281,7 +8306,7 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
aState.mIter.Reset(CSSOrderAwareFrameIterator::ChildFilter::IncludeAll);
size_t absposIndex = 0;
const LogicalAxis masonryAxis =
- IsMasonry(eLogicalAxisBlock) ? eLogicalAxisBlock : eLogicalAxisInline;
+ IsMasonry(LogicalAxis::Block) ? LogicalAxis::Block : LogicalAxis::Inline;
const auto wm = aState.mWM;
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
@@ -8323,7 +8348,7 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
const auto masonryAutoFlow = aState.mGridStyle->mMasonryAutoFlow;
const bool definiteFirst =
masonryAutoFlow.order == StyleMasonryItemOrder::DefiniteFirst;
- if (masonryAxis == eLogicalAxisBlock) {
+ if (masonryAxis == LogicalAxis::Block) {
std::stable_sort(sortedItems.begin(), sortedItems.end(),
definiteFirst ? GridItemInfo::RowMasonryDefiniteFirst
: GridItemInfo::RowMasonryOrdered);
@@ -8366,8 +8391,8 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
lastItems.SetLength(gridAxisTrackCount);
PodZero(lastItems.Elements(), gridAxisTrackCount);
const nscoord gap = nsLayoutUtils::ResolveGapToLength(
- masonryAxis == eLogicalAxisBlock ? aState.mGridStyle->mRowGap
- : aState.mGridStyle->mColumnGap,
+ masonryAxis == LogicalAxis::Block ? aState.mGridStyle->mRowGap
+ : aState.mGridStyle->mColumnGap,
masonryTracks.mContentBoxSize);
masonryTracks.mGridGap = gap;
uint32_t cursor = 0;
@@ -8495,7 +8520,7 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
auto childAxis = !childWM.IsOrthogonalTo(wm) ? masonryAxis : gridAxis;
auto normalPos = aChild->GetLogicalNormalPosition(wm, aContainerSize);
auto sz =
- childAxis == eLogicalAxisBlock ? aChild->BSize() : aChild->ISize();
+ childAxis == LogicalAxis::Block ? aChild->BSize() : aChild->ISize();
return containerToMasonryBoxOffset + normalPos.Pos(masonryAxis, wm) + sz +
aChild->GetLogicalUsedMargin(childWM).End(childAxis, childWM);
};
@@ -8668,7 +8693,7 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
consumeAllSpace ? toFragmentainerEnd : offsetToMarginBoxEnd(child);
} else {
LogicalSize percentBasis(
- aState.PercentageBasisFor(eLogicalAxisInline, *item));
+ aState.PercentageBasisFor(LogicalAxis::Inline, *item));
IntrinsicISizeType type = aConstraint == SizingConstraint::MaxContent
? IntrinsicISizeType::PrefISize
: IntrinsicISizeType::MinISize;
@@ -8775,19 +8800,19 @@ nscoord nsGridContainerFrame::ReflowChildren(GridReflowInput& aState,
// so we let ReflowInFragmentainer() deal with grid-axis fragmentation
// in the else-clause below.
if (IsMasonry() &&
- !(IsMasonry(eLogicalAxisInline) && fragmentainer.isSome())) {
+ !(IsMasonry(LogicalAxis::Inline) && fragmentainer.isSome())) {
aState.mInFragmentainer = fragmentainer.isSome();
nscoord sz = MasonryLayout(
aState, aContentArea, SizingConstraint::NoConstraint, aDesiredSize,
aStatus, fragmentainer.ptrOr(nullptr), aContainerSize);
- if (IsMasonry(eLogicalAxisBlock)) {
+ if (IsMasonry(LogicalAxis::Block)) {
bSize = aState.mReflowInput->ComputedBSize();
if (bSize == NS_UNCONSTRAINEDSIZE) {
bSize = aState.mReflowInput->ApplyMinMaxBSize(sz);
}
}
} else if (MOZ_UNLIKELY(fragmentainer.isSome())) {
- if (IsMasonry(eLogicalAxisInline) && !GetPrevInFlow()) {
+ if (IsMasonry(LogicalAxis::Inline) && !GetPrevInFlow()) {
// First we do an unconstrained reflow to resolve the item placement
// which is then kept as-is in the constrained reflow below.
MasonryLayout(aState, aContentArea, SizingConstraint::NoConstraint,
@@ -8804,10 +8829,12 @@ nscoord nsGridContainerFrame::ReflowChildren(GridReflowInput& aState,
if (!child->IsPlaceholderFrame()) {
info = &aState.mGridItems[aState.mIter.ItemIndex()];
}
+ nsReflowStatus childStatus;
ReflowInFlowChild(child, info, aContainerSize, Nothing(), nullptr, aState,
- aContentArea, aDesiredSize, aStatus);
- MOZ_ASSERT(aStatus.IsComplete(),
+ aContentArea, aDesiredSize, childStatus);
+ MOZ_ASSERT(childStatus.IsComplete(),
"child should be complete in unconstrained reflow");
+ aStatus.MergeCompletionStatusFrom(childStatus);
}
}
@@ -8868,7 +8895,6 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsGridContainerFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
if (IsFrameTreeTooDeep(aReflowInput, aDesiredSize, aStatus)) {
@@ -8952,11 +8978,11 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
if (containBSize) {
bSize = *containBSize;
} else {
- if (IsMasonry(eLogicalAxisBlock)) {
+ if (IsMasonry(LogicalAxis::Block)) {
bSize = computedBSize;
} else {
const auto& rowSizes = gridReflowInput.mRows.mSizes;
- if (MOZ_LIKELY(!IsSubgrid(eLogicalAxisBlock))) {
+ if (MOZ_LIKELY(!IsSubgrid(LogicalAxis::Block))) {
// Note: we can't use GridLineEdge here since we haven't calculated
// the rows' mPosition yet (happens in AlignJustifyContent below).
for (const auto& sz : rowSizes) {
@@ -9025,7 +9051,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
}
// Save the final row sizes for use by subgrids, if needed.
if (HasSubgridItems() || IsSubgrid()) {
- StoreUsedTrackSizes(eLogicalAxisBlock, rowSizes);
+ StoreUsedTrackSizes(LogicalAxis::Block, rowSizes);
}
}
@@ -9122,8 +9148,8 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
}
// TODO: fix align-tracks alignment in fragments
- if ((IsMasonry(eLogicalAxisBlock) && !prevInFlow) ||
- IsMasonry(eLogicalAxisInline)) {
+ if ((IsMasonry(LogicalAxis::Block) && !prevInFlow) ||
+ IsMasonry(LogicalAxis::Inline)) {
gridReflowInput.AlignJustifyTracksInMasonryAxis(
contentArea.Size(wm), aDesiredSize.PhysicalSize());
}
@@ -9221,7 +9247,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// the ComputedGridTrackInfo and related properties
const auto* subgrid = GetProperty(Subgrid::Prop());
- const auto* subgridColRange = subgrid && IsSubgrid(eLogicalAxisInline)
+ const auto* subgridColRange = subgrid && IsSubgrid(LogicalAxis::Inline)
? &subgrid->SubgridCols()
: nullptr;
@@ -9252,7 +9278,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// taken by rvalue, but computing the size first prevents any changes in the
// argument types of the constructor from breaking this.
const uint32_t numColExplicitTracks =
- IsSubgrid(eLogicalAxisInline)
+ IsSubgrid(LogicalAxis::Inline)
? colTrackSizes.Length()
: gridReflowInput.mColFunctions.NumExplicitTracks();
ComputedGridTrackInfo* colInfo = new ComputedGridTrackInfo(
@@ -9261,10 +9287,10 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
std::move(colTrackStates), std::move(colRemovedRepeatTracks),
gridReflowInput.mColFunctions.mRepeatAutoStart,
colLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo(),
- IsSubgrid(eLogicalAxisInline), IsMasonry(eLogicalAxisInline));
+ IsSubgrid(LogicalAxis::Inline), IsMasonry(LogicalAxis::Inline));
SetProperty(GridColTrackInfo(), colInfo);
- const auto* subgridRowRange = subgrid && IsSubgrid(eLogicalAxisBlock)
+ const auto* subgridRowRange = subgrid && IsSubgrid(LogicalAxis::Block)
? &subgrid->SubgridRows()
: nullptr;
LineNameMap rowLineNameMap(
@@ -9294,7 +9320,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
// taken by rvalue, but computing the size first prevents any changes in the
// argument types of the constructor from breaking this.
const uint32_t numRowExplicitTracks =
- IsSubgrid(eLogicalAxisBlock)
+ IsSubgrid(LogicalAxis::Block)
? rowTrackSizes.Length()
: gridReflowInput.mRowFunctions.NumExplicitTracks();
// Row info has to accommodate fragmentation of the grid, which may happen
@@ -9307,7 +9333,7 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
std::move(rowRemovedRepeatTracks),
gridReflowInput.mRowFunctions.mRepeatAutoStart,
rowLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo(),
- IsSubgrid(eLogicalAxisBlock), IsMasonry(eLogicalAxisBlock));
+ IsSubgrid(LogicalAxis::Block), IsMasonry(LogicalAxis::Block));
SetProperty(GridRowTrackInfo(), rowInfo);
if (prevInFlow) {
@@ -9613,16 +9639,16 @@ nscoord nsGridContainerFrame::IntrinsicISize(gfxContext* aRenderingContext,
// They're only used for auto-repeat so we skip computing them otherwise.
RepeatTrackSizingInput repeatSizing(state.mWM);
if (!IsColSubgrid() && state.mColFunctions.mHasRepeatAuto) {
- repeatSizing.InitFromStyle(eLogicalAxisInline, state.mWM,
+ repeatSizing.InitFromStyle(LogicalAxis::Inline, state.mWM,
state.mFrame->Style());
}
if ((!IsRowSubgrid() && state.mRowFunctions.mHasRepeatAuto &&
!(state.mGridStyle->mGridAutoFlow & StyleGridAutoFlow::ROW)) ||
- IsMasonry(eLogicalAxisInline)) {
+ IsMasonry(LogicalAxis::Inline)) {
// Only 'grid-auto-flow:column' can create new implicit columns, so that's
// the only case where our block-size can affect the number of columns.
// Masonry layout always depends on how many rows we have though.
- repeatSizing.InitFromStyle(eLogicalAxisBlock, state.mWM,
+ repeatSizing.InitFromStyle(LogicalAxis::Block, state.mWM,
state.mFrame->Style());
}
@@ -9640,13 +9666,13 @@ nscoord nsGridContainerFrame::IntrinsicISize(gfxContext* aRenderingContext,
auto constraint = aType == IntrinsicISizeType::MinISize
? SizingConstraint::MinContent
: SizingConstraint::MaxContent;
- if (IsMasonry(eLogicalAxisInline)) {
+ if (IsMasonry(LogicalAxis::Inline)) {
ReflowOutput desiredSize(state.mWM);
nsSize containerSize;
LogicalRect contentArea(state.mWM);
nsReflowStatus status;
state.mRows.mSizes.SetLength(grid.mGridRowEnd);
- state.CalculateTrackSizesForAxis(eLogicalAxisInline, grid,
+ state.CalculateTrackSizesForAxis(LogicalAxis::Inline, grid,
NS_UNCONSTRAINEDSIZE, constraint);
return MasonryLayout(state, contentArea, constraint, desiredSize, status,
nullptr, containerSize);
@@ -9656,7 +9682,7 @@ nscoord nsGridContainerFrame::IntrinsicISize(gfxContext* aRenderingContext,
return nscoord(0);
}
- state.CalculateTrackSizesForAxis(eLogicalAxisInline, grid,
+ state.CalculateTrackSizesForAxis(LogicalAxis::Inline, grid,
NS_UNCONSTRAINEDSIZE, constraint);
if (MOZ_LIKELY(!IsSubgrid())) {
@@ -9672,7 +9698,6 @@ nscoord nsGridContainerFrame::GetMinISize(gfxContext* aRC) {
return f->GetMinISize(aRC);
}
- DISPLAY_MIN_INLINE_SIZE(this, mCachedMinISize);
if (mCachedMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
Maybe<nscoord> containISize = ContainIntrinsicISize();
mCachedMinISize = containISize
@@ -9688,7 +9713,6 @@ nscoord nsGridContainerFrame::GetPrefISize(gfxContext* aRC) {
return f->GetPrefISize(aRC);
}
- DISPLAY_PREF_INLINE_SIZE(this, mCachedPrefISize);
if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
Maybe<nscoord> containISize = ContainIntrinsicISize();
mCachedPrefISize = containISize
@@ -9770,7 +9794,7 @@ StyleAlignFlags nsGridContainerFrame::CSSAlignmentForAbsPosChild(
"This method should only be called for abspos children");
StyleAlignFlags alignment =
- (aLogicalAxis == eLogicalAxisInline)
+ (aLogicalAxis == LogicalAxis::Inline)
? aChildRI.mStylePosition->UsedJustifySelf(Style())._0
: aChildRI.mStylePosition->UsedAlignSelf(Style())._0;
@@ -9792,7 +9816,7 @@ StyleAlignFlags nsGridContainerFrame::CSSAlignmentForAbsPosChild(
alignment = StyleAlignFlags::END;
} else if (alignment == StyleAlignFlags::LEFT ||
alignment == StyleAlignFlags::RIGHT) {
- if (aLogicalAxis == eLogicalAxisInline) {
+ if (aLogicalAxis == LogicalAxis::Inline) {
const bool isLeft = (alignment == StyleAlignFlags::LEFT);
WritingMode wm = GetWritingMode();
alignment = (isLeft == wm.IsBidiLTR()) ? StyleAlignFlags::START
@@ -9827,7 +9851,7 @@ nscoord nsGridContainerFrame::SynthesizeBaseline(
nscoord start;
nscoord size;
- if (aAxis == eLogicalAxisBlock) {
+ if (aAxis == LogicalAxis::Block) {
start = child->GetLogicalNormalPosition(aCBWM, aCBPhysicalSize).B(aCBWM);
size = child->BSize(aCBWM);
if (grid && aGridOrderItem.mIsInEdgeTrack) {
@@ -9836,13 +9860,13 @@ nscoord nsGridContainerFrame::SynthesizeBaseline(
} else if (!isOrthogonal && aGridOrderItem.mIsInEdgeTrack) {
// This assertion is mostly for documentation purposes; it must hold,
// given the checks in our 'if' statements. (We know aAxis is
- // eLogicalAxisBlock, and isOrthogonal is false, which means childAxis
- // must be eLogicalAxisBlock). If instead we got here with a childAxis of
- // eLogicalAxisInline, then our call to
+ // LogicalAxis::Block, and isOrthogonal is false, which means childAxis
+ // must be LogicalAxis::Block). If instead we got here with a childAxis of
+ // LogicalAxis::Inline, then our call to
// Baseline::SynthesizeBaselineFromBorderBox might incorrectly think
// it makes sense to use a central baseline, in an axis where that
// doesn't make sense.
- MOZ_ASSERT(childAxis == eLogicalAxisBlock, "unexpected childAxis");
+ MOZ_ASSERT(childAxis == LogicalAxis::Block, "unexpected childAxis");
baseline = child
->GetNaturalBaselineBOffset(childWM, aGroup,
BaselineExportContext::Other)
@@ -9893,8 +9917,8 @@ void nsGridContainerFrame::CalculateBaselines(
} else if (firstBaseline == NS_INTRINSIC_ISIZE_UNKNOWN) {
FindItemInGridOrderResult gridOrderFirstItem = FindFirstItemInGridOrder(
*aIter, *aGridItems,
- axis == eLogicalAxisBlock ? &GridArea::mRows : &GridArea::mCols,
- axis == eLogicalAxisBlock ? &GridArea::mCols : &GridArea::mRows,
+ axis == LogicalAxis::Block ? &GridArea::mRows : &GridArea::mCols,
+ axis == LogicalAxis::Block ? &GridArea::mCols : &GridArea::mRows,
aFragmentStartTrack);
mBaseline[axis][BaselineSharingGroup::First] = SynthesizeBaseline(
gridOrderFirstItem, axis, BaselineSharingGroup::First, aCBPhysicalSize,
@@ -9929,8 +9953,8 @@ void nsGridContainerFrame::CalculateBaselines(
iter.SetItemCount(aGridItems->Length());
FindItemInGridOrderResult gridOrderLastItem = FindLastItemInGridOrder(
iter, *aGridItems,
- axis == eLogicalAxisBlock ? &GridArea::mRows : &GridArea::mCols,
- axis == eLogicalAxisBlock ? &GridArea::mCols : &GridArea::mRows,
+ axis == LogicalAxis::Block ? &GridArea::mRows : &GridArea::mCols,
+ axis == LogicalAxis::Block ? &GridArea::mCols : &GridArea::mRows,
aFragmentStartTrack, aFirstExcludedTrack);
mBaseline[axis][BaselineSharingGroup::Last] =
SynthesizeBaseline(gridOrderLastItem, axis, BaselineSharingGroup::Last,
@@ -10124,7 +10148,7 @@ bool nsGridContainerFrame::GridItemShouldStretch(const nsIFrame* aChild,
}
const auto* pos = aChild->StylePosition();
- const auto alignment = (aAxis == eLogicalAxisInline) == !isOrthogonal
+ const auto alignment = (aAxis == LogicalAxis::Inline) == !isOrthogonal
? pos->UsedJustifySelf(Style())._0
: pos->UsedAlignSelf(Style())._0;
return alignment == StyleAlignFlags::NORMAL ||