Last Comment Bug 578901 - Split blocks into blocks of blocks and blocks of inlines
: Split blocks into blocks of blocks and blocks of inlines
Status: NEW
:
Product: Core
Classification: Components
Component: Layout: Block and Inline (show other bugs)
: Trunk
: x86 Mac OS X
: P1 normal with 3 votes (vote)
: ---
Assigned To: Boris Zbarsky [:bz]
:
Mentors:
: 846040 (view as bug list)
Depends on:
Blocks: 76767 layoutperfarch
  Show dependency treegraph
 
Reported: 2010-07-14 22:09 PDT by Boris Zbarsky [:bz]
Modified: 2013-02-27 15:41 PST (History)
12 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Boris Zbarsky [:bz] 2010-07-14 22:09:17 PDT
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.
Comment 1 fantasai 2011-06-22 12:46:00 PDT
[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
Comment 2 David Baron :dbaron: ⌚️UTC+2 (review requests must explain patch) (vacation June 4-12) 2011-06-22 17:04:03 PDT
> 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
Comment 3 Boris Zbarsky [:bz] 2011-06-22 19:07:06 PDT
The plan I understood was exactly what comment 2 says, yes (trivial subclasses added initially, hg copy when doing the split).
Comment 4 Scott Johnson (:jwir3) 2013-02-27 15:41:30 PST
*** Bug 846040 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.