Skip to content

[css-display] Blockification doesn't seem backwards-compatible for inline-blocks #1246

Closed

Description

@bzbarsky

What happens if I absolutely position an inline-block? Per current browser behavior it becomes a "block". Per the css-display-3 draft it becomes a "flow-root", if blockification only affects display-outside. Is that a purposeful behavior change?

Activity

  1. fantasai commented on Apr 19, 2017

    @fantasai
    Collaborator

    Not an intentional change. :(

  2. fantasai commented on Apr 19, 2017

    @fantasai
    Collaborator

    I believe this is fixed in 4d50007

    Please re-open if that's not the case and there's something I missed.

  3. bzbarsky commented on Apr 19, 2017

    @bzbarsky
    Author

    I think one of us is missing something, but I'm not sure whether it's me or you. ;)

    Per the table at https://www.w3.org/TR/css-display-3/#legacy-display 'inline-block' "behaves as 'inline flow-root'". But per https://www.w3.org/TR/css-display-3/#the-display-properties the computed value of 'display' is the specified value... So if I have 'inline-block' specified, it computes to 'inline-block', not 'inline flow-root'. OK, fine.

    But then https://www.w3.org/TR/css-display-3/#transformations talks about just changing the outer display to 'block' and does not change the inner display. What does that actually mean in terms of the computed value? I see a few options:

    1. The precomposed value is decomposed to two keywords, the outer display is changed to 'block', and the new computed value is the resulting two-keyword value. That would give 'block flow-root'.
    2. The precomposed value is decomposed to two keywords, the outer display is changed to 'block', and the new computed value is the precomposed value that corresponds to the new two-keyword value. That would give 'flow-root'.
    3. The computed value is 'block'. This is what browsers do right now, but I see no way to get there via the spec as currently written.

    Note that the used value is likely 'block flow-root' in all cases, because things that cause blockification also lead to flow-root behavior. The question is what the computed value is.

  4. changed the title [-][css-display-3] Blockification doesn't seem backwards-compatible for inline-blocks[/-] [+][css-display] Blockification doesn't seem backwards-compatible for inline-blocks[/+] on Apr 19, 2017
  5. Loirooriol commented on Apr 20, 2017

    @Loirooriol
    Contributor

    The spec says "Computed value: as specified". So the display property sets the display type, but transformations of the display type don't affect the computed value of display. That's how I read it, but clearly it's not what browsers do.

  6. bzbarsky commented on Apr 20, 2017

    @bzbarsky
    Author

    The spec also explicitly says that the transformations transform the computed value. Yes, the spec is kinda self-contradictory; not the first time.

  7. fantasai commented on May 15, 2017

    @fantasai
    Collaborator

    Okay, so, there are two ways we can handle this:

    • Treat inline-block and inline flow-root as syntactically equivalent. Make both of them blockfy as display: block.
    • Treat inline-block and inline flow-root as syntactically distinct. Make inline-block blockify as display: block; inline flow-root will blockify as flow-root.

    The advantage of the first approach is that the various inline-foo models are all syntactic equivalents of their two-keyword inline foo forms. This is a nice consistency to have.

    The advantage of the second approach is that, aside from the inline-block keyword itself, everything maintains its display type as specified with the mere substitution of block for inline or run-in (and shortening of serialized output per normal CSSOM rules).

    Is there a reason to prefer one solution over the other?

  8. 3 remaining items

  9. SelenIT commented on Jun 1, 2017

    @SelenIT
    Collaborator

    Note that the used value is likely 'block flow-root' in all cases, because things that cause blockification also lead to flow-root behavior.

    I believe that the quoted part is really important. Before flow-root value was introduced, using block as a value to use/report and describing that it also establishes the new BFC in prose was the only option. Now, when we have the value that describes both things, what stops us from using flow-root for both computed and used values in all the relevant cases (except legacy reasons)?

  10. bzbarsky commented on Jun 1, 2017

    @bzbarsky
    Author

    The computed value affects not just what's "reported", but also what's inherited.

    So if you have a thing that gets blockified and a child that has "display: inherit", should that child end up as a flow root or not? Why or why not?

    (And of course "legacy reasons" might trump everything else in practice.)

  11. tabatkins commented on Jun 1, 2017

    @tabatkins
    Member

    Inheritance isn't even a big deal, honestly (who the hell writes display: inherit? don't tell me, it'll just depress me).

    The big deal is serialization; things that used to serialize to "block" have to continue to do so, but if they become block flow-root they'll serialize to "flow-root" instead.

    Future things that blockify might want to explicitly FC-ify as well, which can change the serialization just fine, but we have a lot of legacy to think about.

  12. fantasai commented on Jul 5, 2017

    @fantasai
    Collaborator

    Thinking about this more, I have some very strong reservations to the resolution recorded here. Specifically, because we do some automatic transformations (as when 'writing-mode' or ruby fixup turns things into inline blocks), and a) it's not clear to me which serialization we choose or why and also b) it creates an opportunity for inconsistencies across the specs, if different ones choose different serializations here.

  13. fantasai commented on Mar 19, 2018

    @fantasai
    Collaborator
  14. Loirooriol commented on Mar 19, 2018

    @Loirooriol
    Contributor

    if an inline flow-root box is blockified, it becomes a block box (losing its flow-root nature).

    I think blockifications should trigger becoming a formatting context to ensure that flow-root is not really lost (at used value time).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions