Re: [csswg-drafts] [css-display] Define how display: contents behaves in MathML.

I discussed this a bit at Igalia. Here is a concrete example:
    
    <math>
      <mfrac>
        <mrow style="background: green; color: red; display: contents">
          <mi>x</mi>
          <mo>+</mo>
          <mi>y</mi>
        </mrow>
        <mn>2</mn>
      </mfrac>
    </math>

WebKit and Gecko currently ignore "display: contents" so you will see the fraction numerator with green background.

If instead you treat "display: contents" as "display: none" then it will look like this:
    
    <math>
      <mfrac>
        <mrow style="display: none">
          <mi>x</mi>
          <mo>+</mo>
          <mi>y</mi>
        </mrow>
        <mn>2</mn>
      </mfrac>
    </math>

Gecko and WebKit don't create a box for the numerator and so the fraction is rendered as invalid markup (WebKit actually displays nothing because of https://bugs.webkit.org/show_bug.cgi?id=123348) which is different from the current implementation of display: contents. I guess it's easy to implement, just say "display: none" won't create layout/renderer classes and the MathML code will take care of the rest.

Another option is to basically "ignore the math layout" so 

    <math>
      <mfrac style="background: green; color: red; display: contents">
        <mi>x</mi>
        <mi>y</mi>
      </mfrac>
    </math>

is treated as just

    <math>
      <mi style="color: red;">x</mi>
      <mi style="color: red;">y</mi>
    </math>

with the fraction and background ignored. But things might become more complicated to understand and implement (the first example would be treated as a fraction with 4 elements so invalid) and it's not clear whether there is a concrete use case in practice.

Note that we already have similiar situations like borders or absolute positioning where Gecko or WebKit just ignore CSS properties or choose the option that is the most convenient for implementers. So it seems either keeping "display: content" or changing implementations to match "display: none" is the most appropriate option for MathML.

    @emilio: What is your opinion on this? What will be the easiest for Mozilla?


-- 
GitHub Notification of comment by fred-wang
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2167#issuecomment-375602617 using your GitHub account

Received on Friday, 23 March 2018 10:06:18 UTC