Closed Bug 1794035 Opened 2 years ago Closed 2 years ago

More nsFrameList improvement and clean up

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(4 files)

After finishing bug 1793826, I discover more opportunities to improve nsFrameList. See the patches' commit message for details.

I feel it's hard to understand the purpose of ExtractHead(), especially where
aFrame is going after the call. Therefore, I rename it to RemoveFramesBefore(),
and have it complement the existing RemoveFramesAfter(). No behavioral change
intended.

Also, slightly reword the method's documentation to reflect the its new
name. (Remove the "sibling" wording from the comment since it's an
implementation details that frames are actually a doubly linked list.)

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

RemoveFramesAfter and ExtractTail have similar purpose, so we really should keep
one of them to avoid confusion.

They have the following minor differences:

  1. RemoveFramesAfter() keeps aFrame in the list, while ExtractTail() returns it.
  2. If aFrame is empty, RemoveFramesAfter() returns the entire list, while
    ExtractTail returns an empty list.

It's more convenient for the existing callers to use the RemoveFramesAfter(), so
ExtractTail is unneeded.

After this patch, both RemoveFramesAfter() and RemoveFramesBefore() return the
entire list if aFrame is nullptr.

This change shouldn't change the behavior.

Depends on D158806

Also, HasPushedFloatsFromPrevContinuation() is larger enough to live in cpp.

After this patch, we still need nsFrameList::Enumerator to iterate
nsFrameList::Slice. We might enhance nsFrameList::Iterator to support Slice, but
I'll leave this for another day.

Depends on D158808

Attachment #9297496 - Attachment description: Bug 1794035 Part 1 - Rename nsFrameList::ExtractHead to RemoveFramesBefore. r?#layout → Bug 1794035 Part 1 - Rename nsFrameList::ExtractHead to TakeFramesBefore. r?#layout
Attachment #9297497 - Attachment description: Bug 1794035 Part 2 - Improve RemoveFramesAfter's implementation, and remove ExtractTail. r?#layout → Bug 1794035 Part 2 - Rename RemoveFramesAfter, improve its implementation, and remove ExtractTail. r?#layout
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/1287c6591e6b
Part 1 - Rename nsFrameList::ExtractHead to TakeFramesBefore. r=emilio
https://hg.mozilla.org/integration/autoland/rev/30770c70f020
Part 2 - Rename RemoveFramesAfter, improve its implementation, and remove ExtractTail. r=emilio
https://hg.mozilla.org/integration/autoland/rev/14ff4ca235d1
Part 3 - Move nsBlockFrame::HasPushedFloatsFromPrevContinuation() implementation to cpp. r=emilio
https://hg.mozilla.org/integration/autoland/rev/d96df925c943
Part 4 - Use range-based for loops to iterate nsFrameList. r=emilio
Blocks: 1794456
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: