Bug 1151212 part 1 - [css-grid] Introduce a few local structs (GridReflowState, Tracks, TrackSizingFunctions) to make it easier to pass around data. r=dholbert

This commit is contained in:
Mats Palmgren 2015-09-04 22:06:57 +02:00
parent bbb026b9f4
commit 1c16c0bb7e
2 changed files with 210 additions and 141 deletions

View File

@ -20,6 +20,7 @@
#include "nsHashKeys.h"
#include "nsIFrameInlines.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsReadableUtils.h"
#include "nsRuleNode.h"
#include "nsStyleContext.h"
@ -168,6 +169,102 @@ private:
#endif
};
/**
* Encapsulates CSS track-sizing functions.
*/
struct MOZ_STACK_CLASS nsGridContainerFrame::TrackSizingFunctions
{
const nsStyleCoord& MinSizingFor(uint32_t aTrackIndex) const
{
if (MOZ_UNLIKELY(aTrackIndex < mExplicitGridOffset)) {
return mAutoMinSizing;
}
uint32_t index = aTrackIndex - mExplicitGridOffset;
return index < mMinSizingFunctions.Length() ?
mMinSizingFunctions[index] : mAutoMinSizing;
}
const nsStyleCoord& MaxSizingFor(uint32_t aTrackIndex) const
{
if (MOZ_UNLIKELY(aTrackIndex < mExplicitGridOffset)) {
return mAutoMaxSizing;
}
uint32_t index = aTrackIndex - mExplicitGridOffset;
return index < mMaxSizingFunctions.Length() ?
mMaxSizingFunctions[index] : mAutoMaxSizing;
}
const nsTArray<nsStyleCoord>& mMinSizingFunctions;
const nsTArray<nsStyleCoord>& mMaxSizingFunctions;
const nsStyleCoord& mAutoMinSizing;
const nsStyleCoord& mAutoMaxSizing;
uint32_t mExplicitGridOffset;
};
/**
* State for the tracks in one dimension.
*/
struct MOZ_STACK_CLASS nsGridContainerFrame::Tracks
{
void Initialize(const TrackSizingFunctions& aFunctions,
nscoord aPercentageBasis);
nsAutoTArray<TrackSize, 32> mSizes;
};
struct MOZ_STACK_CLASS nsGridContainerFrame::GridReflowState
{
GridReflowState(nsGridContainerFrame* aFrame,
const nsHTMLReflowState& aRS)
: GridReflowState(aFrame, *aRS.rendContext, &aRS, aRS.mStylePosition,
aRS.GetWritingMode())
{}
GridReflowState(nsGridContainerFrame* aFrame,
nsRenderingContext& aRC)
: GridReflowState(aFrame, aRC, nullptr, aFrame->StylePosition(),
aFrame->GetWritingMode())
{}
GridItemCSSOrderIterator mIter;
const nsStylePosition* const mGridStyle;
Tracks mCols;
Tracks mRows;
TrackSizingFunctions mColFunctions;
TrackSizingFunctions mRowFunctions;
/**
* @note mReflowState may be null when using the 2nd ctor above. In this case
* we'll construct a dummy parent reflow state if we need it to calculate
* min/max-content contributions when sizing tracks.
*/
const nsHTMLReflowState* mReflowState;
nsRenderingContext& mRenderingContext;
const WritingMode mWM;
private:
GridReflowState(nsGridContainerFrame* aFrame,
nsRenderingContext& aRenderingContext,
const nsHTMLReflowState* aReflowState,
const nsStylePosition* aGridStyle,
const WritingMode& aWM)
: mIter(aFrame, kPrincipalList)
, mGridStyle(aGridStyle)
, mColFunctions({
mGridStyle->mGridTemplateColumns.mMinTrackSizingFunctions,
mGridStyle->mGridTemplateColumns.mMaxTrackSizingFunctions,
mGridStyle->mGridAutoColumnsMin,
mGridStyle->mGridAutoColumnsMax,
})
, mRowFunctions({
mGridStyle->mGridTemplateRows.mMinTrackSizingFunctions,
mGridStyle->mGridTemplateRows.mMaxTrackSizingFunctions,
mGridStyle->mGridAutoRowsMin,
mGridStyle->mGridAutoRowsMax,
})
, mReflowState(aReflowState)
, mRenderingContext(aRenderingContext)
, mWM(aWM)
{}
};
/**
* Search for the aNth occurrence of aName in aNameList (forward), starting at
* the zero-based aFromIndex, and return the 1-based index (line number).
@ -880,19 +977,20 @@ nsGridContainerFrame::InitializeGridBounds(const nsStylePosition* aStyle)
}
void
nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
const nsStylePosition* aStyle)
nsGridContainerFrame::PlaceGridItems(GridReflowState& aState)
{
const nsStylePosition* const gridStyle = aState.mGridStyle;
mCellMap.ClearOccupied();
InitializeGridBounds(aStyle);
InitializeGridBounds(gridStyle);
// http://dev.w3.org/csswg/css-grid/#line-placement
// Resolve definite positions per spec chap 9.2.
int32_t minCol = 1;
int32_t minRow = 1;
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
const GridArea& area = PlaceDefinite(child, aStyle);
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
const GridArea& area = PlaceDefinite(child, gridStyle);
if (area.mCols.IsDefinite()) {
minCol = std::min(minCol, area.mCols.mUntranslatedStart);
}
@ -911,13 +1009,15 @@ nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
// Translate the whole grid so that the top-/left-most area is at 0,0.
mExplicitGridOffsetCol = 1 - minCol; // minCol/Row is always <= 1, see above
mExplicitGridOffsetRow = 1 - minRow;
aState.mColFunctions.mExplicitGridOffset = mExplicitGridOffsetCol;
aState.mRowFunctions.mExplicitGridOffset = mExplicitGridOffsetRow;
const int32_t offsetToColZero = int32_t(mExplicitGridOffsetCol) - 1;
const int32_t offsetToRowZero = int32_t(mExplicitGridOffsetRow) - 1;
mGridColEnd += offsetToColZero;
mGridRowEnd += offsetToRowZero;
aIter.Reset();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
GridArea* area = GetGridAreaForChild(child);
if (area->mCols.IsDefinite()) {
area->mCols.mStart = area->mCols.mUntranslatedStart + offsetToColZero;
@ -936,7 +1036,7 @@ nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
// http://dev.w3.org/csswg/css-grid/#auto-placement-algo
// Step 1, place 'auto' items that have one definite position -
// definite row (column) for grid-auto-flow:row (column).
auto flowStyle = aStyle->mGridAutoFlow;
auto flowStyle = gridStyle->mGridAutoFlow;
const bool isRowOrder = (flowStyle & NS_STYLE_GRID_AUTO_FLOW_ROW);
const bool isSparse = !(flowStyle & NS_STYLE_GRID_AUTO_FLOW_DENSE);
// We need 1 cursor per row (or column) if placement is sparse.
@ -947,9 +1047,9 @@ nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
}
auto placeAutoMinorFunc = isRowOrder ? &nsGridContainerFrame::PlaceAutoCol
: &nsGridContainerFrame::PlaceAutoRow;
aIter.Reset();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
GridArea* area = GetGridAreaForChild(child);
LineRange& major = isRowOrder ? area->mRows : area->mCols;
LineRange& minor = isRowOrder ? area->mCols : area->mRows;
@ -982,9 +1082,9 @@ nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
uint32_t cursorMinor = 0;
auto placeAutoMajorFunc = isRowOrder ? &nsGridContainerFrame::PlaceAutoRow
: &nsGridContainerFrame::PlaceAutoCol;
aIter.Reset();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
GridArea* area = GetGridAreaForChild(child);
LineRange& major = isRowOrder ? area->mRows : area->mCols;
LineRange& minor = isRowOrder ? area->mCols : area->mRows;
@ -1042,7 +1142,7 @@ nsGridContainerFrame::PlaceGridItems(GridItemCSSOrderIterator& aIter,
mGridRowEnd -= offsetToRowZero;
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
GridArea area(PlaceAbsPos(child, aStyle));
GridArea area(PlaceAbsPos(child, gridStyle));
if (area.mCols.mUntranslatedStart != int32_t(kAutoLine)) {
area.mCols.mStart = area.mCols.mUntranslatedStart + offsetToColZero;
}
@ -1099,60 +1199,51 @@ InitializeTrackSize(nscoord aPercentageBasis,
}
}
static void
InitializeTrackSizes(nscoord aPercentageBasis,
const nsTArray<nsStyleCoord>& aMinSizingFunctions,
const nsTArray<nsStyleCoord>& aMaxSizingFunctions,
const nsStyleCoord& aAutoMinFunction,
const nsStyleCoord& aAutoMaxFunction,
uint32_t aExplicitGridOffset,
nsTArray<TrackSize>& aResults)
void
nsGridContainerFrame::Tracks::Initialize(const TrackSizingFunctions& aFunctions,
nscoord aPercentageBasis)
{
MOZ_ASSERT(aResults.Length() >= aExplicitGridOffset + aMinSizingFunctions.Length());
MOZ_ASSERT(aMinSizingFunctions.Length() == aMaxSizingFunctions.Length());
size_t i = 0;
for (; i < aExplicitGridOffset; ++i) {
const uint32_t explicitGridOffset = aFunctions.mExplicitGridOffset;
MOZ_ASSERT(mSizes.Length() >=
explicitGridOffset + aFunctions.mMinSizingFunctions.Length());
MOZ_ASSERT(aFunctions.mMinSizingFunctions.Length() ==
aFunctions.mMaxSizingFunctions.Length());
uint32_t i = 0;
for (; i < explicitGridOffset; ++i) {
InitializeTrackSize(aPercentageBasis,
aAutoMinFunction, aAutoMaxFunction,
&aResults[i]);
aFunctions.mAutoMinSizing,
aFunctions.mAutoMaxSizing,
&mSizes[i]);
}
size_t j = 0;
for (const size_t len = aMinSizingFunctions.Length(); j < len; ++j) {
uint32_t j = 0;
for (uint32_t len = aFunctions.mMinSizingFunctions.Length(); j < len; ++j) {
InitializeTrackSize(aPercentageBasis,
aMinSizingFunctions[j], aMaxSizingFunctions[j],
&aResults[i + j]);
aFunctions.mMinSizingFunctions[j],
aFunctions.mMaxSizingFunctions[j],
&mSizes[i + j]);
}
i += j;
for (; i < aResults.Length(); ++i) {
for (; i < mSizes.Length(); ++i) {
InitializeTrackSize(aPercentageBasis,
aAutoMinFunction, aAutoMaxFunction,
&aResults[i]);
aFunctions.mAutoMinSizing,
aFunctions.mAutoMaxSizing,
&mSizes[i]);
}
}
void
nsGridContainerFrame::CalculateTrackSizes(const LogicalSize& aPercentageBasis,
const nsStylePosition* aStyle,
nsTArray<TrackSize>& aColSizes,
nsTArray<TrackSize>& aRowSizes)
nsGridContainerFrame::CalculateTrackSizes(GridReflowState& aState,
const LogicalSize& aContentBox)
{
aColSizes.SetLength(mGridColEnd);
aRowSizes.SetLength(mGridRowEnd);
WritingMode wm = GetWritingMode();
InitializeTrackSizes(aPercentageBasis.ISize(wm),
aStyle->mGridTemplateColumns.mMinTrackSizingFunctions,
aStyle->mGridTemplateColumns.mMaxTrackSizingFunctions,
aStyle->mGridAutoColumnsMin,
aStyle->mGridAutoColumnsMax,
mExplicitGridOffsetCol,
aColSizes);
InitializeTrackSizes(aPercentageBasis.BSize(wm),
aStyle->mGridTemplateRows.mMinTrackSizingFunctions,
aStyle->mGridTemplateRows.mMaxTrackSizingFunctions,
aStyle->mGridAutoRowsMin,
aStyle->mGridAutoRowsMax,
mExplicitGridOffsetRow,
aRowSizes);
aState.mCols.mSizes.SetLength(mGridColEnd);
aState.mRows.mSizes.SetLength(mGridRowEnd);
const WritingMode& wm = aState.mWM;
aState.mCols.Initialize(aState.mColFunctions, aContentBox.ISize(wm));
nscoord rowPercentageBasis = aContentBox.BSize(wm);
if (rowPercentageBasis == NS_AUTOHEIGHT) {
rowPercentageBasis = 0;
}
aState.mRows.Initialize(aState.mRowFunctions, rowPercentageBasis);
}
void
@ -1207,70 +1298,66 @@ nsGridContainerFrame::LineRange::ToPositionAndLengthForAbsPos(
}
LogicalRect
nsGridContainerFrame::ContainingBlockFor(
const WritingMode& aWM,
const GridArea& aArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes) const
nsGridContainerFrame::ContainingBlockFor(const GridReflowState& aState,
const GridArea& aArea) const
{
nscoord i, b, iSize, bSize;
MOZ_ASSERT(aArea.mCols.Extent() > 0, "grid items cover at least one track");
MOZ_ASSERT(aArea.mRows.Extent() > 0, "grid items cover at least one track");
aArea.mCols.ToPositionAndLength(aColSizes, &i, &iSize);
aArea.mRows.ToPositionAndLength(aRowSizes, &b, &bSize);
return LogicalRect(aWM, i, b, iSize, bSize);
aArea.mCols.ToPositionAndLength(aState.mCols.mSizes, &i, &iSize);
aArea.mRows.ToPositionAndLength(aState.mRows.mSizes, &b, &bSize);
return LogicalRect(aState.mWM, i, b, iSize, bSize);
}
LogicalRect
nsGridContainerFrame::ContainingBlockForAbsPos(
const WritingMode& aWM,
const GridArea& aArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const
nsGridContainerFrame::ContainingBlockForAbsPos(const GridReflowState& aState,
const GridArea& aArea,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const
{
nscoord i = aGridCB.IStart(aWM);
nscoord b = aGridCB.BStart(aWM);
nscoord iSize = aGridCB.ISize(aWM);
nscoord bSize = aGridCB.BSize(aWM);
aArea.mCols.ToPositionAndLengthForAbsPos(aColSizes, aGridOrigin.I(aWM),
const WritingMode& wm = aState.mWM;
nscoord i = aGridCB.IStart(wm);
nscoord b = aGridCB.BStart(wm);
nscoord iSize = aGridCB.ISize(wm);
nscoord bSize = aGridCB.BSize(wm);
aArea.mCols.ToPositionAndLengthForAbsPos(aState.mCols.mSizes,
aGridOrigin.I(wm),
&i, &iSize);
aArea.mRows.ToPositionAndLengthForAbsPos(aRowSizes, aGridOrigin.B(aWM),
aArea.mRows.ToPositionAndLengthForAbsPos(aState.mRows.mSizes,
aGridOrigin.B(wm),
&b, &bSize);
return LogicalRect(aWM, i, b, iSize, bSize);
}
void
nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
const LogicalRect& aContentArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
const LogicalRect& aContentArea,
nsHTMLReflowMetrics& aDesiredSize,
nsReflowStatus& aStatus)
{
WritingMode wm = aReflowState.GetWritingMode();
MOZ_ASSERT(aState.mReflowState);
WritingMode wm = aState.mReflowState->GetWritingMode();
const LogicalPoint gridOrigin(aContentArea.Origin(wm));
const nsSize containerSize =
(aContentArea.Size(wm) +
aReflowState.ComputedLogicalBorderPadding().Size(wm)).GetPhysicalSize(wm);
aState.mReflowState->ComputedLogicalBorderPadding().Size(wm)).GetPhysicalSize(wm);
nsPresContext* pc = PresContext();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
const bool isGridItem = child->GetType() != nsGkAtoms::placeholderFrame;
LogicalRect cb(wm);
if (MOZ_LIKELY(isGridItem)) {
GridArea* area = GetGridAreaForChild(child);
MOZ_ASSERT(area && area->IsDefinite());
cb = ContainingBlockFor(wm, *area, aColSizes, aRowSizes);
cb = ContainingBlockFor(aState, *area);
cb += gridOrigin;
} else {
cb = aContentArea;
}
WritingMode childWM = child->GetWritingMode();
LogicalSize childCBSize = cb.Size(wm).ConvertTo(childWM, wm);
nsHTMLReflowState childRS(pc, aReflowState, child, childCBSize);
nsHTMLReflowState childRS(pc, *aState.mReflowState, child, childCBSize);
const LogicalMargin margin = childRS.ComputedLogicalMargin();
if (childRS.ComputedBSize() == NS_AUTOHEIGHT && MOZ_LIKELY(isGridItem)) {
// XXX the start of an align-self:stretch impl. Needs min-/max-bsize
@ -1305,8 +1392,8 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
if (IsAbsoluteContainer()) {
nsFrameList children(GetChildList(GetAbsoluteListID()));
if (!children.IsEmpty()) {
LogicalMargin pad(aReflowState.ComputedLogicalPadding());
pad.ApplySkipSides(GetLogicalSkipSides(&aReflowState));
LogicalMargin pad(aState.mReflowState->ComputedLogicalPadding());
pad.ApplySkipSides(GetLogicalSkipSides(aState.mReflowState));
// 'gridOrigin' is the origin of the grid (the start of the first track),
// with respect to the grid container's padding-box (CB).
const LogicalPoint gridOrigin(wm, pad.IStart(wm), pad.BStart(wm));
@ -1317,8 +1404,7 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
nsIFrame* child = e.get();
GridArea* area = GetGridAreaForChild(child);
MOZ_ASSERT(area);
LogicalRect itemCB(ContainingBlockForAbsPos(wm, *area,
aColSizes, aRowSizes,
LogicalRect itemCB(ContainingBlockForAbsPos(aState, *area,
gridOrigin, gridCB));
// nsAbsoluteContainingBlock::Reflow uses physical coordinates.
nsRect* cb = static_cast<nsRect*>(child->Properties().Get(
@ -1333,8 +1419,8 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
// away the virtual GetType() call in the callee in most cases.
// @see nsAbsoluteContainingBlock::Reflow
nsRect dummyRect(0, 0, VERY_LIKELY_A_GRID_CONTAINER, 0);
GetAbsoluteContainingBlock()->Reflow(this, pc, aReflowState, aStatus,
dummyRect, true,
GetAbsoluteContainingBlock()->Reflow(this, pc, *aState.mReflowState,
aStatus, dummyRect, true,
true, true, // XXX could be optimized
&aDesiredSize.mOverflowAreas);
}
@ -1363,23 +1449,20 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
bp.ApplySkipSides(GetLogicalSkipSides());
const nsStylePosition* stylePos = aReflowState.mStylePosition;
InitImplicitNamedAreas(stylePos);
GridItemCSSOrderIterator normalFlowIter(this, kPrincipalList);
mIsNormalFlowInCSSOrder = normalFlowIter.ItemsAreAlreadyInOrder();
PlaceGridItems(normalFlowIter, stylePos);
GridReflowState gridReflowState(this, aReflowState);
mIsNormalFlowInCSSOrder = gridReflowState.mIter.ItemsAreAlreadyInOrder();
PlaceGridItems(gridReflowState);
nsAutoTArray<TrackSize, 32> colSizes;
nsAutoTArray<TrackSize, 32> rowSizes;
WritingMode wm = aReflowState.GetWritingMode();
const nscoord computedBSize = aReflowState.ComputedBSize();
const nscoord computedISize = aReflowState.ComputedISize();
LogicalSize percentageBasis(wm, computedISize,
computedBSize == NS_AUTOHEIGHT ? 0 : computedBSize);
CalculateTrackSizes(percentageBasis, stylePos, colSizes, rowSizes);
const WritingMode& wm = gridReflowState.mWM;
CalculateTrackSizes(gridReflowState,
LogicalSize(wm, computedISize, computedBSize));
nscoord bSize = 0;
if (computedBSize == NS_AUTOHEIGHT) {
for (uint32_t i = 0; i < mGridRowEnd; ++i) {
bSize += rowSizes[i].mBase;
bSize += gridReflowState.mRows.mSizes[i].mBase;
}
} else {
bSize = computedBSize;
@ -1392,9 +1475,8 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
LogicalRect contentArea(wm, bp.IStart(wm), bp.BStart(wm),
computedISize, bSize);
normalFlowIter.Reset(GridItemCSSOrderIterator::eIncludeAll);
ReflowChildren(normalFlowIter, contentArea, colSizes, rowSizes, aDesiredSize,
aReflowState, aStatus);
gridReflowState.mIter.Reset(GridItemCSSOrderIterator::eIncludeAll);
ReflowChildren(gridReflowState, contentArea, aDesiredSize, aStatus);
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;

View File

@ -68,6 +68,9 @@ protected:
typedef mozilla::WritingMode WritingMode;
typedef mozilla::css::GridNamedArea GridNamedArea;
class GridItemCSSOrderIterator;
struct TrackSizingFunctions;
struct Tracks;
struct GridReflowState;
friend nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
explicit nsGridContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
@ -366,11 +369,8 @@ protected:
* Place all child frames into the grid and expand the (implicit) grid as
* needed. The allocated GridAreas are stored in the GridAreaProperty
* frame property on the child frame.
* @param aIter a grid item iterator
* @param aStyle the StylePosition() for the grid container
*/
void PlaceGridItems(GridItemCSSOrderIterator& aIter,
const nsStylePosition* aStyle);
void PlaceGridItems(GridReflowState& aState);
/**
* Initialize the end lines of the Explicit Grid (mExplicitGridCol[Row]End).
@ -396,10 +396,8 @@ protected:
/**
* Calculate track sizes.
*/
void CalculateTrackSizes(const mozilla::LogicalSize& aPercentageBasis,
const nsStylePosition* aStyle,
nsTArray<TrackSize>& aColSizes,
nsTArray<TrackSize>& aRowSizes);
void CalculateTrackSizes(GridReflowState& aState,
const mozilla::LogicalSize& aContentBox);
/**
* Helper method for ResolveLineRange.
@ -445,40 +443,29 @@ protected:
/**
* Return the containing block for a grid item occupying aArea.
* @param aColSizes column track sizes
* @param aRowSizes row track sizes
*/
LogicalRect ContainingBlockFor(const WritingMode& aWM,
const GridArea& aArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes) const;
LogicalRect ContainingBlockFor(const GridReflowState& aState,
const GridArea& aArea) const;
/**
* Return the containing block for an abs.pos. grid item occupying aArea.
* Any 'auto' lines in the grid area will be aligned with grid container
* containing block on that side.
* @param aColSizes column track sizes
* @param aRowSizes row track sizes
* @param aGridOrigin the origin of the grid
* @param aGridCB the grid container containing block (its padding area)
*/
LogicalRect ContainingBlockForAbsPos(const WritingMode& aWM,
const GridArea& aArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const;
LogicalRect ContainingBlockForAbsPos(const GridReflowState& aState,
const GridArea& aArea,
const LogicalPoint& aGridOrigin,
const LogicalRect& aGridCB) const;
/**
* Reflow and place our children.
*/
void ReflowChildren(GridItemCSSOrderIterator& aIter,
const LogicalRect& aContentArea,
const nsTArray<TrackSize>& aColSizes,
const nsTArray<TrackSize>& aRowSizes,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
void ReflowChildren(GridReflowState& aState,
const LogicalRect& aContentArea,
nsHTMLReflowMetrics& aDesiredSize,
nsReflowStatus& aStatus);
#ifdef DEBUG
void SanityCheckAnonymousGridItems() const;