The generated HTML is like <p>some text <div …>…</div> more text</p>, and HTML <p/> tags may not contain block content like <div/> tags. Browsers actually parse this as if it was <p>some text </p><div …>…</div> more text<p></p> (sic).
The layout CSS class already has display: inline set, but this is not sufficient. Browser's HTML parser doesn't care what CSS rules will be applied, it only deals with the meanings of tags.
Fixes T7201.