зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1629575 - [css-grid] Initialize LineNameMap::mTemplateLinesEnd correctly also when a repeat(auto-fill/fit) has more than one track. r=mats
This only occurred when a grid with a repeat with multiple values was used. Also Add crashtests for this case, and update some comments on LineNameMap's fields while we are here. Differential Revision: https://phabricator.services.mozilla.com/D71242
This commit is contained in:
Родитель
f38ed46452
Коммит
143b38623d
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<style>
|
||||
.grid-container {
|
||||
display: grid;
|
||||
/* Repeat auto-fill which is less than the number of elements in the grid. */
|
||||
grid-template-columns: 1px 1px 1px 1px repeat(auto-fill, 1px 1px 1px);
|
||||
width: 13px;
|
||||
}
|
||||
div > div {
|
||||
/* Any name will work */
|
||||
grid-column-start: x;
|
||||
}
|
||||
</style>
|
||||
<div class="grid-container">
|
||||
<div>x</div>
|
||||
<div>y</div>
|
||||
<div>z</div>
|
||||
<div>w</div>
|
||||
</div>
|
||||
</html>
|
|
@ -0,0 +1,69 @@
|
|||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
|
||||
|
||||
<style>
|
||||
.grid-container {
|
||||
display: grid;
|
||||
border: solid thick;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.columns {
|
||||
grid-template-columns: repeat(auto-fill, 50px 50px);
|
||||
grid-auto-rows: 25px;
|
||||
grid-column-gap: 100px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.rows {
|
||||
grid-auto-flow: column;
|
||||
grid-template-rows: repeat(auto-fill, 50px 50px);
|
||||
grid-auto-columns: 25px;
|
||||
grid-row-gap: 100px;
|
||||
width: min-content;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.grid-container>div {
|
||||
background: lime;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
div { grid-column-start: first;}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="grid-container columns">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="grid-container columns"
|
||||
style="grid-template-columns: repeat(auto-fill, 50px 50px 50px)">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="grid-container columns"
|
||||
style="grid-template-columns: repeat(auto-fill, 50px 50px 50px 50px)">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="grid-container rows">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -761,6 +761,8 @@ load 1625051-1.html
|
|||
load 1625051-2.html
|
||||
load 1626970.html
|
||||
load 1628804.html
|
||||
load 1629575-1.html
|
||||
load 1629575-2.html
|
||||
load 1630385.html
|
||||
load 1633434.html
|
||||
load 1633828.html
|
||||
|
|
|
@ -1434,7 +1434,21 @@ class MOZ_STACK_CLASS nsGridContainerFrame::LineNameMap {
|
|||
}
|
||||
}
|
||||
ExpandRepeatLineNames(!!aRange, aTracks);
|
||||
mTemplateLinesEnd = mExpandedLineNames.Length() + mRepeatEndDelta;
|
||||
if (mHasRepeatAuto) {
|
||||
// We need mTemplateLinesEnd to be after all line names.
|
||||
// mExpandedLineNames has one repetition of the repeat(auto-fit/fill)
|
||||
// track name lists already, so we must subtract the number of repeat
|
||||
// track name lists to get to the number of non-repeat tracks, minus 2
|
||||
// because the first and last line name lists are shared with the
|
||||
// preceding and following non-repeat line name lists. We then add
|
||||
// mRepeatEndDelta to include the interior line name lists from repeat
|
||||
// tracks.
|
||||
mTemplateLinesEnd = mExpandedLineNames.Length() -
|
||||
(mTrackAutoRepeatLineNames.Length() - 2) +
|
||||
mRepeatEndDelta;
|
||||
} else {
|
||||
mTemplateLinesEnd = mExpandedLineNames.Length();
|
||||
}
|
||||
MOZ_ASSERT(mHasRepeatAuto || mRepeatEndDelta <= 0);
|
||||
MOZ_ASSERT(!mHasRepeatAuto || aRange ||
|
||||
(mExpandedLineNames.Length() >= 2 &&
|
||||
|
@ -1923,13 +1937,13 @@ class MOZ_STACK_CLASS nsGridContainerFrame::LineNameMap {
|
|||
Span<const StyleOwnedSlice<StyleCustomIdent>> mTrackAutoRepeatLineNames;
|
||||
// The index of the repeat(auto-fill/fit) track, or zero if there is none.
|
||||
uint32_t mRepeatAutoStart;
|
||||
// The (hypothetical) index of the last such repeat() track.
|
||||
// The index one past the end of the repeat(auto-fill/fit) tracks. Equal to
|
||||
// mRepeatAutoStart if there are no repeat(auto-fill/fit) tracks.
|
||||
uint32_t mRepeatAutoEnd;
|
||||
// The difference between mTemplateLinesEnd and mExpandedLineNames.Length().
|
||||
// The total number of repeat tracks minus 1.
|
||||
int32_t mRepeatEndDelta;
|
||||
// The end of the line name lists with repeat(auto-fill/fit) tracks accounted
|
||||
// for. It is equal to mExpandedLineNames.Length() when a repeat()
|
||||
// track generates one track (making mRepeatEndDelta == 0).
|
||||
// for.
|
||||
uint32_t mTemplateLinesEnd;
|
||||
|
||||
// The parent line map, or null if this map isn't for a subgrid.
|
||||
|
|
Загрузка…
Ссылка в новой задаче