Bug 129097

Summary: Bad spacing around <mi> token elements
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: MathMLAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, cfleizach, commit-queue, dbarton, esprehn+autocc, glenn, kondapallykalyan, mrobinson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 44208    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch to remove the workaround in reftests none

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