Skip to content

[css-display] Does run-in algorithm run multiple times for each run-in sequence? #1460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Loirooriol opened this issue May 24, 2017 · 4 comments

Comments

@Loirooriol
Copy link
Contributor

Suppose I have this code

<span style="display: run-in">Foo</span>
<div>
  <p>Bar</p>
</div>

Then Run-In Layout says

If a run-in sequence is immediately followed by a block box that does not establish a new block formatting context, it is inserted as direct children of the block box

So the example above becomes

<div>
  <span style="display: run-in">Foo</span>
  <p>Bar</p>
</div>

But now the run-in sequence is still immediately followed by a block box that does not establish a new block formatting context.

Does the algorithm run again in order to obtain the following?

<div>
  <p><span style="display: run-in">Foo</span> Bar</p>
</div>

It think it should. But then, how to prevent the following quote from generating an infinite number of boxes?

Otherwise, an anonymous block box is generated around the run-in sequence and all immediately following inline-level content

<div>
  <p>
    <anonymous-block><span style="display: run-in">Foo</span> Bar</anonymous-block>
  </p>
</div>
<div>
  <p>
    <anonymous-block>
      <anonymous-block><span style="display: run-in">Foo</span> Bar</anonymous-block>
    </anonymous-block>
  </p>
</div>

And so on.

@tabatkins tabatkins added the css-display-3 Current Work label May 25, 2017
triple-underscore added a commit to triple-underscore/triple-underscore.github.io that referenced this issue Jul 6, 2017
Commits on Jul 6, 2017

Note that 'display: contents' does not affect property inheritance.
Fixes w3c/csswg-drafts#1473
w3c/csswg-drafts@356b3296d5b20e00bedbfa8d1db59
d005a73bfc9

Normatively define what was in the previous note: that run-in fixup
occurs before first line determination.
w3c/csswg-drafts@37c01a4ef94aec7c352c3dc7c5cfc
31f8898ed4d

Move computed value bullet before box generation bullet.
w3c/csswg-drafts@5d10db8d8665f52994530304f2ddc
88236d37ccb

Clarify that run-in fixup occurs before block/inline fixup.
w3c/csswg-drafts@6f6913e20851f50ad81ca3cb43a49
9c01e8b2186

Expand out informal definitions of BFC.
Also fixes w3c/csswg-drafts#1471 .
w3c/csswg-drafts@388b1fb3bfa7dbe2ed112581322d2
a10787c9121

Refer to 'flow layout' directly, rather than just mentioning the types
of boxes that flow layout can produce.
Fixes w3c/csswg-drafts#1470 .
w3c/csswg-drafts@09212af80e10e4e3e57965bb27b2d
e3fdcd86e06

Make the run-in recursion explicit, so it's clear the second step
doesn't recurse.
Fixes w3c/csswg-drafts#1460 .
w3c/csswg-drafts@c9f1bb16d0e5077b9bca7027a7d72
52eeff5abf1

Be a little looser about what counts as abspos, because css-lists
defines as out-of-flow.
Fixes w3c/csswg-drafts#1458
w3c/csswg-drafts@f7ff60660c3b5e1b31000ffa0f729
ba04f13a2f8

Remove the w3c/csswg-drafts#1390 inline issue.
w3c/csswg-drafts@4514b3e7f2f0aa8ef95a84c107fb9
90fc2def209

Add note about the two categories of box-tree fixup, and their relative
ordering.
Fixes w3c/csswg-drafts#1355 .
w3c/csswg-drafts@f5b79e99bb8fc9ebea4ed956ed342
0bc69b90786

Apply diff, per resolution.
Fixes w3c/csswg-drafts#1118 .
w3c/csswg-drafts@dbb7042481d132efcb6869ecbdf44
f338d8ad944
@fantasai
Copy link
Collaborator

Yes, the run-in algo's first step needs to recurse. Fixed, thanks!

@sandstrom
Copy link

Sorry if this is the wrong place to ask, but I'm wondering why run-in is marked as at risk?

It saddened me that run-in was removed from Chrome earlier.

It's very useful for writing semantic html (headings/paragraphs) while being able to style the heading to be part of the subsequent block. It is also useful in single-page apps where 'widgets' are composed of custom-elements/web-components, and the element should be separate in the html source, but presented as a run-in visually.

I really hope it can be re-introduced as part of css-display-3. The alternative to achieve similar styling is brittle and error prone (usually position:relative + top offset values).


Please let me know if there is another place that's better for comments like this.

@Loirooriol
Copy link
Contributor Author

@sandstrom Probably you should ask in a new issue. As far as I know, run-in as defined in CSS 2.1 was a fiasco which Firefox never implemented and other browsers decided to remove because of its buggy and problematic behavior. So it isn't surprising for web browsers to be reticent about implementing the new run-in definition. And see https://bugzilla.mozilla.org/show_bug.cgi?id=2056#c88

@sandstrom
Copy link

sandstrom commented Sep 12, 2017

thanks @Loirooriol for answering! 😄

Basically I just wanted to voice my support for run-in and offer some use-cases.

Do you think a comment in the bugzilla tracker with my use-cases would be helpful?

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

No branches or pull requests

4 participants