Backed out changeset a59280f412c0 (bug 1633737) for crashtest assertion failures at nsGridContainerFrame.cpp. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2020-06-18 04:16:09 +03:00
Родитель 011d524740
Коммит 8246b23171
8 изменённых файлов: 14 добавлений и 200 удалений

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

@ -1,8 +0,0 @@
<html>
<head>
<style>* {
grid-template: none/repeat(58, minmax(19443em, max-content) minmax(2vh, max-content)) repeat(auto-fill, 1vw minmax(3%, 1in)) 1px repeat(25817, minmax(25in, min-content))
</style>
<button style='display:inline-grid'></button>
</head>
</html>

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

@ -1,8 +0,0 @@
<html>
<head>
<style>
div { grid-template-columns: 9919443em repeat(auto-fill, 1in 1in 1in) repeat(25817, 25in); }
</style>
<div style='display:inline-grid'></div>
</head>
</html>

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

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<!--
any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Testcase for Bug 1633737</title>
<style>
html,body {
color:black; background-color:white; font:15px/1 monospace; padding:0; margin:0;
}
.grid {
display: grid;
width: min-content;
grid-template-columns: repeat(9998,0) repeat(auto-fill, 5px 10px 15px 20px);
grid-auto-columns: 500px; /* should not be used */
border: 1px solid;
margin-bottom: 2px;
}
x { grid-column: 1 / foo; }
</style>
</head>
<body>
<div class="grid"><x></x></div>
<script>
document.body.offsetHeight;
window.getComputedStyle(document.querySelectorAll('.grid')[0]).gridTemplateColumns;
</script>
</body>
</html>

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

@ -1,53 +0,0 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Testcase for Bug 1633737</title>
<style>
html,body {
color:black; background-color:white; font:15px/1 monospace; padding:0; margin:0;
}
.grid {
display: grid;
width: min-content;
grid-auto-columns: 500px; /* should not be used */
border: 1px solid;
margin-bottom: 2px;
}
x { grid-column: 1 / foo; }
</style>
</head>
<body>
<script>
const MAX_LINE_NUMBER = 10000;
const sz = ["5px", "10px", "15px", "20px", "25px"];
const cols = [9997, 9998, 9999, 10000, 10001];
for (let len = 1; len <= sz.length; ++len) {
for (const c of cols) {
if (c + len + 1 < MAX_LINE_NUMBER) {
continue;
}
let grid = document.createElement("div");
grid.className = "grid";
let s = "repeat(" + c + ",0) " + "repeat(auto-fill,";
for (let i = 0; i < len; ++i) {
s += " " + sz[i];
}
s += ")";
grid.style.gridTemplateColumns = s;
console.log(s);
let item = document.createElement("x");
grid.appendChild(item);
document.body.appendChild(grid);
}
}
</script>
</body>
</html>

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

@ -1,39 +0,0 @@
<!DOCTYPE HTML>
<!--
any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Testcase for Bug 1633737</title>
<style>
html,body {
color:black; background-color:white; font:15px/1 monospace; padding:0; margin:0;
}
.grid {
display: grid;
width: min-content;
grid-template-columns: repeat(9998,0) repeat(auto-fit, 5px [b] 10px [c] 15px [d] 20px [e] 25px);
grid-auto-columns: 500px; /* should not be used */
border: 1px solid;
margin-bottom: 2px;
}
x { grid-column: b / e; }
</style>
</head>
<body>
<div class="grid"><x style="grid-column: b / e"></x></div>
<div class="grid"><x style="grid-column: 1 / e"></x></div>
<div class="grid"><x style="grid-column: c / foo"></x></div>
<div class="grid"><x style="grid-column: b / d"></x></div>
<script>
document.body.offsetHeight;
document.querySelectorAll('.grid').forEach(function(grid){
window.getComputedStyle(grid).gridTemplateColumns;
});
</script>
</body>
</html>

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

@ -768,11 +768,6 @@ load 1629575-1.html
load 1629575-2.html
load 1630385.html
load 1633434.html
load 1633737-1.html
load 1633737-2.html
load 1633737-3.html
load 1633737-4.html
load 1633737-5.html
load 1633828.html
load 1640028.html
load 1640051.html

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

@ -1024,19 +1024,9 @@ struct nsGridContainerFrame::TrackSizingFunctions {
if (!aIsSubgrid) {
ExpandNonRepeatAutoTracks();
}
#ifdef DEBUG
if (mHasRepeatAuto) {
MOZ_ASSERT(mExpandedTracks.Length() >= 1);
const unsigned maxTrack = kMaxLine - 1;
// If the exanded tracks are out of range of the maximum track, we
// can't compare the repeat-auto start. It will be removed later during
// grid item placement in that situation.
if (mExpandedTracks.Length() < maxTrack) {
MOZ_ASSERT(mRepeatAutoStart < mExpandedTracks.Length());
}
}
#endif
MOZ_ASSERT(!mHasRepeatAuto ||
(mExpandedTracks.Length() >= 1 &&
mRepeatAutoStart < mExpandedTracks.Length()));
}
public:
@ -1112,31 +1102,21 @@ struct nsGridContainerFrame::TrackSizingFunctions {
}
/**
* Initialize the number of auto-fill/fit tracks to use.
* This can be zero if no auto-fill/fit track was specified, or if the repeat
* begins after the maximum allowed track.
* Initialize the number of auto-fill/fit tracks to use and return that.
* (zero if no auto-fill/fit track was specified)
*/
void InitRepeatTracks(const NonNegativeLengthPercentageOrNormal& aGridGap,
nscoord aMinSize, nscoord aSize, nscoord aMaxSize) {
const uint32_t maxTrack = kMaxLine - 1;
// Check for a repeat after the maximum allowed track.
if (MOZ_UNLIKELY(mRepeatAutoStart >= maxTrack)) {
mHasRepeatAuto = false;
mRepeatAutoStart = 0;
mRepeatAutoEnd = 0;
return;
}
uint32_t repeatTracks =
uint32_t InitRepeatTracks(const NonNegativeLengthPercentageOrNormal& aGridGap,
nscoord aMinSize, nscoord aSize, nscoord aMaxSize) {
const uint32_t repeatTracks =
CalculateRepeatFillCount(aGridGap, aMinSize, aSize, aMaxSize) *
NumRepeatTracks();
// Clamp the number of repeat tracks to the maximum possible track.
repeatTracks = std::min(repeatTracks, maxTrack - mRepeatAutoStart);
SetNumRepeatTracks(repeatTracks);
// Blank out the removed flags for each of these tracks.
mRemovedRepeatTracks.SetLength(repeatTracks);
for (auto& track : mRemovedRepeatTracks) {
track = false;
}
return repeatTracks;
}
uint32_t CalculateRepeatFillCount(
@ -1145,23 +1125,13 @@ struct nsGridContainerFrame::TrackSizingFunctions {
if (!mHasRepeatAuto) {
return 0;
}
// At this point no tracks will have been collapsed, so the RepeatEndDelta
// should not be negative.
MOZ_ASSERT(RepeatEndDelta() >= 0);
// Note that this uses NumRepeatTracks and mRepeatAutoStart/End, although
// the result of this method is used to change those values to a fully
// expanded value. Spec quotes are from
// https://drafts.csswg.org/css-grid/#repeat-notation
const uint32_t numTracks = mExpandedTracks.Length() + RepeatEndDelta();
const uint32_t repeatDelta = mHasRepeatAuto ? NumRepeatTracks() - 1 : 0;
const uint32_t numTracks = mExpandedTracks.Length() + repeatDelta;
MOZ_ASSERT(numTracks >= 1, "expected at least the repeat() track");
if (MOZ_UNLIKELY(numTracks >= kMaxLine)) {
// The fixed tracks plus an entire repetition is either larger or as
// large as the maximum track, so we do not need to measure how many
// repetitions will fit. This also avoids needing to check for if
// kMaxLine - numTracks would underflow at the end where we clamp the
// result.
return 1;
}
nscoord maxFill = aSize != NS_UNCONSTRAINEDSIZE ? aSize : aMaxSize;
if (maxFill == NS_UNCONSTRAINEDSIZE && aMinSize == 0) {
// "Otherwise, the specified track list repeats only once."
@ -1221,6 +1191,7 @@ struct nsGridContainerFrame::TrackSizingFunctions {
// Clamp the number of repeat tracks so that the last line <= kMaxLine.
// (note that |numTracks| already includes one repeat() track)
MOZ_ASSERT(numTracks >= NumRepeatTracks());
MOZ_ASSERT(kMaxLine > numTracks);
const uint32_t maxRepeatTrackCount = kMaxLine - numTracks;
const uint32_t maxRepetitions = maxRepeatTrackCount / NumRepeatTracks();
return std::min(numRepeatTracks, maxRepetitions);

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

@ -1608,18 +1608,8 @@ already_AddRefed<CSSValue> nsComputedDOMStyle::GetGridTemplateColumnsRows(
const auto repeatLineNames = autoRepeatValue->line_names.AsSpan();
MOZ_ASSERT(repeatLineNames.Length() >= 2);
// Number of tracks inside the repeat, not including any repetitions.
// Check that if we have truncated the number of tracks due to overflowing
// the maximum track limit then we also truncate this repeat count.
MOZ_ASSERT(repeatLineNames.Length() ==
autoRepeatValue->track_sizes.len + 1);
// If we have truncated the first repetition of repeat tracks, then we
// can't index using autoRepeatValue->track_sizes.len, and
// aTrackInfo.mRemovedRepeatTracks.Length() will account for all repeat
// tracks that haven't been truncated.
const uint32_t numRepeatTracks =
std::min(aTrackInfo.mRemovedRepeatTracks.Length(),
autoRepeatValue->track_sizes.len);
MOZ_ASSERT(repeatLineNames.Length() >= numRepeatTracks + 1);
const uint32_t numRepeatTracks = autoRepeatValue->track_sizes.len;
MOZ_ASSERT(repeatLineNames.Length() == numRepeatTracks + 1);
// The total of all tracks in all repetitions of the repeat.
const uint32_t totalNumRepeatTracks =
aTrackInfo.mRemovedRepeatTracks.Length();