Skip to content

Render split IFCs correctly #36

Open

Description

@chearon

I did not realize that

<span style="border: 1px solid green;">begin<div>d1</div>middle<div>d2</div>end</span>

renders like

Image

which is sort of specified in CSS2.1 in an example rather than with authoritative tone:

Properties set on elements that cause anonymous block boxes to be generated still apply to the boxes and content of that element. For example, if a border had been set on the BODY element in the above example, the border would be drawn around C1 (open at the end of the line) and C2 (open at the start of the line).

§9.2.1.1

I came across this when working on text-decoration. Decorations on inlines that get split must propagate to the block box that split them:

<s><u>begin<div>d1</div>middle<div>d2</div>end</span>
Image

I'm not ready for this. There's no existing mechanism I can leverage. But I'm glad I found the first issue, because it means I can call this a pre-existing issue and get text-decoration released.

My idea is: 2 more bits in the box bitfield need to be allocated: startPiece and endPiece. Most boxes have both (0b11) but in the examples above, "begin", "middle" and "end" are 0b10, 0b00 and 0b01.

Checking if an inline fragment is the start one for painting and during placement on the line is now startPiece && inline.textStart === fragment.textStart instead of just inline.textStart === fragment.textStart, same for end.

Propagating decorations might be trickier to do right, but it is clearly possible. If a box is 0b11 then it could be a splitter. If its previous sibling is 0b10, then it is, so propagate all of the decorations in the lineage from the block to its last inline child. Note that we can always check the previous sibling since a block splitting an inline always creates 2 sides.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions