Open Bug 578901 Opened 14 years ago Updated 2 years ago

Split blocks into blocks of blocks and blocks of inlines

Categories

(Core :: Layout: Block and Inline, defect, P3)

x86
macOS
defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 2 open bugs)

Details

We should do this, so that we can simplify block and inline reflow.

Implementation notes so far:

1)  Anonymous blocks created to wrap inlines should probably ignore their
    text-indent, unless they're the first such block in their parent.  Add a
    test for this.
2)  Floats should probably be parented to the anonymous blocks.  This means we
    want to do the analysis on frame construction item lists, not on frame
    lists; reparenting floats is a pain.
3)  Need to think about dynamic insertions.
Priority: -- → P2
Priority: P2 → P3
Priority: P3 → P1
[Notes from this morning]

This will create two subclasses of nsBlockFrame, tentatively called
  nsBlockContextFrame - block of blocks
  nsInlineContextFrame - block of inlines

Plan so far is to do the {ib} analysis on frame items, then have special code to optimize common mutations such as appends.

For appending a block to a list of inlines, the optimization would
  1. mutate the containing nsInlineContextFrame into an anonymous block
  2. insert a new primary nsBlockContextFrame as its parent
  3. append the block to the new primary frame's child list.
This avoids reparenting the inlines.

Cases where we escape into reconstructing frames:
  - out of flows
  - scrollframes
  - multicol
We can optimize some of these later if needed.

The root element, and SVG foreign object will be nsBlockContextFrames. XULdesc, table cells, and buttons need analysis to know which is appropriate as usually nsInlineContextFrame will be appropriate. Not sure about XulBoxContainingNonBoxes.

Plan:
  1. Add nsIFrame->ReplaceFrame implementation
  2. Create nsBlockContextFrame and nsInlineContextFrame via hg copy as
     subclasses of nsBlockFrame
  3. Frame construction (bzbarsky)
     a. rewrite {ib} to analyze FCItems
     b. do whitespace analysis on FCItems
     c. construct nsBlockContextFrame or nsInlineContextFrame as appropriate
  4. Splitting nsBlockFrame (fantasai)
     a. Remove unused code from the new frame classes
     b. Remove nsLineBox from nsBlockContextFrame
Blocks: 76767
> Plan:
>   1. Add nsIFrame->ReplaceFrame implementation
>   2. Create nsBlockContextFrame and nsInlineContextFrame via hg copy as
>      subclasses of nsBlockFrame

If they're subclasses, why do you need hg copy?

>   4. Splitting nsBlockFrame (fantasai)
>      a. Remove unused code from the new frame classes
>      b. Remove nsLineBox from nsBlockContextFrame

A possible alternative that I might prefer is:

 2. add trivial subclasses to nsBlockFrame.h/cpp
 4. do an hg copy to new files and split the code appropriately
The plan I understood was exactly what comment 2 says, yes (trivial subclasses added initially, hg copy when doing the split).
I am not going to be doing this any time soon.
Assignee: bzbarsky → nobody
Decreasing the priority as no update for the last 2 years on this bug.
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage 
about the priority meaning.
Priority: P1 → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.