Bug 129097 - Bad spacing around <mi> token elements
Summary: Bad spacing around <mi> token elements
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 44208
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-20 05:01 PST by Frédéric Wang (:fredw)
Modified: 2014-02-20 23:56 PST (History)
8 users (show)

See Also:


Attachments
Patch (9.91 KB, patch)
2014-02-20 05:11 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch to remove the workaround in reftests (3.04 KB, patch)
2014-02-20 23:56 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2014-02-20 05:01:52 PST
After bug 44208, I tweaked some reftests due to some bad spacing around <mi> operators. I tried again today and it seems that the issue was actually a bad preferred width. For some reason, marking the wrapper preferred width dirty was not enough and I have to force the recomputation in RenderMathMLToken::computePreferredLogicalWidths(). Not sure if that's the optimal way to do that but that seems to work for me.

The issue of bug 124838 on which I've been stuck for a while now is probably the same: I need to take into account the lspace/rspace in the computation of computePreferredLogicalWidths ; using margin-start/margin-end and setting the wrapper preferred width dirty is probably not enough (and won't have worked for stretchy operators anyway since the computation is specific).
Comment 1 Frédéric Wang (:fredw) 2014-02-20 05:11:57 PST
Created attachment 224748 [details]
Patch
Comment 2 Frédéric Wang (:fredw) 2014-02-20 23:55:30 PST
I just checked again and actually I think my first comment was wrong. The problem is that mathml.css has some CSS rules to emulate italic correction:

mi {
    -webkit-padding-end: 0.1em;
}
msub > mi:first-child, msubsup > mi:first-child {
    -webkit-padding-end: 0;
}
msubsup > mi:first-child + * + * {
    -webkit-margin-start: 0.14em; /* This is larger than 0.1em because the child's font-size is smaller than the <msubsup>'s. */
}

but these rules should only apply when mi is italic and probably for other italic token elements too. So it's probably best to wait we can do proper implementation of italic correction in the renderer code.
Comment 3 Frédéric Wang (:fredw) 2014-02-20 23:56:18 PST
Created attachment 224834 [details]
Patch to remove the workaround in reftests