Support range-based for loop for nsFrameList::Slice, and remove nsFrameList::Enumerator
Categories
(Core :: Layout, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox107 | --- | fixed |
People
(Reporter: TYLin, Assigned: TYLin)
References
Details
Attachments
(4 files)
This bug concludes the trilogy of my nsFrameList
clean up (previous in bug 1793826 and bug 1794035).
Assignee | ||
Comment 1•2 years ago
|
||
If we traverse a frame list via Iterator::operator--() repeatedly, when it
reaches the beginning of the list (mCurrent's previous sibiling is null), it
will start over from the end of the list. This behavior can be surprising, so it
is removed. Also, remove Iterator::mList since it's no longer needed.
We don't really need to rely on mozilla::ReverseIterator to implement
nsFrameList::reverse_iterator. We can abstract frame traversal operations as a
template parameter, and implement reverse_iterator directly. This is more
performant since mozilla::ReverseIterator makes a copy of the original iterator
when dereferencing the reverse iterator.
Iterator(nullptr) is now served as a end iterator for both the iterator and
reverse_iterator.
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
They are set but never used.
Depends on D158984
Assignee | ||
Comment 3•2 years ago
|
||
Since Slice::mEnd is the first frame that is NOT in the slice, so we only
support forward iteration, and it's sufficient to replace existing usages of
nsFrameList::Enumerator.
For those for loops iterating TableColFrame and TableColGroupFrame, we need to
explicitly check the validity of the iterator because they modify the frame list
while iterating. nsFrameList::Enumerator::End() has a hack for this.
https://searchfox.org/mozilla-central/rev/ffa4d00965c5281def6d3ddcbcdf6259d38c9b9a/layout/generic/nsFrameList.h#402-407
Depends on D158985
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D158986
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/7f0b494afb59 Part 1 - Reimplement reverse iterator for nsFrameList. r=emilio https://hg.mozilla.org/integration/autoland/rev/58733fee05e0 Part 2 - Remove DEBUG members in nsFrameList::Slice and nsFrameList::Enumerator. r=emilio https://hg.mozilla.org/integration/autoland/rev/dd14514b9e99 Part 3 - Support range-based for loop for nsFrameList::Slice. r=emilio https://hg.mozilla.org/integration/autoland/rev/99069a63ec27 Part 4 - Remove unused nsFrameList::Enumerator. r=emilio
Comment 6•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7f0b494afb59
https://hg.mozilla.org/mozilla-central/rev/58733fee05e0
https://hg.mozilla.org/mozilla-central/rev/dd14514b9e99
https://hg.mozilla.org/mozilla-central/rev/99069a63ec27
Description
•