Handling auto margins on replaced block-level elements

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Handling auto margins on replaced block-level elements

Boris Zbarsky
Right now we (on reflow branch) don't handle auto margins on block-level
replaced elements, because we set mComputedWidth to NS_INTRINSICSIZE, so can't
call CalculateBlockSideMargins.

One reasonable way I see around this is to precompute the mComputedWidth right
there in ComputeBlockBoxData.

So what I'd like to propose is that we expose an nsIFrame method to get the
intrinsic width, height, and aspect ratio of a replaced element frame.  Most
frames would simply return something to indicate they have no such thing, of
course.  But images could return their width and height, and then we could moev
the CSS2.1 sizing algorithm out of nsImageFrame into nsHTMLReflowState or
nsLayoutUtils or whatever.  The net result will be that in nsImageFrame::Reflow
we will always have an mComputedWidth and mComputedHeight set, of course.

The other way to do this would involve fixing up the margins after we have
performed reflow on the block-level replaced element.  I think this is what we
do right now, actually...

Thoughts?

-Boris
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout