Closed Bug 498986 Opened 14 years ago Closed 4 months ago

Remove Float Cache


(Core :: Layout: Floats, defect)

Not set



107 Branch
Tracking Status
firefox107 --- fixed


(Reporter: fantasai.bugs, Assigned: TYLin)




(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.
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
Pushed by
Part 1 - Use nsTArray<nsIFrame*> to store float list in nsLineBox and BlockReflowState. r=emilio
Part 2 - Remove unused nsFloatCache, nsFloatCacheList, and nsFloatCacheFreeList. r=emilio
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.