Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 98b320f

Browse files
committed
Backed out 7 changesets (bug 1923763) for causing build bustages in nsStyleStruct.cpp. CLOSED TREE
Backed out changeset d55070e64ced (bug 1923763) Backed out changeset a92a0bc6047f (bug 1923763) Backed out changeset 2203e2c5268e (bug 1923763) Backed out changeset 0cc5e744c01a (bug 1923763) Backed out changeset d2139afa933b (bug 1923763) Backed out changeset 93e59980eac1 (bug 1923763) Backed out changeset 8018734b5491 (bug 1923763)
1 parent d94e1b8 commit 98b320f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+319
-1060
lines changed

layout/base/PresShell.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,10 +3793,8 @@ bool PresShell::ScrollFrameIntoView(
37933793
// If we're targetting a sticky element, make sure not to apply
37943794
// scroll-padding on the direction we're stuck.
37953795
const auto* stylePosition = aFrame->StylePosition();
3796-
const auto positionProperty = aFrame->StyleDisplay()->mPosition;
37973796
for (auto side : AllPhysicalSides()) {
3798-
if (stylePosition->GetAnchorResolvedInset(side, positionProperty)
3799-
.IsAuto()) {
3797+
if (stylePosition->GetInset(side).IsAuto()) {
38003798
continue;
38013799
}
38023800
// See if this axis is stuck.

layout/base/nsLayoutUtils.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,24 +1263,16 @@ SideBits nsLayoutUtils::GetSideBitsForFixedPositionContent(
12631263
SideBits sides = SideBits::eNone;
12641264
if (aFixedPosFrame) {
12651265
const nsStylePosition* position = aFixedPosFrame->StylePosition();
1266-
if (!position
1267-
->GetAnchorResolvedInset(eSideRight, StylePositionProperty::Fixed)
1268-
.IsAuto()) {
1266+
if (!position->GetInset(eSideRight).IsAuto()) {
12691267
sides |= SideBits::eRight;
12701268
}
1271-
if (!position
1272-
->GetAnchorResolvedInset(eSideLeft, StylePositionProperty::Fixed)
1273-
.IsAuto()) {
1269+
if (!position->GetInset(eSideLeft).IsAuto()) {
12741270
sides |= SideBits::eLeft;
12751271
}
1276-
if (!position
1277-
->GetAnchorResolvedInset(eSideBottom, StylePositionProperty::Fixed)
1278-
.IsAuto()) {
1272+
if (!position->GetInset(eSideBottom).IsAuto()) {
12791273
sides |= SideBits::eBottom;
12801274
}
1281-
if (!position
1282-
->GetAnchorResolvedInset(eSideTop, StylePositionProperty::Fixed)
1283-
.IsAuto()) {
1275+
if (!position->GetInset(eSideTop).IsAuto()) {
12841276
sides |= SideBits::eTop;
12851277
}
12861278
}

layout/generic/ReflowInput.cpp

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,8 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext,
742742
!mStylePosition->BSize(wm).IsAuto()) ||
743743
mStylePosition->MinBSizeDependsOnContainer(wm) ||
744744
mStylePosition->MaxBSizeDependsOnContainer(wm) ||
745-
mStylePosition->mOffset.Get(LogicalSide::BStart, wm)
746-
.MaybePercentageAware() ||
747-
!mStylePosition->mOffset.Get(LogicalSide::BEnd, wm).MaybeAuto();
745+
mStylePosition->GetInset(LogicalSide::BStart, wm).HasPercent() ||
746+
!mStylePosition->GetInset(LogicalSide::BEnd, wm).IsAuto();
748747

749748
// If mFrame is a flex item, and mFrame's block axis is the flex container's
750749
// main axis (e.g. in a column-oriented flex container with same
@@ -853,18 +852,15 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
853852
const LogicalSize& aCBSize) {
854853
LogicalMargin offsets(aWM);
855854
const nsStylePosition* position = aFrame->StylePosition();
856-
const auto positionProperty = aFrame->StyleDisplay()->mPosition;
857855

858856
// Compute the 'inlineStart' and 'inlineEnd' values. 'inlineStart'
859857
// moves the boxes to the end of the line, and 'inlineEnd' moves the
860858
// boxes to the start of the line. The computed values are always:
861859
// inlineStart=-inlineEnd
862-
const auto& inlineStart = position->GetAnchorResolvedInset(
863-
LogicalSide::IStart, aWM, positionProperty);
864-
const auto& inlineEnd = position->GetAnchorResolvedInset(
865-
LogicalSide::IEnd, aWM, positionProperty);
866-
bool inlineStartIsAuto = inlineStart.IsAuto();
867-
bool inlineEndIsAuto = inlineEnd.IsAuto();
860+
const auto& inlineStart = position->GetInset(LogicalSide::IStart, aWM);
861+
const auto& inlineEnd = position->GetInset(LogicalSide::IEnd, aWM);
862+
bool inlineStartIsAuto = !inlineStart.IsLengthPercentage();
863+
bool inlineEndIsAuto = !inlineEnd.IsLengthPercentage();
868864

869865
// If neither 'inlineStart' nor 'inlineEnd' is auto, then we're
870866
// over-constrained and we ignore one of them
@@ -877,12 +873,9 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
877873
// If both are 'auto' (their initial values), the computed values are 0
878874
offsets.IStart(aWM) = offsets.IEnd(aWM) = 0;
879875
} else {
880-
// 'inlineEnd' isn't being treated as 'auto' so compute its value
876+
// 'inlineEnd' isn't 'auto' so compute its value
881877
offsets.IEnd(aWM) =
882-
inlineEnd.IsAuto()
883-
? 0
884-
: nsLayoutUtils::ComputeCBDependentValue(
885-
aCBSize.ISize(aWM), inlineEnd.AsLengthPercentage());
878+
nsLayoutUtils::ComputeCBDependentValue(aCBSize.ISize(aWM), inlineEnd);
886879

887880
// Computed value for 'inlineStart' is minus the value of 'inlineEnd'
888881
offsets.IStart(aWM) = -offsets.IEnd(aWM);
@@ -892,8 +885,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
892885
NS_ASSERTION(inlineEndIsAuto, "unexpected specified constraint");
893886

894887
// 'InlineStart' isn't 'auto' so compute its value
895-
offsets.IStart(aWM) = nsLayoutUtils::ComputeCBDependentValue(
896-
aCBSize.ISize(aWM), inlineStart.AsLengthPercentage());
888+
offsets.IStart(aWM) =
889+
nsLayoutUtils::ComputeCBDependentValue(aCBSize.ISize(aWM), inlineStart);
897890

898891
// Computed value for 'inlineEnd' is minus the value of 'inlineStart'
899892
offsets.IEnd(aWM) = -offsets.IStart(aWM);
@@ -903,10 +896,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
903896
// and 'blockEnd' properties move relatively positioned elements in
904897
// the block progression direction. They also must be each other's
905898
// negative
906-
const auto& blockStart = position->GetAnchorResolvedInset(
907-
LogicalSide::BStart, aWM, positionProperty);
908-
const auto& blockEnd = position->GetAnchorResolvedInset(
909-
LogicalSide::BEnd, aWM, positionProperty);
899+
const auto& blockStart = position->GetInset(LogicalSide::BStart, aWM);
900+
const auto& blockEnd = position->GetInset(LogicalSide::BEnd, aWM);
910901
bool blockStartIsAuto = blockStart.IsAuto();
911902
bool blockEndIsAuto = blockEnd.IsAuto();
912903

@@ -931,12 +922,9 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
931922
// If both are 'auto' (their initial values), the computed values are 0
932923
offsets.BStart(aWM) = offsets.BEnd(aWM) = 0;
933924
} else {
934-
// 'blockEnd' isn't being treated as 'auto' so compute its value
925+
// 'blockEnd' isn't 'auto' so compute its value
935926
offsets.BEnd(aWM) =
936-
blockEnd.IsAuto()
937-
? 0
938-
: nsLayoutUtils::ComputeCBDependentValue(
939-
aCBSize.BSize(aWM), blockEnd.AsLengthPercentage());
927+
nsLayoutUtils::ComputeCBDependentValue(aCBSize.BSize(aWM), blockEnd);
940928

941929
// Computed value for 'blockStart' is minus the value of 'blockEnd'
942930
offsets.BStart(aWM) = -offsets.BEnd(aWM);
@@ -946,8 +934,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
946934
NS_ASSERTION(blockEndIsAuto, "unexpected specified constraint");
947935

948936
// 'blockStart' isn't 'auto' so compute its value
949-
offsets.BStart(aWM) = nsLayoutUtils::ComputeCBDependentValue(
950-
aCBSize.BSize(aWM), blockStart.AsLengthPercentage());
937+
offsets.BStart(aWM) =
938+
nsLayoutUtils::ComputeCBDependentValue(aCBSize.BSize(aWM), blockStart);
951939

952940
// Computed value for 'blockEnd' is minus the value of 'blockStart'
953941
offsets.BEnd(aWM) = -offsets.BStart(aWM);
@@ -1566,8 +1554,8 @@ void ReflowInput::CalculateHypotheticalPosition(
15661554
bool ReflowInput::IsInlineSizeComputableByBlockSizeAndAspectRatio(
15671555
nscoord aBlockSize) const {
15681556
WritingMode wm = GetWritingMode();
1569-
MOZ_ASSERT(!mStylePosition->mOffset.Get(LogicalSide::BStart, wm).IsAuto() &&
1570-
!mStylePosition->mOffset.Get(LogicalSide::BEnd, wm).IsAuto(),
1557+
MOZ_ASSERT(!mStylePosition->GetInset(LogicalSide::BStart, wm).IsAuto() &&
1558+
!mStylePosition->GetInset(LogicalSide::BEnd, wm).IsAuto(),
15711559
"If any of the block-start and block-end are auto, aBlockSize "
15721560
"doesn't make sense");
15731561
NS_WARNING_ASSERTION(
@@ -1590,22 +1578,10 @@ bool ReflowInput::IsInlineSizeComputableByBlockSizeAndAspectRatio(
15901578
return false;
15911579
}
15921580

1593-
const auto position = mStyleDisplay->mPosition;
15941581
// If both inline insets are non-auto, mFrame->ComputeSize() should get a
15951582
// possible inline size by those insets, so we don't rely on aspect-ratio.
1596-
if (!mStylePosition->GetAnchorResolvedInset(LogicalSide::IStart, wm, position)
1597-
.IsAuto() &&
1598-
!mStylePosition->GetAnchorResolvedInset(LogicalSide::IEnd, wm, position)
1599-
.IsAuto()) {
1600-
return false;
1601-
}
1602-
1603-
// If block direction insets reference use any anchor positioning function
1604-
// that does not resolve, we can't rely on them.
1605-
if (mStylePosition->GetAnchorResolvedInset(LogicalSide::BStart, wm, position)
1606-
.IsAuto() ||
1607-
mStylePosition->GetAnchorResolvedInset(LogicalSide::BEnd, wm, position)
1608-
.IsAuto()) {
1583+
if (!mStylePosition->GetInset(LogicalSide::IStart, wm).IsAuto() &&
1584+
!mStylePosition->GetInset(LogicalSide::IEnd, wm).IsAuto()) {
16091585
return false;
16101586
}
16111587

@@ -1685,14 +1661,12 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
16851661
NS_ASSERTION(mFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
16861662
"Why are we here?");
16871663

1688-
const auto& iStartOffset = mStylePosition->GetAnchorResolvedInset(
1689-
LogicalSide::IStart, cbwm, StylePositionProperty::Absolute);
1690-
const auto& iEndOffset = mStylePosition->GetAnchorResolvedInset(
1691-
LogicalSide::IEnd, cbwm, StylePositionProperty::Absolute);
1692-
const auto& bStartOffset = mStylePosition->GetAnchorResolvedInset(
1693-
LogicalSide::BStart, cbwm, StylePositionProperty::Absolute);
1694-
const auto& bEndOffset = mStylePosition->GetAnchorResolvedInset(
1695-
LogicalSide::BEnd, cbwm, StylePositionProperty::Absolute);
1664+
const auto& iStartOffset =
1665+
mStylePosition->GetInset(LogicalSide::IStart, cbwm);
1666+
const auto& iEndOffset = mStylePosition->GetInset(LogicalSide::IEnd, cbwm);
1667+
const auto& bStartOffset =
1668+
mStylePosition->GetInset(LogicalSide::BStart, cbwm);
1669+
const auto& bEndOffset = mStylePosition->GetInset(LogicalSide::BEnd, cbwm);
16961670
bool iStartIsAuto = iStartOffset.IsAuto();
16971671
bool iEndIsAuto = iEndOffset.IsAuto();
16981672
bool bStartIsAuto = bStartOffset.IsAuto();
@@ -1778,13 +1752,13 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
17781752
offsets.IStart(cbwm) = 0;
17791753
} else {
17801754
offsets.IStart(cbwm) = nsLayoutUtils::ComputeCBDependentValue(
1781-
cbSize.ISize(cbwm), iStartOffset.AsLengthPercentage());
1755+
cbSize.ISize(cbwm), iStartOffset);
17821756
}
17831757
if (iEndIsAuto) {
17841758
offsets.IEnd(cbwm) = 0;
17851759
} else {
1786-
offsets.IEnd(cbwm) = nsLayoutUtils::ComputeCBDependentValue(
1787-
cbSize.ISize(cbwm), iEndOffset.AsLengthPercentage());
1760+
offsets.IEnd(cbwm) =
1761+
nsLayoutUtils::ComputeCBDependentValue(cbSize.ISize(cbwm), iEndOffset);
17881762
}
17891763

17901764
if (iStartIsAuto && iEndIsAuto) {
@@ -1801,13 +1775,13 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
18011775
offsets.BStart(cbwm) = 0;
18021776
} else {
18031777
offsets.BStart(cbwm) = nsLayoutUtils::ComputeCBDependentValue(
1804-
cbSize.BSize(cbwm), bStartOffset.AsLengthPercentage());
1778+
cbSize.BSize(cbwm), bStartOffset);
18051779
}
18061780
if (bEndIsAuto) {
18071781
offsets.BEnd(cbwm) = 0;
18081782
} else {
1809-
offsets.BEnd(cbwm) = nsLayoutUtils::ComputeCBDependentValue(
1810-
cbSize.BSize(cbwm), bEndOffset.AsLengthPercentage());
1783+
offsets.BEnd(cbwm) =
1784+
nsLayoutUtils::ComputeCBDependentValue(cbSize.BSize(cbwm), bEndOffset);
18111785
}
18121786

18131787
if (bStartIsAuto && bEndIsAuto) {

layout/generic/StickyScrollContainer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ StickyScrollContainer::GetStickyScrollContainerForScrollFrame(
6565
static nscoord ComputeStickySideOffset(Side aSide,
6666
const nsStylePosition& aPosition,
6767
nscoord aPercentBasis) {
68-
const auto& side =
69-
aPosition.GetAnchorResolvedInset(aSide, StylePositionProperty::Sticky);
70-
if (side.IsAuto()) {
68+
const auto& side = aPosition.GetInset(aSide);
69+
if (!side.IsLengthPercentage()) {
7170
return NS_AUTOOFFSET;
7271
}
7372
return nsLayoutUtils::ComputeCBDependentValue(aPercentBasis,

layout/generic/WritingModes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,11 @@ inline const mozilla::StyleMaxSize& nsStylePosition::MaxSize(
21252125
return aAxis == mozilla::LogicalAxis::Inline ? MaxISize(aWM) : MaxBSize(aWM);
21262126
}
21272127

2128+
inline const mozilla::StyleInset& nsStylePosition::GetInset(
2129+
mozilla::LogicalSide aSide, mozilla::WritingMode aWM) const {
2130+
return GetInset(aWM.PhysicalSide(aSide));
2131+
}
2132+
21282133
inline bool nsStylePosition::ISizeDependsOnContainer(WritingMode aWM) const {
21292134
const auto& iSize = ISize(aWM);
21302135
return iSize.IsAuto() || ISizeCoordDependsOnContainer(iSize);

layout/generic/nsAbsoluteContainingBlock.cpp

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ static inline bool IsFixedMarginSize(const StyleMargin& aCoord) {
286286
return aCoord.ConvertsToLength();
287287
}
288288
static inline bool IsFixedOffset(const StyleInset& aInset) {
289-
// For anchor positioning functions, even if the computed value may be a
290-
// fixed length, it depends on the absolute containing block's size.
291289
return aInset.ConvertsToLength();
292290
}
293291

@@ -342,8 +340,8 @@ bool nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f,
342340
// lengths?
343341
if ((pos->BSizeDependsOnContainer(wm) &&
344342
!(pos->BSize(wm).IsAuto() &&
345-
pos->mOffset.Get(LogicalSide::BEnd, wm).MaybeAuto() &&
346-
!pos->mOffset.Get(LogicalSide::BStart, wm).MaybeAuto())) ||
343+
pos->GetInset(LogicalSide::BEnd, wm).IsAuto() &&
344+
!pos->GetInset(LogicalSide::BStart, wm).IsAuto())) ||
347345
pos->MinBSizeDependsOnContainer(wm) ||
348346
pos->MaxBSizeDependsOnContainer(wm) ||
349347
!IsFixedPaddingSize(padding->mPadding.GetBStart(wm)) ||
@@ -365,7 +363,7 @@ bool nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f,
365363
// sides (left and top) that we use to store coordinates, these tests
366364
// are easier to do using physical coordinates rather than logical.
367365
if (aCBWidthChanged) {
368-
if (!IsFixedOffset(pos->mOffset.Get(eSideLeft))) {
366+
if (!IsFixedOffset(pos->GetInset(eSideLeft))) {
369367
return true;
370368
}
371369
// Note that even if 'left' is a length, our position can still
@@ -377,17 +375,17 @@ bool nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f,
377375
// sure of.
378376
if ((wm.GetInlineDir() == WritingMode::InlineDir::RTL ||
379377
wm.GetBlockDir() == WritingMode::BlockDir::RL) &&
380-
!pos->mOffset.Get(eSideRight).MaybeAuto()) {
378+
!pos->GetInset(eSideRight).IsAuto()) {
381379
return true;
382380
}
383381
}
384382
if (aCBHeightChanged) {
385-
if (!IsFixedOffset(pos->mOffset.Get(eSideTop))) {
383+
if (!IsFixedOffset(pos->GetInset(eSideTop))) {
386384
return true;
387385
}
388386
// See comment above for width changes.
389387
if (wm.GetInlineDir() == WritingMode::InlineDir::BTT &&
390-
!pos->mOffset.Get(eSideBottom).MaybeAuto()) {
388+
!pos->GetInset(eSideBottom).IsAuto()) {
391389
return true;
392390
}
393391
}
@@ -927,25 +925,12 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
927925
// align the child by its margin box:
928926
// https://drafts.csswg.org/css-position-3/#abspos-layout
929927
const auto* stylePos = aKidFrame->StylePosition();
930-
auto positionProperty = aKidFrame->StyleDisplay()->mPosition;
931928
const bool iInsetAuto =
932-
stylePos
933-
->GetAnchorResolvedInset(LogicalSide::IStart, outerWM,
934-
positionProperty)
935-
.IsAuto() ||
936-
stylePos
937-
->GetAnchorResolvedInset(LogicalSide::IEnd, outerWM,
938-
positionProperty)
939-
.IsAuto();
929+
stylePos->GetInset(LogicalSide::IStart, outerWM).IsAuto() ||
930+
stylePos->GetInset(LogicalSide::IEnd, outerWM).IsAuto();
940931
const bool bInsetAuto =
941-
stylePos
942-
->GetAnchorResolvedInset(LogicalSide::BStart, outerWM,
943-
positionProperty)
944-
.IsAuto() ||
945-
stylePos
946-
->GetAnchorResolvedInset(LogicalSide::BEnd, outerWM,
947-
positionProperty)
948-
.IsAuto();
932+
stylePos->GetInset(LogicalSide::BStart, outerWM).IsAuto() ||
933+
stylePos->GetInset(LogicalSide::BEnd, outerWM).IsAuto();
949934
const LogicalSize logicalCBSizeOuterWM(outerWM, aContainingBlock.Size());
950935
const LogicalSize kidMarginBox{
951936
outerWM, margin.IStartEnd(outerWM) + kidSize.ISize(outerWM),

layout/generic/nsFlexContainerFrame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,8 +4640,8 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
46404640
if (bsize.HasPercent() ||
46414641
(StyleDisplay()->IsAbsolutelyPositionedStyle() &&
46424642
(bsize.IsAuto() || !bsize.IsLengthPercentage()) &&
4643-
!stylePos->mOffset.Get(LogicalSide::BStart, wm).MaybeAuto() &&
4644-
!stylePos->mOffset.Get(LogicalSide::BEnd, wm).MaybeAuto())) {
4643+
!stylePos->GetInset(LogicalSide::BStart, wm).IsAuto() &&
4644+
!stylePos->GetInset(LogicalSide::BEnd, wm).IsAuto())) {
46454645
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
46464646
}
46474647

layout/generic/nsGridContainerFrame.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8434,11 +8434,9 @@ nscoord nsGridContainerFrame::MasonryLayout(GridReflowInput& aState,
84348434
? LogicalSide::IStart
84358435
: LogicalSide::BStart;
84368436
if (masonryStart == 0 ||
8437-
(masonryStart == kAutoLine &&
8438-
item->mFrame->StylePosition()
8439-
->GetAnchorResolvedInset(
8440-
masonrySide, wm, item->mFrame->StyleDisplay()->mPosition)
8441-
.IsAuto())) {
8437+
(masonryStart == kAutoLine && item->mFrame->StylePosition()
8438+
->GetInset(masonrySide, wm)
8439+
.IsAuto())) {
84428440
sortedItems.AppendElement(item);
84438441
} else {
84448442
item = nullptr;

0 commit comments

Comments
 (0)