Closed Bug 498986 Opened 15 years ago Closed 2 years ago

Remove Float Cache

Categories

(Core :: Layout: Floats, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: fantasai.bugs, Assigned: TYLin)

References

Details

Attachments

(2 files)

roc proposed to remove nsFloatCache &co and store the region on the float frame itself. A bit on nsLineBox would say whether float placeholders exist on the line, to optimize RecoverFloats and other lookups. RecoverFloats and the CheckPlaceholderInLine call seem to be the main places nsFloatCache is used. http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsBlockFrame.cpp#3997
Depends on: 499377

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: fantasai.bugs → nobody
Depends on: 492627, 381385

Nowadays, nsFloatCache stores no extra information but nsIFrame*, which makes
nsFloatCacheList and nsFloatCacheFreeList are just singly and Doubly linked
list of frames, respectively.

Most of this patch is a plain rewrite to use nsTArray APIs. There are two
rewrite that need more explanation.

  1. BlockReflowState::mFloatCacheFreeList is served as a temporarily list to
    avoid extra allocations of nsFloatCache. It takes the ownership of floats
    from a line via FreeFloats(), and later reuses the cache in AddFloat().
    We don't need this anymore, so we remove it.

  2. In PlaceBelowCurrentLineFloats(), the old code removes a float which
    needs to be pushed to next continuation from mBelowCurrentLineFloats.
    After looking through all of the floats, the remaining of
    mBelowCurrentLineFloats are moved to the line because they belong to the
    line. In this patch, rather than removing the pushed floats one by one from
    mBelowCurrentLineFloats, I use a new list to collect the floats that need
    to be added to the line, and just clear mBelowCurrentLineFloats at the
    end of the method.

Also, remove unused LINE_MAX_CHILD_COUNT in nsLineBox.h

Depends on D157976

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/9f2279973623 Part 1 - Use nsTArray<nsIFrame*> to store float list in nsLineBox and BlockReflowState. r=emilio https://hg.mozilla.org/integration/autoland/rev/cc8d417312b7 Part 2 - Remove unused nsFloatCache, nsFloatCacheList, and nsFloatCacheFreeList. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: