Bug 1867789 - Use the reference to a pointer to avoid recreating a new ImplicitNamedAreas in each iteration. r=emilio

I forgot to use a reference when doing the refactoring. We should use a
reference to a pointer because we rely on the information from the previous
iteration, in the private function, `AddImplicitNamedAreasInternal()`.

Note: I don't have a test for this. This bug is from a real website:
https://www.oddbird.net/tools/, and it's not easy to reduce the
testcase, so we may need a QA to verify this by the real website.

Differential Revision: https://phabricator.services.mozilla.com/D195388
This commit is contained in:
Boris Chiou 2023-12-04 12:08:47 +00:00
Родитель 747875e612
Коммит 4f701f918d
2 изменённых файлов: 3 добавлений и 2 удалений

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

@ -3959,7 +3959,8 @@ nsContainerFrame* NS_NewGridContainerFrame(PresShell* aPresShell,
}
void nsGridContainerFrame::AddImplicitNamedAreasInternal(
LineNameList& aNameList, nsGridContainerFrame::ImplicitNamedAreas* aAreas) {
LineNameList& aNameList,
nsGridContainerFrame::ImplicitNamedAreas*& aAreas) {
for (const auto& nameIdent : aNameList.AsSpan()) {
nsAtom* name = nameIdent.AsAtom();
uint32_t indexOfSuffix;

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

@ -513,7 +513,7 @@ class nsGridContainerFrame final : public nsContainerFrame,
// The internal implementation for AddImplicitNamedAreas().
void AddImplicitNamedAreasInternal(LineNameList& aNameList,
ImplicitNamedAreas* aAreas);
ImplicitNamedAreas*& aAreas);
/**
* Cached values to optimize GetMinISize/GetPrefISize.