Bug 1155772 Part 5 - Cache flex container's logical axis and writing-mode in PositionTracker. r=mats

They are going to be used in the later parts.

Differential Revision: https://phabricator.services.mozilla.com/D59047

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2020-01-21 20:30:30 +00:00
Родитель 9b0ebbdd0c
Коммит 306ac5d0f7
1 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -2198,6 +2198,7 @@ class MOZ_STACK_CLASS PositionTracker {
public: public:
// Accessor for the current value of the position that we're tracking. // Accessor for the current value of the position that we're tracking.
inline nscoord GetPosition() const { return mPosition; } inline nscoord GetPosition() const { return mPosition; }
inline LogicalAxis GetAxis() const { return mAxis; }
inline AxisOrientationType GetPhysicalAxis() const { return mPhysicalAxis; } inline AxisOrientationType GetPhysicalAxis() const { return mPhysicalAxis; }
// Advances our position across the start edge of the given margin, in the // Advances our position across the start edge of the given margin, in the
@ -2243,14 +2244,23 @@ class MOZ_STACK_CLASS PositionTracker {
protected: protected:
// Protected constructor, to be sure we're only instantiated via a subclass. // Protected constructor, to be sure we're only instantiated via a subclass.
PositionTracker(AxisOrientationType aPhysicalAxis, bool aIsAxisReversed) PositionTracker(WritingMode aWM, LogicalAxis aAxis,
: mPhysicalAxis(aPhysicalAxis), mIsAxisReversed(aIsAxisReversed) {} AxisOrientationType aPhysicalAxis, bool aIsAxisReversed)
: mWM(aWM),
mAxis(aAxis),
mPhysicalAxis(aPhysicalAxis),
mIsAxisReversed(aIsAxisReversed) {}
// Member data: // Member data:
// The position we're tracking. // The position we're tracking.
nscoord mPosition = 0; nscoord mPosition = 0;
// XXXdholbert [BEGIN DEPRECATED]
// The flex container's writing mode.
const WritingMode mWM;
// The axis along which we're moving. // The axis along which we're moving.
const LogicalAxis mAxis = eLogicalAxisInline;
// XXXdholbert [BEGIN DEPRECATED]
const AxisOrientationType mPhysicalAxis = eAxis_LR; const AxisOrientationType mPhysicalAxis = eAxis_LR;
// XXXdholbert [END DEPRECATED] // XXXdholbert [END DEPRECATED]
@ -2933,7 +2943,8 @@ void FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize,
MainAxisPositionTracker::MainAxisPositionTracker( MainAxisPositionTracker::MainAxisPositionTracker(
const FlexboxAxisTracker& aAxisTracker, const FlexLine* aLine, const FlexboxAxisTracker& aAxisTracker, const FlexLine* aLine,
uint8_t aJustifyContent, nscoord aContentBoxMainSize) uint8_t aJustifyContent, nscoord aContentBoxMainSize)
: PositionTracker(aAxisTracker.GetPhysicalMainAxis(), : PositionTracker(aAxisTracker.GetWritingMode(), aAxisTracker.MainAxis(),
aAxisTracker.GetPhysicalMainAxis(),
aAxisTracker.IsMainAxisReversed()), aAxisTracker.IsMainAxisReversed()),
// we chip away at this below // we chip away at this below
mPackingSpaceRemaining(aContentBoxMainSize), mPackingSpaceRemaining(aContentBoxMainSize),
@ -3115,7 +3126,8 @@ CrossAxisPositionTracker::CrossAxisPositionTracker(
FlexLine* aFirstLine, const ReflowInput& aReflowInput, FlexLine* aFirstLine, const ReflowInput& aReflowInput,
nscoord aContentBoxCrossSize, bool aIsCrossSizeDefinite, nscoord aContentBoxCrossSize, bool aIsCrossSizeDefinite,
const FlexboxAxisTracker& aAxisTracker, const nscoord aCrossGapSize) const FlexboxAxisTracker& aAxisTracker, const nscoord aCrossGapSize)
: PositionTracker(aAxisTracker.GetPhysicalCrossAxis(), : PositionTracker(aAxisTracker.GetWritingMode(), aAxisTracker.CrossAxis(),
aAxisTracker.GetPhysicalCrossAxis(),
aAxisTracker.IsCrossAxisReversed()), aAxisTracker.IsCrossAxisReversed()),
mAlignContent(aReflowInput.mStylePosition->mAlignContent), mAlignContent(aReflowInput.mStylePosition->mAlignContent),
mCrossGapSize(aCrossGapSize) { mCrossGapSize(aCrossGapSize) {
@ -3303,7 +3315,8 @@ void CrossAxisPositionTracker::TraversePackingSpace() {
SingleLineCrossAxisPositionTracker::SingleLineCrossAxisPositionTracker( SingleLineCrossAxisPositionTracker::SingleLineCrossAxisPositionTracker(
const FlexboxAxisTracker& aAxisTracker) const FlexboxAxisTracker& aAxisTracker)
: PositionTracker(aAxisTracker.GetPhysicalCrossAxis(), : PositionTracker(aAxisTracker.GetWritingMode(), aAxisTracker.CrossAxis(),
aAxisTracker.GetPhysicalCrossAxis(),
aAxisTracker.IsCrossAxisReversed()) {} aAxisTracker.IsCrossAxisReversed()) {}
void FlexLine::ComputeCrossSizeAndBaseline( void FlexLine::ComputeCrossSizeAndBaseline(