Merge mozilla-inbound to mozilla-central. a=merge

This commit is contained in:
Andreea Pavel 2018-05-06 11:41:19 +03:00
Родитель 612a66cbd0 7db87acde1
Коммит b28b94dc81
3 изменённых файлов: 118 добавлений и 105 удалений

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

@ -400,21 +400,21 @@ struct nsGridContainerFrame::LineRange
/**
* Resolve this auto range to start at aStart, making it definite.
* @param aClampMaxLine the maximum allowed line number (zero-based)
* Precondition: this range IsAuto()
*/
void ResolveAutoPosition(uint32_t aStart, uint32_t aExplicitGridOffset)
void ResolveAutoPosition(uint32_t aStart, uint32_t aClampMaxLine)
{
MOZ_ASSERT(IsAuto(), "Why call me?");
mStart = aStart;
mEnd += aStart;
// Clamping to where kMaxLine is in the explicit grid, per
// http://dev.w3.org/csswg/css-grid/#overlarge-grids :
uint32_t translatedMax = aExplicitGridOffset + nsStyleGridLine::kMaxLine;
if (MOZ_UNLIKELY(mStart >= translatedMax)) {
mEnd = translatedMax;
if (MOZ_UNLIKELY(mStart >= aClampMaxLine)) {
mEnd = aClampMaxLine;
mStart = mEnd - 1;
} else if (MOZ_UNLIKELY(mEnd > translatedMax)) {
mEnd = translatedMax;
} else if (MOZ_UNLIKELY(mEnd > aClampMaxLine)) {
mEnd = aClampMaxLine;
}
}
/**
@ -2031,8 +2031,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
LineRange ResolveAbsPosLineRange(const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
int32_t aGridStart,
int32_t aGridEnd,
@ -2062,10 +2061,12 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
* Place aArea in the first column (in row aArea->mRows.mStart) starting at
* aStartCol without overlapping other items. The resulting aArea may
* overflow the current implicit grid bounds.
* @param aClampMaxColLine the maximum allowed column line number (zero-based)
* Pre-condition: aArea->mRows.IsDefinite() is true.
* Post-condition: aArea->IsDefinite() is true.
*/
void PlaceAutoCol(uint32_t aStartCol, GridArea* aArea) const;
void PlaceAutoCol(uint32_t aStartCol, GridArea* aArea,
uint32_t aClampMaxColLine) const;
/**
* Find the first row in column aLockedCol starting at aStartRow where aArea
@ -2079,32 +2080,42 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
* Place aArea in the first row (in column aArea->mCols.mStart) starting at
* aStartRow without overlapping other items. The resulting aArea may
* overflow the current implicit grid bounds.
* @param aClampMaxRowLine the maximum allowed row line number (zero-based)
* Pre-condition: aArea->mCols.IsDefinite() is true.
* Post-condition: aArea->IsDefinite() is true.
*/
void PlaceAutoRow(uint32_t aStartRow, GridArea* aArea) const;
void PlaceAutoRow(uint32_t aStartRow, GridArea* aArea,
uint32_t aClampMaxRowLine) const;
/**
* Place aArea in the first column starting at aStartCol,aStartRow without
* causing it to overlap other items or overflow mGridColEnd.
* If there's no such column in aStartRow, continue in position 1,aStartRow+1.
* @param aClampMaxColLine the maximum allowed column line number (zero-based)
* @param aClampMaxRowLine the maximum allowed row line number (zero-based)
* Pre-condition: aArea->mCols.IsAuto() && aArea->mRows.IsAuto() is true.
* Post-condition: aArea->IsDefinite() is true.
*/
void PlaceAutoAutoInRowOrder(uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea) const;
GridArea* aArea,
uint32_t aClampMaxColLine,
uint32_t aClampMaxRowLine) const;
/**
* Place aArea in the first row starting at aStartCol,aStartRow without
* causing it to overlap other items or overflow mGridRowEnd.
* If there's no such row in aStartCol, continue in position aStartCol+1,1.
* @param aClampMaxColLine the maximum allowed column line number (zero-based)
* @param aClampMaxRowLine the maximum allowed row line number (zero-based)
* Pre-condition: aArea->mCols.IsAuto() && aArea->mRows.IsAuto() is true.
* Post-condition: aArea->IsDefinite() is true.
*/
void PlaceAutoAutoInColOrder(uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea) const;
GridArea* aArea,
uint32_t aClampMaxColLine,
uint32_t aClampMaxRowLine) const;
/**
* Return aLine if it's inside the aMin..aMax range (inclusive),
@ -2132,9 +2143,6 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
mGridRowEnd <= kTranslatedMaxLine);
}
enum LineRangeSide {
eLineRangeSideStart, eLineRangeSideEnd
};
/**
* Return a line number for (non-auto) aLine, per:
* http://dev.w3.org/csswg/css-grid/#line-placement
@ -2145,10 +2153,9 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
* will be treated as one.
* @param aFromIndex the zero-based index to start counting from
* @param aLineNameList the explicit named lines
* @param aAreaStart a pointer to GridNamedArea::mColumnStart/mRowStart
* @param aAreaEnd a pointer to GridNamedArea::mColumnEnd/mRowEnd
* @param aSide the axis+edge we're resolving names for (e.g. if we're
resolving a grid-row-start line, pass eLogicalSideBStart)
* @param aExplicitGridEnd the last line in the explicit grid
* @param aEdge indicates whether we are resolving a start or end line
* @param aStyle the StylePosition() for the grid container
* @return a definite line (1-based), clamped to the kMinLine..kMaxLine range
*/
@ -2156,10 +2163,8 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
int32_t aNth,
uint32_t aFromIndex,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalSide aSide,
uint32_t aExplicitGridEnd,
LineRangeSide aSide,
const nsStylePosition* aStyle);
/**
@ -2171,8 +2176,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
LinePair ResolveLineRangeHelper(const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
const nsStylePosition* aStyle);
@ -2186,16 +2190,14 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Grid
* @param aStart style data for the start line
* @param aEnd style data for the end line
* @param aLineNameList the explicit named lines
* @param aAreaStart a pointer to GridNamedArea::mColumnStart/mRowStart
* @param aAreaEnd a pointer to GridNamedArea::mColumnEnd/mRowEnd
* @param aAxis the axis we're resolving names in
* @param aExplicitGridEnd the last line in the explicit grid
* @param aStyle the StylePosition() for the grid container
*/
LineRange ResolveLineRange(const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
const nsStylePosition* aStyle);
@ -2668,10 +2670,8 @@ nsGridContainerFrame::Grid::ResolveLine(const nsStyleGridLine& aLine,
int32_t aNth,
uint32_t aFromIndex,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalSide aSide,
uint32_t aExplicitGridEnd,
LineRangeSide aSide,
const nsStylePosition* aStyle)
{
MOZ_ASSERT(!aLine.IsAuto());
@ -2693,12 +2693,18 @@ nsGridContainerFrame::Grid::ResolveLine(const nsStyleGridLine& aLine,
// http://dev.w3.org/csswg/css-grid/#grid-placement-slot
uint32_t implicitLine = 0;
nsAutoString lineName(aLine.mLineName);
if (aSide == eLineRangeSideStart) {
if (IsStart(aSide)) {
lineName.AppendLiteral("-start");
implicitLine = area ? area->*aAreaStart : 0;
if (area) {
implicitLine =
IsBlock(aSide) ? area->mRowStart : area->mColumnStart;
}
} else {
lineName.AppendLiteral("-end");
implicitLine = area ? area->*aAreaEnd : 0;
if (area) {
implicitLine =
IsBlock(aSide) ? area->mRowEnd : area->mColumnEnd;
}
}
line = aNameMap.FindNamedLine(lineName, &aNth, aFromIndex,
implicitLine);
@ -2709,18 +2715,19 @@ nsGridContainerFrame::Grid::ResolveLine(const nsStyleGridLine& aLine,
// If mLineName ends in -start/-end, try the prefix as a named area.
uint32_t implicitLine = 0;
uint32_t index;
auto GridNamedArea::* areaEdge = aAreaStart;
bool found = IsNameWithStartSuffix(aLine.mLineName, &index);
if (!found) {
found = IsNameWithEndSuffix(aLine.mLineName, &index);
areaEdge = aAreaEnd;
}
if (found) {
bool useStart = IsNameWithStartSuffix(aLine.mLineName, &index);
if (useStart || IsNameWithEndSuffix(aLine.mLineName, &index)) {
const GridNamedArea* area =
FindNamedArea(nsDependentSubstring(aLine.mLineName, 0, index),
aStyle);
if (area) {
implicitLine = area->*areaEdge;
if (useStart) {
implicitLine = IsBlock(aSide) ? area->mRowStart
: area->mColumnStart;
} else {
implicitLine = IsBlock(aSide) ? area->mRowEnd
: area->mColumnEnd;
}
}
}
line = aNameMap.FindNamedLine(aLine.mLineName, &aNth, aFromIndex,
@ -2733,7 +2740,7 @@ nsGridContainerFrame::Grid::ResolveLine(const nsStyleGridLine& aLine,
if (aLine.mHasSpan) {
// http://dev.w3.org/csswg/css-grid/#grid-placement-span-int
// 'span <custom-ident> N'
edgeLine = aSide == eLineRangeSideStart ? 1 : aExplicitGridEnd;
edgeLine = IsStart(aSide) ? 1 : aExplicitGridEnd;
} else {
// http://dev.w3.org/csswg/css-grid/#grid-placement-int
// '<custom-ident> N'
@ -2752,8 +2759,7 @@ nsGridContainerFrame::Grid::ResolveLineRangeHelper(
const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
const nsStylePosition* aStyle)
{
@ -2773,9 +2779,9 @@ nsGridContainerFrame::Grid::ResolveLineRangeHelper(
}
uint32_t from = aEnd.mInteger < 0 ? aExplicitGridEnd + 1: 0;
auto end = ResolveLine(aEnd, aEnd.mInteger, from, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, eLineRangeSideEnd,
aStyle);
auto end = ResolveLine(aEnd, aEnd.mInteger, from, aNameMap,
MakeLogicalSide(aAxis, eLogicalEdgeEnd),
aExplicitGridEnd, aStyle);
int32_t span = aStart.mInteger == 0 ? 1 : aStart.mInteger;
if (end <= 1) {
// The end is at or before the first explicit line, thus all lines before
@ -2783,9 +2789,9 @@ nsGridContainerFrame::Grid::ResolveLineRangeHelper(
int32_t start = std::max(end - span, nsStyleGridLine::kMinLine);
return LinePair(start, end);
}
auto start = ResolveLine(aStart, -span, end, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, eLineRangeSideStart,
aStyle);
auto start = ResolveLine(aStart, -span, end, aNameMap,
MakeLogicalSide(aAxis, eLogicalEdgeStart),
aExplicitGridEnd, aStyle);
return LinePair(start, end);
}
@ -2808,8 +2814,8 @@ nsGridContainerFrame::Grid::ResolveLineRangeHelper(
} else {
uint32_t from = aStart.mInteger < 0 ? aExplicitGridEnd + 1: 0;
start = ResolveLine(aStart, aStart.mInteger, from, aNameMap,
aAreaStart, aAreaEnd, aExplicitGridEnd,
eLineRangeSideStart, aStyle);
MakeLogicalSide(aAxis, eLogicalEdgeStart),
aExplicitGridEnd, aStyle);
if (aEnd.IsAuto()) {
// A "definite line / auto" should resolve the auto to 'span 1'.
// The error handling in ResolveLineRange will make that happen and also
@ -2837,8 +2843,9 @@ nsGridContainerFrame::Grid::ResolveLineRangeHelper(
} else {
from = aEnd.mInteger < 0 ? aExplicitGridEnd + 1: 0;
}
auto end = ResolveLine(aEnd, nth, from, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, eLineRangeSideEnd, aStyle);
auto end = ResolveLine(aEnd, nth, from, aNameMap,
MakeLogicalSide(aAxis, eLogicalEdgeEnd),
aExplicitGridEnd, aStyle);
if (start == int32_t(kAutoLine)) {
// auto / definite line
start = std::max(nsStyleGridLine::kMinLine, end - 1);
@ -2851,13 +2858,12 @@ nsGridContainerFrame::Grid::ResolveLineRange(
const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
const nsStylePosition* aStyle)
{
LinePair r = ResolveLineRangeHelper(aStart, aEnd, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, aStyle);
LinePair r = ResolveLineRangeHelper(aStart, aEnd, aNameMap, aAxis,
aExplicitGridEnd, aStyle);
MOZ_ASSERT(r.second != int32_t(kAutoLine));
if (r.first == int32_t(kAutoLine)) {
@ -2888,12 +2894,10 @@ nsGridContainerFrame::Grid::PlaceDefinite(nsIFrame* aChild,
const nsStylePosition* itemStyle = aChild->StylePosition();
return GridArea(
ResolveLineRange(itemStyle->mGridColumnStart, itemStyle->mGridColumnEnd,
aColLineNameMap,
&GridNamedArea::mColumnStart, &GridNamedArea::mColumnEnd,
aColLineNameMap, eLogicalAxisInline,
mExplicitGridColEnd, aStyle),
ResolveLineRange(itemStyle->mGridRowStart, itemStyle->mGridRowEnd,
aRowLineNameMap,
&GridNamedArea::mRowStart, &GridNamedArea::mRowEnd,
aRowLineNameMap, eLogicalAxisBlock,
mExplicitGridRowEnd, aStyle));
}
@ -2902,8 +2906,7 @@ nsGridContainerFrame::Grid::ResolveAbsPosLineRange(
const nsStyleGridLine& aStart,
const nsStyleGridLine& aEnd,
const LineNameMap& aNameMap,
uint32_t GridNamedArea::* aAreaStart,
uint32_t GridNamedArea::* aAreaEnd,
LogicalAxis aAxis,
uint32_t aExplicitGridEnd,
int32_t aGridStart,
int32_t aGridEnd,
@ -2915,8 +2918,9 @@ nsGridContainerFrame::Grid::ResolveAbsPosLineRange(
}
uint32_t from = aEnd.mInteger < 0 ? aExplicitGridEnd + 1: 0;
int32_t end =
ResolveLine(aEnd, aEnd.mInteger, from, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, eLineRangeSideEnd, aStyle);
ResolveLine(aEnd, aEnd.mInteger, from, aNameMap,
MakeLogicalSide(aAxis, eLogicalEdgeEnd),
aExplicitGridEnd, aStyle);
if (aEnd.mHasSpan) {
++end;
}
@ -2928,8 +2932,9 @@ nsGridContainerFrame::Grid::ResolveAbsPosLineRange(
if (aEnd.IsAuto()) {
uint32_t from = aStart.mInteger < 0 ? aExplicitGridEnd + 1: 0;
int32_t start =
ResolveLine(aStart, aStart.mInteger, from, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, eLineRangeSideStart, aStyle);
ResolveLine(aStart, aStart.mInteger, from, aNameMap,
MakeLogicalSide(aAxis, eLogicalEdgeStart),
aExplicitGridEnd, aStyle);
if (aStart.mHasSpan) {
start = std::max(aGridEnd - start, aGridStart);
}
@ -2937,8 +2942,8 @@ nsGridContainerFrame::Grid::ResolveAbsPosLineRange(
return LineRange(start, kAutoLine);
}
LineRange r = ResolveLineRange(aStart, aEnd, aNameMap, aAreaStart,
aAreaEnd, aExplicitGridEnd, aStyle);
LineRange r = ResolveLineRange(aStart, aEnd, aNameMap, aAxis,
aExplicitGridEnd, aStyle);
if (r.IsAuto()) {
MOZ_ASSERT(aStart.mHasSpan && aEnd.mHasSpan, "span / span is the only case "
"leading to IsAuto here -- we dealt with the other cases above");
@ -2963,16 +2968,12 @@ nsGridContainerFrame::Grid::PlaceAbsPos(nsIFrame* aChild,
return GridArea(
ResolveAbsPosLineRange(itemStyle->mGridColumnStart,
itemStyle->mGridColumnEnd,
aColLineNameMap,
&GridNamedArea::mColumnStart,
&GridNamedArea::mColumnEnd,
aColLineNameMap, eLogicalAxisInline,
mExplicitGridColEnd, gridColStart, mGridColEnd,
aStyle),
ResolveAbsPosLineRange(itemStyle->mGridRowStart,
itemStyle->mGridRowEnd,
aRowLineNameMap,
&GridNamedArea::mRowStart,
&GridNamedArea::mRowEnd,
aRowLineNameMap, eLogicalAxisBlock,
mExplicitGridRowEnd, gridRowStart, mGridRowEnd,
aStyle));
}
@ -3015,11 +3016,12 @@ nsGridContainerFrame::Grid::FindAutoCol(uint32_t aStartCol, uint32_t aLockedRow,
void
nsGridContainerFrame::Grid::PlaceAutoCol(uint32_t aStartCol,
GridArea* aArea) const
GridArea* aArea,
uint32_t aClampMaxColLine) const
{
MOZ_ASSERT(aArea->mRows.IsDefinite() && aArea->mCols.IsAuto());
uint32_t col = FindAutoCol(aStartCol, aArea->mRows.mStart, aArea);
aArea->mCols.ResolveAutoPosition(col, mExplicitGridOffsetCol);
aArea->mCols.ResolveAutoPosition(col, aClampMaxColLine);
MOZ_ASSERT(aArea->IsDefinite());
}
@ -3054,18 +3056,22 @@ nsGridContainerFrame::Grid::FindAutoRow(uint32_t aLockedCol, uint32_t aStartRow,
void
nsGridContainerFrame::Grid::PlaceAutoRow(uint32_t aStartRow,
GridArea* aArea) const
GridArea* aArea,
uint32_t aClampMaxRowLine) const
{
MOZ_ASSERT(aArea->mCols.IsDefinite() && aArea->mRows.IsAuto());
uint32_t row = FindAutoRow(aArea->mCols.mStart, aStartRow, aArea);
aArea->mRows.ResolveAutoPosition(row, mExplicitGridOffsetRow);
aArea->mRows.ResolveAutoPosition(row, aClampMaxRowLine);
MOZ_ASSERT(aArea->IsDefinite());
}
void
nsGridContainerFrame::Grid::PlaceAutoAutoInRowOrder(uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea) const
nsGridContainerFrame::Grid::PlaceAutoAutoInRowOrder(
uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea,
uint32_t aClampMaxColLine,
uint32_t aClampMaxRowLine) const
{
MOZ_ASSERT(aArea->mCols.IsAuto() && aArea->mRows.IsAuto());
const uint32_t colExtent = aArea->mCols.Extent();
@ -3082,15 +3088,18 @@ nsGridContainerFrame::Grid::PlaceAutoAutoInRowOrder(uint32_t aStartCol,
}
MOZ_ASSERT(row < gridRowEnd || col == 0,
"expected column 0 for placing in a new row");
aArea->mCols.ResolveAutoPosition(col, mExplicitGridOffsetCol);
aArea->mRows.ResolveAutoPosition(row, mExplicitGridOffsetRow);
aArea->mCols.ResolveAutoPosition(col, aClampMaxColLine);
aArea->mRows.ResolveAutoPosition(row, aClampMaxRowLine);
MOZ_ASSERT(aArea->IsDefinite());
}
void
nsGridContainerFrame::Grid::PlaceAutoAutoInColOrder(uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea) const
nsGridContainerFrame::Grid::PlaceAutoAutoInColOrder(
uint32_t aStartCol,
uint32_t aStartRow,
GridArea* aArea,
uint32_t aClampMaxColLine,
uint32_t aClampMaxRowLine) const
{
MOZ_ASSERT(aArea->mCols.IsAuto() && aArea->mRows.IsAuto());
const uint32_t rowExtent = aArea->mRows.Extent();
@ -3107,8 +3116,8 @@ nsGridContainerFrame::Grid::PlaceAutoAutoInColOrder(uint32_t aStartCol,
}
MOZ_ASSERT(col < gridColEnd || row == 0,
"expected row 0 for placing in a new column");
aArea->mCols.ResolveAutoPosition(col, mExplicitGridOffsetCol);
aArea->mRows.ResolveAutoPosition(row, mExplicitGridOffsetRow);
aArea->mCols.ResolveAutoPosition(col, aClampMaxColLine);
aArea->mRows.ResolveAutoPosition(row, aClampMaxRowLine);
MOZ_ASSERT(aArea->IsDefinite());
}
@ -3130,6 +3139,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
// Note that this is for a grid with a 1,1 origin. We'll change that
// to a 0,0 based grid after placing definite lines.
auto areas = gridStyle->mGridTemplateAreas.get();
int32_t clampMaxColLine = nsStyleGridLine::kMaxLine;
uint32_t numRepeatCols = aState.mColFunctions.InitRepeatTracks(
gridStyle->mColumnGap,
aComputedMinSize.ISize(aState.mWM),
@ -3139,6 +3149,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
aState.mColFunctions.ComputeExplicitGridEnd(areas ? areas->mNColumns + 1 : 1);
LineNameMap colLineNameMap(gridStyle->GridTemplateColumns(), numRepeatCols);
int32_t clampMaxRowLine = nsStyleGridLine::kMaxLine;
uint32_t numRepeatRows = aState.mRowFunctions.InitRepeatTracks(
gridStyle->mRowGap,
aComputedMinSize.BSize(aState.mWM),
@ -3182,6 +3193,8 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
const int32_t offsetToRowZero = int32_t(mExplicitGridOffsetRow) - 1;
mGridColEnd += offsetToColZero;
mGridRowEnd += offsetToRowZero;
clampMaxColLine += offsetToColZero;
clampMaxRowLine += offsetToRowZero;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
GridArea& area = aState.mGridItems[aState.mIter.ItemIndex()].mArea;
@ -3213,6 +3226,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
}
auto placeAutoMinorFunc = isRowOrder ? &Grid::PlaceAutoCol
: &Grid::PlaceAutoRow;
uint32_t clampMaxLine = isRowOrder ? clampMaxColLine : clampMaxRowLine;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
GridArea& area = aState.mGridItems[aState.mIter.ItemIndex()].mArea;
@ -3224,7 +3238,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
if (isSparse) {
cursors->Get(major.mStart, &cursor);
}
(this->*placeAutoMinorFunc)(cursor, &area);
(this->*placeAutoMinorFunc)(cursor, &area, clampMaxLine);
mCellMap.Fill(area);
if (isSparse) {
cursors->Put(major.mStart, minor.mEnd);
@ -3247,6 +3261,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
uint32_t cursorMinor = 0;
auto placeAutoMajorFunc = isRowOrder ? &Grid::PlaceAutoRow
: &Grid::PlaceAutoCol;
uint32_t clampMaxMajorLine = isRowOrder ? clampMaxRowLine : clampMaxColLine;
aState.mIter.Reset();
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
GridArea& area = aState.mGridItems[aState.mIter.ItemIndex()].mArea;
@ -3263,16 +3278,18 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
}
cursorMinor = minor.mStart;
}
(this->*placeAutoMajorFunc)(cursorMajor, &area);
(this->*placeAutoMajorFunc)(cursorMajor, &area, clampMaxMajorLine);
if (isSparse) {
cursorMajor = major.mStart;
}
} else {
// Items with 'auto' in both dimensions.
if (isRowOrder) {
PlaceAutoAutoInRowOrder(cursorMinor, cursorMajor, &area);
PlaceAutoAutoInRowOrder(cursorMinor, cursorMajor, &area,
clampMaxColLine, clampMaxRowLine);
} else {
PlaceAutoAutoInColOrder(cursorMajor, cursorMinor, &area);
PlaceAutoAutoInColOrder(cursorMajor, cursorMinor, &area,
clampMaxColLine, clampMaxRowLine);
}
if (isSparse) {
cursorMajor = major.mStart;
@ -3456,14 +3473,12 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState,
LineRange columnLines = ResolveLineRange(
lineStartAndEnd, lineStartAndEnd,
colLineNameMap,
&GridNamedArea::mColumnStart, &GridNamedArea::mColumnEnd,
colLineNameMap, eLogicalAxisInline,
mExplicitGridColEnd, gridStyle);
LineRange rowLines = ResolveLineRange(
lineStartAndEnd, lineStartAndEnd,
rowLineNameMap,
&GridNamedArea::mRowStart, &GridNamedArea::mRowEnd,
rowLineNameMap, eLogicalAxisBlock,
mExplicitGridRowEnd, gridStyle);
// Put the resolved line indices back into the area structure.

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

@ -29,7 +29,6 @@ x {
<span style="background:yellow"></span>
<span style="background:lime"></span>
<span style="background:blue"></span>
<span style="background:lime"></span>
<span style="background:blue"></span>
<x></x>
</div>
@ -38,13 +37,12 @@ x {
<span style="background:yellow"></span>
<span style="background:lime"></span>
<span style="background:blue"></span>
<span style="background:blue"></span>
<x></x>
</div>
<div class="grid" style="left:100px">
<span style="background:yellow"></span>
<span style="background:lime"></span>
<span style="background:yellow"></span>
<span style="background:blue"></span>
<x></x>
</div>

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

@ -80,17 +80,17 @@ span {
<div class="grid" style="height:40px; position:relative">
<span style="margin-top:-10000px; height:20060px; width:78px;"></span>
<span style="position:absolute; z-index:1; left:0; width:216px; height:10000px; margin-top:20px;">b</span><br>
<span style="position:absolute; z-index:1; left:0; width:216px; height:10000px">b</span><br>
<span style="margin-top:-10042px; height:30px; width:78px; color:black"></span>
</div>
<div class="grid" style="height:40px; position:relative">
<span style="margin-top:20px; position:absolute; left:0; z-index:0; height:30px; width:78px; color:black"></span>
<span style="margin-top:-10000px; height:20018px; width:78px;"></span>
<span style="position:absolute; left:0; width:216px; height:2000px; margin-top:20px;">b</span><br>
<span style="position:absolute; left:0; width:216px; height:2000px">b</span><br>
</div>
<div class="grid" style="height:40px; position:relative;">
<span style="position:absolute; left:20px; width: 30px; height:78px; z-index:2; color:black;"></span>
<span style="position:absolute; left:85px; width: 30px;">b</span>
<span style="position:absolute; left:82px; width: 30px;">b</span>
</div>
<div class="grid" style="height:40px; position:relative">
<span style="position:absolute; left:0; z-index:1; margin-top:20px; height:30px; width:78px; color:black; border-left-color:black;"></span>
@ -99,7 +99,7 @@ span {
</div>
<div class="grid" style="height:40px; position:relative;">
<span style="position:absolute; left:20px; width: 30px; height:78px; z-index:2; color:silver;"></span>
<span style="position:absolute; left:143px; width: 123px;">b</span>
<span style="position:absolute; left:143px; width: 120px;">b</span>
</div>
</div><div style="float:left" class="f2">