Open Bug 239310 Opened 20 years ago Updated 2 years ago

better way to find frame's containing block

Categories

(Core :: Layout, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

References

(Blocks 1 open bug)

Details

Currently the way we find frames' containing blocks is a mess, and is a bit of
an obstacle to refactoring reflow (since refactoring reflow would require
duplicating it in more places).  We find containing blocks using logic in
nsHTMLReflowState and using logic in nsCSSFrameConstructor.  The work in bug
135082 improves the former a bit, but both are quite messy and have bugs
floating around (like bug 233094 in the latter).

Perhaps a start for a new system would be a set of bits saying whether a frame
is a certain type of containing block.  The types are as follows:
 * block (any block, box, table cell)
 * float (any block or box whose parent is not a block or box or that has
'overflow: auto')
 * absolute (defined by CSS2 10.1)
 * fixed (defined by CSS2 10.1)

Unfortunately, floats care about both the block-type and float-type container,
which complicates things a little (and certainly already complicates our
implementation of floats).

I'm really not sure what to do here, but this seems like something we want to do
if we want to avoid refactoring nsHTMLReflowState in order to refactor reflow. 
Though maybe it's just better to split part of nsHTMLReflowState into a base
class and just move on.
s/'overflow: auto'/'overflow' not 'visible'/

Also, the float type currently corresponds to NS_BLOCK_SPACE_MGR, but it would
be more extensible if we used different conditions like the ones I described to
decide when we need to set it.
Revise that to
 * float (any block whose parent is not a block or that has
'overflow' not 'visible', or any box)
So the idea is to pass an enum value to IsContainingBlock and have the callee
handle it accordingly?  In which case nsPositionedInlineFrame (say) could just
check for a particular enum value?

Where's the nsCSSFrameConstructor code that looks for containing blocks?  Or do
you just mean the code that pushes floating/absolute/fixed containing blocks
into the state?
I mean the code that pushes them onto the state.
Come to think of it, the code that creates IB splits probably does something
like that too....
Depends on: 10209
With this new implementation: https://hg.mozilla.org/mozilla-central/rev/00f422b2cf36#l11.40, is this still a concern?
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
Assignee: dbaron → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.