зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1234644 - [css-grid] Avoid calling GetROCSSValueList() when we don't need the allocated object. r=dholbert
This commit is contained in:
Родитель
c6af622ba4
Коммит
9fe8aabea0
|
@ -107,4 +107,4 @@ fuzzy-if(winWidget,1,36) == grid-auto-min-sizing-definite-001.html grid-auto-min
|
|||
== grid-repeat-auto-fill-fit-003.html grid-repeat-auto-fill-fit-003-ref.html
|
||||
== grid-repeat-auto-fill-fit-004.html grid-repeat-auto-fill-fit-004-ref.html
|
||||
== grid-repeat-auto-fill-fit-005.html grid-repeat-auto-fill-fit-005-ref.html
|
||||
# == grid-repeat-auto-fill-fit-006.html grid-repeat-auto-fill-fit-006-ref.html (bug 1234644)
|
||||
== grid-repeat-auto-fill-fit-006.html grid-repeat-auto-fill-fit-006-ref.html
|
||||
|
|
|
@ -2480,41 +2480,39 @@ nsComputedDOMStyle::GetGridTemplateColumnsRows(const nsStyleGridTemplate& aTrack
|
|||
uint32_t numSizes = aTrackList.mMinTrackSizingFunctions.Length();
|
||||
MOZ_ASSERT(aTrackList.mMaxTrackSizingFunctions.Length() == numSizes,
|
||||
"Different number of min and max track sizing functions");
|
||||
if (aTrackSizes) {
|
||||
numSizes = aTrackSizes->Length();
|
||||
MOZ_ASSERT(numSizes > 0 ||
|
||||
(aTrackList.HasRepeatAuto() && !aTrackList.mIsAutoFill),
|
||||
"only 'auto-fit' can result in zero tracks");
|
||||
}
|
||||
// An empty <track-list> is represented as "none" in syntax.
|
||||
if (numSizes == 0) {
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
return val.forget();
|
||||
}
|
||||
// Delimiting N (specified) tracks requires N+1 lines:
|
||||
// one before each track, plus one at the very end.
|
||||
MOZ_ASSERT(aTrackList.mLineNameLists.Length() ==
|
||||
aTrackList.mMinTrackSizingFunctions.Length() + 1,
|
||||
"Unexpected number of line name lists");
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
|
||||
// Delimiting N tracks requires N+1 lines:
|
||||
// one before each track, plus one at the very end.
|
||||
MOZ_ASSERT(aTrackList.mLineNameLists.Length() == numSizes + 1,
|
||||
"Unexpected number of line name lists");
|
||||
if (aTrackSizes) {
|
||||
// We've done layout on the grid and have resolved the sizes of its tracks,
|
||||
// so we'll return those sizes here. The grid spec says we MAY use
|
||||
// repeat(<positive-integer>, Npx) here for consecutive tracks with the same
|
||||
// size, but that doesn't seem worth doing since even for repeat(auto-*)
|
||||
// the resolved size might differ for the repeated tracks.
|
||||
const uint32_t numTracks = aTrackSizes->Length();
|
||||
MOZ_ASSERT(numTracks > 0 ||
|
||||
(aTrackList.HasRepeatAuto() && !aTrackList.mIsAutoFill),
|
||||
"only 'auto-fit' can result in zero tracks");
|
||||
if (numTracks == 0) {
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
return val.forget();
|
||||
}
|
||||
int32_t endOfRepeat = 0; // first index after any repeat() tracks
|
||||
int32_t offsetToLastRepeat = 0;
|
||||
if (aTrackList.HasRepeatAuto()) {
|
||||
// offsetToLastRepeat is -1 if all repeat(auto-fit) tracks are empty
|
||||
offsetToLastRepeat = numTracks + 1 - aTrackList.mLineNameLists.Length();
|
||||
offsetToLastRepeat = numSizes + 1 - aTrackList.mLineNameLists.Length();
|
||||
endOfRepeat = aTrackList.mRepeatAutoIndex + offsetToLastRepeat + 1;
|
||||
}
|
||||
MOZ_ASSERT(numTracks > 0);
|
||||
MOZ_ASSERT(numSizes > 0);
|
||||
for (int32_t i = 0;; i++) {
|
||||
if (aTrackList.HasRepeatAuto()) {
|
||||
if (i == aTrackList.mRepeatAutoIndex) {
|
||||
|
@ -2547,7 +2545,7 @@ nsComputedDOMStyle::GetGridTemplateColumnsRows(const nsStyleGridTemplate& aTrack
|
|||
const nsTArray<nsString>& lineNames = aTrackList.mLineNameLists[i];
|
||||
AppendGridLineNames(valueList, lineNames);
|
||||
}
|
||||
if (uint32_t(i) == numTracks) {
|
||||
if (uint32_t(i) == numSizes) {
|
||||
break;
|
||||
}
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче