WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
44208
Multi-character and some Unicode <mi>s italic in WebKit but not Firefox
https://bugs.webkit.org/show_bug.cgi?id=44208
Summary
Multi-character and some Unicode <mi>s italic in WebKit but not Firefox
Randall Farmer
Reported
2010-08-18 15:32:51 PDT
Firefox's behavior seems to be that if a <mi> contains two or more characters, it's rendered in normal rather than italic style and there's space around it, and if it's a single character, it's italicized and no space. So, for example, <mi>unitless</mi><mi>parameterization</mi> in the first table in the linked page appears as two non-italic words in Firefox and one italic word in WebKit. (I'm sorry in advance if some of these bugs are unhelpful or invalid according to the standard; I'm just going through a page that heavily uses MathML and documenting what looks off. And I absolutely love that WebKit is adding MathML support.)
Attachments
testcase
(227 bytes, text/html)
2013-12-19 08:42 PST
,
Frédéric Wang (:fredw)
no flags
Details
Patch V1
(30.06 KB, patch)
2014-02-06 05:42 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V1
(30.17 KB, patch)
2014-02-06 05:46 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V2
(30.67 KB, patch)
2014-02-06 07:00 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V3
(30.58 KB, patch)
2014-02-06 10:40 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Randall Farmer
Comment 1
2010-08-18 15:48:32 PDT
Firefox also seems to space and not slant some symbols, like blackboard bold letters. The first math on the linked page is: "q(s): ℝ→ℝ." In Firefox, the blackbold bold R's are not slanted; in WebKit, they are. Firefox may have a whitelist of single characters that it slants in <mi>; for example, it slanted <mi>Π</mi> but not <mi>ü</mi> when I put that text in Firebug. I suppose the source, or some document or other, likely has the precise answer.
François Sausset
Comment 2
2010-09-02 05:55:11 PDT
About italicized <mi> with more than one character: we were aware of that problem and I'm currently working on it. For slanted ℝ, thanks to report it. I'll have a look at the MathML3 specification, but it seems natural that "special" characters shouldn't be italicized. Every help (testing, bug reports, etc) is welcomed! Thanks!
François Sausset
Comment 3
2010-09-02 06:14:58 PDT
Here is the MathML3 recommendation answer about special characters:
http://www.w3.org/TR/MathML3/chapter7.html#chars.BMP-SMP
Frédéric Wang (:fredw)
Comment 4
2013-05-04 22:51:36 PDT
Yes, invariant characters should not be italicized:
https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
See also
bug 108778
.
Frédéric Wang (:fredw)
Comment 5
2013-12-19 08:42:57 PST
Created
attachment 219653
[details]
testcase
Frédéric Wang (:fredw)
Comment 6
2014-02-06 05:42:58 PST
Created
attachment 223326
[details]
Patch V1 This patch fixes the most important situation (testcase and referenced URL) with multi-char vs sing-char mi. There are some known issues (cf tests): - things like <mi mathvariant="normal">x</mi> seems to produce the wrong spacing (or width?) - some dynamically created content are not italicized Since the WebKit's spacing is currently poor and since there are issues with dynamic updates, I think we can ignore these issues for now. Actually this is part of
bug 124838
which prepares for the operator dictionary and further improvements ; so it might be worth taking this small piece and get feedback on it now rather than working on the big patch which seems to scare potential reviewers. Note that instead of CSS style this should rather do some code point remapping inside the text rendering code. However, it's ok for now: Gecko has used that approximation for a long time (see
https://bugzilla.mozilla.org/show_bug.cgi?id=114365
and
https://bugzilla.mozilla.org/show_bug.cgi?id=930504
) and MathJax does not implement mi/mathvariant properly.
Frédéric Wang (:fredw)
Comment 7
2014-02-06 05:46:29 PST
Created
attachment 223327
[details]
Patch V1 Sorry, wrong patch.
Frédéric Wang (:fredw)
Comment 8
2014-02-06 07:00:11 PST
Created
attachment 223331
[details]
Patch V2 It looks like the changes to CMakelist.txt were lost when I extracted the code for <mi> from
attachment 222977
[details]
...
chris fleizach
Comment 9
2014-02-06 09:06:16 PST
Comment on
attachment 223331
[details]
Patch V2 View in context:
https://bugs.webkit.org/attachment.cgi?id=223331&action=review
> Source/WebCore/ChangeLog:8 > + This test prevents multi-char <mi> to be drawn in italic and prepare
can you explain what further improvements it prepares for
> Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:2 > + * Copyright (C) 2013 Frédéric Wang (
fred.wang@free.fr
). All rights reserved.
2014
> Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:29 > +#include "RenderMathMLToken.h"
i think this line goes right below config.h it shouldn't need to be guarded by MATHML, since the header is also guarded by MATHML
> Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:65 > + m_text = element().textContent().stripWhiteSpace().simplifyWhiteSpace().impl();
Do you think we need to store m_text, or can a method always just return the right value, by doing ::text() { return element().textContent().stripWhiteSpace().simplifyWhiteSpace().impl();; }
> Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:75 > + if (tokenElement.hasTagName(MathMLNames::miTag)) {
You can probably use an early return here instead. You might also want to assert that it has this tagName. It looks like this element is only created with a miTag
> Source/WebCore/rendering/mathml/RenderMathMLToken.h:2 > + * Copyright (C) 2010 Frédéric Wang (
fred.wang@free.fr
). All rights reserved.
2014
> Source/WebCore/rendering/mathml/RenderMathMLToken.h:45 > + virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override { return true; };
extra space after "override"
> Source/WebCore/rendering/mathml/RenderMathMLToken.h:51 > + String m_text;
Seems like m_text should be private. I don't see it referenced outside the .cpp file
Frédéric Wang (:fredw)
Comment 10
2014-02-06 09:13:29 PST
@Chris: this prepares for the cleanup of <mo> & <mfenced> frames and implementation of the operator dictionary (see
bug 124838
and
bug 99620
and all the bugs they block) and especially I try to do a clean thing with anonymous styles (although I'm not sure that's the case). I have only extracted the <mi> part, so that's why the class is called RenderMathMLToken and test <mi> and probably why I store m_text (because it was more convenient for <mo> IIRC).
Frédéric Wang (:fredw)
Comment 11
2014-02-06 10:40:28 PST
Created
attachment 223346
[details]
Patch V3
WebKit Commit Bot
Comment 12
2014-02-06 11:55:28 PST
Comment on
attachment 223346
[details]
Patch V3 Clearing flags on attachment: 223346 Committed
r163553
: <
http://trac.webkit.org/changeset/163553
>
WebKit Commit Bot
Comment 13
2014-02-06 11:55:34 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug