Handle propagation of bounding box sizes better.

This commit is contained in:
Davide P. Cervone 2015-02-22 10:59:35 -05:00
parent 4ef56bb007
commit 1763ac7188

View File

@ -539,6 +539,7 @@
this.CHTMLhandleColor(span);
if (this.isToken) this.CHTMLhandleToken(span);
for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLaddChild(span,i,options);
if (!options.noMargins && !options.noBBox) this.CHTMLhandleMargins(span);
return span;
},
CHTMLaddChild: function (span,i,options) {
@ -613,6 +614,20 @@
}
},
CHTMLhandleMargins: function (span,box) {
var bbox = this.CHTML;
// ### FIXME: should these be FONTDATA values?
if (bbox.h < .9 || bbox.d < .25) {
if (box == null) {
box = HTML.Element("span",{className:"MJXc-box"});
while (span.firstChild) box.appendChild(span.firstChild);
span.appendChild(box);
}
if (bbox.h < .9) box.style.marginTop = CHTML.Em(bbox.h-.9);
if (bbox.d < .25) box.style.marginBottom = CHTML.Em(bbox.d-.25);
}
},
CHTMLhandleText: function (span,text,variant) {
var c, n;
var H = 0, D = 0, W = 0;