[webkit-dev] Anonymous style (inheritance and dynamic update)

Frédéric WANG fred.wang at free.fr
Tue Feb 4 06:06:13 PST 2014


Hi all,

I'm trying to refactor the MathML code to follow what seems the clean 
way to add style to elements and prepare for future improvements. Hence 
I have tried to do some experiments with anonymous style and that seems 
to work in some cases, but sometimes the style is not applied correctly. 
I don't know much about the WebKit layout code and just tried to copy 
what was done elsewhere. So I would appreciate if someone more familiar 
with the code base could check if the code makes sense and suggest the 
right way to implement that otherwise?

In https://bugs.webkit.org/show_bug.cgi?id=124838 I have attached a big 
patch that shares some code between the <mi>, <mo> and the <mfenced> 
elements (which uses anonymous <mo>), cleans up more things and tries to 
fix other rendering bugs. For convenience, I have extracted the changes 
that are only relevant to <mi> in a smaller patch: 
https://bug-124838-attachments.webkit.org/attachment.cgi?id=223101 (see 
in the new nsRenderMathMLToken class). The basic test case 
https://bug-44208-attachments.webkit.org/attachment.cgi?id=219653 
renders correctly with that patch but as I said above, other reftests 
fail for some reason.

Note that you don't need to know anything about MathML, but the 
following info might be helpful:

1) Single variables like <mi>x</mi> should be italic while multiple-char 
identifier like <mi>sin</mi> should be upright ; the plan is thus to map 
this to CSS font-style (this is not quite what the MathML spec says but 
this approximation has been used in Gecko for a long time, so that's ok 
to use it in WebKit for now). Also in theory, whitespace should be 
collapsed in MathML tokens, so <mi>   x    </mi> is equivalent to 
<mi>x</mi>.

2) Operators like <mo>+</mo> or <mo>(</mo> may have different spacing. 
The default being indicated by the operator dictionary 
(http://www.w3.org/TR/MathML3/appendixc.html). The idea is to map this 
to margin-left/margin-right. This is what I try to do in the bigger 
patch https://bug-124838-attachments.webkit.org/attachment.cgi?id=222977 
as well as in the follow-up bug 
https://bugs.webkit.org/show_bug.cgi?id=99620.

Thank you,

-- 
Frédéric Wang
MathML Crowdfunding: ulule.com/mathematics-ebooks



More information about the webkit-dev mailing list