Re: [csswg-drafts] [css-shapes] Specify algorithms for computing line-box intrusion into float's margin box.

To summarize:

There are two algorithms that are imprecise:

- How to expand a shape by a given margin.  For definitions, you may want to look at the SVG stroke-shape algorithms, but beware that this is an "outside" stroke which isn't yet explicitly defined in SVG (although it's an outside stroke on an always-closed shape, so that helps). See

  That said, shape-outside also needs to apply to shapes generated by the opacity threshold on an image, so the definition needs to work even if you don't have a crisp mathematical definition of the shape.

- Given a final shape (with margin included), how do you trim line boxes to fit up against it?  E.g., in the diagram in [Example 7 in the spec](, it looks like the corners of the 1em-high basic line boxes are fitted tight against the final float shape, but expansions of the line box from line leading is ignored.  Now, that's probably just a matter of making a nice diagram rather than a conscious choice. But when writing the code, you need to know whether you need to leave space for the half-leading on either side of the line of text.

  And as Tab points out, then there's the question of how to find the intersection point of a rectangle and an arbitrary shape (which may not have a mathematical definition) in an algorithmically efficient way. Especially when you factor in that each rectangle has a minimum content width associated with it, and that you may need to slide the rectangle down until you find a place where it can fit.

Given that neither of these calculations have crisp, clear algorithms for finding the optimal solution, I'd be hesitant about baking a full algorithm into the spec. But I do agree that there should probably be some clarifications.

GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at using your GitHub account

Received on Thursday, 26 July 2018 18:59:53 UTC