Skip to content

Assertion failed in LineCandidates.inlinePost when an inline contains text and ends with a float #35

Description

@Endika

An inline that contains text and ends with an out-of-flow box throws during line building.

Repro

// throws: Assertion failed  (src/layout-text.ts:939, LineCandidates.inlinePost)
'<span>ab<div style="float:left"></div></span>'

Reproduces on unmodified master (1355269). Three things that are not required, all checked:

  • padding is irrelevant. The originally reported repro carried padding:4px; it makes no difference.
  • position: absolute is irrelevant. Stock float reproduces it. (This surfaced while grading implementations of position: absolute #6, but it is not an abspos bug.)
  • Order matters, and the reverse is fine.
    ab
    lays out without error, and so does an inline with no text at all.

So the trigger is precisely: text, then an out-of-flow box, then the end of the inline.

Cause

inlinePost asserts that the candidate list is non-empty, because it needs something to attach the inline's end space to. An out-of-flow box contributes no line item, so when it is the last child the list is empty at the point the inline closes and the assertion fires.

Why an issue and not a PR

Where an inline's end space should go when its last child is out of flow is a layout-semantics call: attaching it to the preceding in-flow item, emitting a zero-width item for the out-of-flow box, or skipping the end space entirely all give different results for margins and line width. That is your decision — happy to write whichever you prefer once you say which.ººº

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions