@@ -742,9 +742,8 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext,
742
742
!mStylePosition ->BSize (wm).IsAuto ()) ||
743
743
mStylePosition ->MinBSizeDependsOnContainer (wm) ||
744
744
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 ();
748
747
749
748
// If mFrame is a flex item, and mFrame's block axis is the flex container's
750
749
// main axis (e.g. in a column-oriented flex container with same
@@ -853,18 +852,15 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
853
852
const LogicalSize& aCBSize) {
854
853
LogicalMargin offsets (aWM);
855
854
const nsStylePosition* position = aFrame->StylePosition ();
856
- const auto positionProperty = aFrame->StyleDisplay ()->mPosition ;
857
855
858
856
// Compute the 'inlineStart' and 'inlineEnd' values. 'inlineStart'
859
857
// moves the boxes to the end of the line, and 'inlineEnd' moves the
860
858
// boxes to the start of the line. The computed values are always:
861
859
// 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 ();
868
864
869
865
// If neither 'inlineStart' nor 'inlineEnd' is auto, then we're
870
866
// over-constrained and we ignore one of them
@@ -877,12 +873,9 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
877
873
// If both are 'auto' (their initial values), the computed values are 0
878
874
offsets.IStart (aWM) = offsets.IEnd (aWM) = 0 ;
879
875
} else {
880
- // 'inlineEnd' isn't being treated as 'auto' so compute its value
876
+ // 'inlineEnd' isn't 'auto' so compute its value
881
877
offsets.IEnd (aWM) =
882
- inlineEnd.IsAuto ()
883
- ? 0
884
- : nsLayoutUtils::ComputeCBDependentValue (
885
- aCBSize.ISize (aWM), inlineEnd.AsLengthPercentage ());
878
+ nsLayoutUtils::ComputeCBDependentValue (aCBSize.ISize (aWM), inlineEnd);
886
879
887
880
// Computed value for 'inlineStart' is minus the value of 'inlineEnd'
888
881
offsets.IStart (aWM) = -offsets.IEnd (aWM);
@@ -892,8 +885,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
892
885
NS_ASSERTION (inlineEndIsAuto, " unexpected specified constraint" );
893
886
894
887
// '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);
897
890
898
891
// Computed value for 'inlineEnd' is minus the value of 'inlineStart'
899
892
offsets.IEnd (aWM) = -offsets.IStart (aWM);
@@ -903,10 +896,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
903
896
// and 'blockEnd' properties move relatively positioned elements in
904
897
// the block progression direction. They also must be each other's
905
898
// 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);
910
901
bool blockStartIsAuto = blockStart.IsAuto ();
911
902
bool blockEndIsAuto = blockEnd.IsAuto ();
912
903
@@ -931,12 +922,9 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
931
922
// If both are 'auto' (their initial values), the computed values are 0
932
923
offsets.BStart (aWM) = offsets.BEnd (aWM) = 0 ;
933
924
} else {
934
- // 'blockEnd' isn't being treated as 'auto' so compute its value
925
+ // 'blockEnd' isn't 'auto' so compute its value
935
926
offsets.BEnd (aWM) =
936
- blockEnd.IsAuto ()
937
- ? 0
938
- : nsLayoutUtils::ComputeCBDependentValue (
939
- aCBSize.BSize (aWM), blockEnd.AsLengthPercentage ());
927
+ nsLayoutUtils::ComputeCBDependentValue (aCBSize.BSize (aWM), blockEnd);
940
928
941
929
// Computed value for 'blockStart' is minus the value of 'blockEnd'
942
930
offsets.BStart (aWM) = -offsets.BEnd (aWM);
@@ -946,8 +934,8 @@ LogicalMargin ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
946
934
NS_ASSERTION (blockEndIsAuto, " unexpected specified constraint" );
947
935
948
936
// '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);
951
939
952
940
// Computed value for 'blockEnd' is minus the value of 'blockStart'
953
941
offsets.BEnd (aWM) = -offsets.BStart (aWM);
@@ -1566,8 +1554,8 @@ void ReflowInput::CalculateHypotheticalPosition(
1566
1554
bool ReflowInput::IsInlineSizeComputableByBlockSizeAndAspectRatio (
1567
1555
nscoord aBlockSize) const {
1568
1556
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 (),
1571
1559
" If any of the block-start and block-end are auto, aBlockSize "
1572
1560
" doesn't make sense" );
1573
1561
NS_WARNING_ASSERTION (
@@ -1590,22 +1578,10 @@ bool ReflowInput::IsInlineSizeComputableByBlockSizeAndAspectRatio(
1590
1578
return false ;
1591
1579
}
1592
1580
1593
- const auto position = mStyleDisplay ->mPosition ;
1594
1581
// If both inline insets are non-auto, mFrame->ComputeSize() should get a
1595
1582
// 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 ()) {
1609
1585
return false ;
1610
1586
}
1611
1587
@@ -1685,14 +1661,12 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
1685
1661
NS_ASSERTION (mFrame ->HasAnyStateBits (NS_FRAME_OUT_OF_FLOW),
1686
1662
"Why are we here?");
1687
1663
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);
1696
1670
bool iStartIsAuto = iStartOffset.IsAuto();
1697
1671
bool iEndIsAuto = iEndOffset.IsAuto();
1698
1672
bool bStartIsAuto = bStartOffset.IsAuto ();
@@ -1778,13 +1752,13 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
1778
1752
offsets.IStart (cbwm) = 0 ;
1779
1753
} else {
1780
1754
offsets.IStart (cbwm) = nsLayoutUtils::ComputeCBDependentValue (
1781
- cbSize.ISize (cbwm), iStartOffset. AsLengthPercentage () );
1755
+ cbSize.ISize (cbwm), iStartOffset);
1782
1756
}
1783
1757
if (iEndIsAuto) {
1784
1758
offsets.IEnd (cbwm) = 0 ;
1785
1759
} else {
1786
- offsets.IEnd (cbwm) = nsLayoutUtils::ComputeCBDependentValue (
1787
- cbSize.ISize (cbwm), iEndOffset. AsLengthPercentage () );
1760
+ offsets.IEnd (cbwm) =
1761
+ nsLayoutUtils::ComputeCBDependentValue ( cbSize.ISize (cbwm), iEndOffset);
1788
1762
}
1789
1763
1790
1764
if (iStartIsAuto && iEndIsAuto) {
@@ -1801,13 +1775,13 @@ void ReflowInput::InitAbsoluteConstraints(const ReflowInput* aCBReflowInput,
1801
1775
offsets.BStart (cbwm) = 0 ;
1802
1776
} else {
1803
1777
offsets.BStart (cbwm) = nsLayoutUtils::ComputeCBDependentValue (
1804
- cbSize.BSize (cbwm), bStartOffset. AsLengthPercentage () );
1778
+ cbSize.BSize (cbwm), bStartOffset);
1805
1779
}
1806
1780
if (bEndIsAuto) {
1807
1781
offsets.BEnd (cbwm) = 0 ;
1808
1782
} else {
1809
- offsets.BEnd (cbwm) = nsLayoutUtils::ComputeCBDependentValue (
1810
- cbSize.BSize (cbwm), bEndOffset. AsLengthPercentage () );
1783
+ offsets.BEnd (cbwm) =
1784
+ nsLayoutUtils::ComputeCBDependentValue ( cbSize.BSize (cbwm), bEndOffset);
1811
1785
}
1812
1786
1813
1787
if (bStartIsAuto && bEndIsAuto) {
0 commit comments