RESOLVED FIXED 44206
Alignment of block MathML differs between WebKit and Firefox
https://bugs.webkit.org/show_bug.cgi?id=44206
Summary Alignment of block MathML differs between WebKit and Firefox
Randall Farmer
Reported Wednesday, August 18, 2010 11:14:19 PM UTC
In Firefox, blocks of math at that URL are centered. In WebKit, they're not. Looks like a user-agent CSS difference; Firefox's mathml.css has: math[mode="display"], math[display="block"] { display: block; text-align:-moz-center; } WebKit has: math[display="block"] { display: block; margin-bottom: 1em; page-break-inside: avoid; }
Attachments
Patch (64.80 KB, patch)
2010-09-02 12:23 PDT, François Sausset
no flags
Revised patch (64.85 KB, patch)
2010-09-03 09:57 PDT, François Sausset
no flags
François Sausset
Comment 1 Thursday, September 2, 2010 1:28:07 PM UTC
The w3c MathML3 recommendation specifies nothing about that. See: http://www.w3.org/TR/MathML3/chapter2.html#interf.toplevel.atts Specifically this part: "specifies whether the enclosed MathML expression should be rendered as a separate vertical block (in display style) or inline, aligned with adjacent text. When display="block", displaystyle is initialized to "true", whereas when display="inline", displaystyle is initialized to "false"; in both cases scriptlevel is initialized to 0 (See Section 3.1.6 Displaystyle and Scriptlevel). Moreover, when the math element is embedded in a larger document, a block math element should be treated as a block element as appropriate for the document type (typically as a new vertical block), whereas an inline math element should be treated as inline (typically exactly as if it were a sequence of words in normal text). In particular, this applies to spacing and linebreaking: for instance, there should not be spaces or line breaks inserted between inline math and any immediately following punctuation. When the display attribute is missing, a rendering agent is free to initialize as appropriate to the context." However, centering the text seems natural in a mathematical context. For homogeneity with other MathML implementation, we should probably center the text.
François Sausset
Comment 2 Thursday, September 2, 2010 1:38:01 PM UTC
I just tested with Amaya and text is not centered (as expected by a strict interpretation of the mathml3 recommendation)! I'll try to have a look at other implementations.
Alex Milowski
Comment 3 Thursday, September 2, 2010 2:56:20 PM UTC
I think adding these properties to our math[display="block"] rule should fix this: margin-left: auto; margin-right: auto; Centering block mathematics is common practice. We should default to centering and people can turn it off in their own stylesheets.
François Sausset
Comment 4 Thursday, September 2, 2010 8:23:37 PM UTC
Created attachment 66394 [details] Patch Patch (using text-align: center;) + test. After a discussion on the www-math@w3.org mailing list, a consensus arose for a centered math element (like in Firefox and MathPlayer).
Alex Milowski
Comment 5 Thursday, September 2, 2010 9:54:08 PM UTC
Using "text-align: center" is not what we want. This will make the contained children align center. We need to use auto left/right margins via: margin-left: auto; margin-right: auto; that will make sure the left and right margins have equal value and the net effect is the block is centered in the block stacking direction (block flow).
François Sausset
Comment 6 Friday, September 3, 2010 5:57:58 PM UTC
Created attachment 66511 [details] Revised patch In fact, both text and block flows have to be centered, depending if the width of the block is fixed or inherited. Thus, I added auto margins in addition to text centering.
Beth Dakin
Comment 7 Tuesday, September 7, 2010 7:25:15 PM UTC
Comment on attachment 66511 [details] Revised patch r=me
WebKit Commit Bot
Comment 8 Tuesday, September 7, 2010 8:32:33 PM UTC
Comment on attachment 66511 [details] Revised patch Clearing flags on attachment: 66511 Committed r66899: <http://trac.webkit.org/changeset/66899>
WebKit Commit Bot
Comment 9 Tuesday, September 7, 2010 8:32:38 PM UTC
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 10 Tuesday, September 7, 2010 9:25:26 PM UTC
http://trac.webkit.org/changeset/66899 might have broken GTK Linux 32-bit Release The following changes are on the blame list: http://trac.webkit.org/changeset/66899 http://trac.webkit.org/changeset/66900
Note You need to log in before you can comment on or make changes to this bug.