From 1fa9bbaef0ea70a3b5a27ab308805d620f6f9424 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 7 Oct 2015 18:06:49 -0400 Subject: [PATCH] Force width of mrow if there is negative space within the mrow (to work around WebKit bug). Resolves issue #1278. --- unpacked/jax/output/CommonHTML/jax.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js index 1716ade73..7b6f78f63 100644 --- a/unpacked/jax/output/CommonHTML/jax.js +++ b/unpacked/jax/output/CommonHTML/jax.js @@ -2527,9 +2527,17 @@ MML.mrow.Augment({ toCommonHTML: function (node) { node = this.CHTMLdefaultNode(node); - var bbox = this.CHTML, H = bbox.h, D = bbox.d; - for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLstretchChildV(i,H,D); - if (this.CHTMLlineBreaks()) this.CHTMLmultiline(node); + var bbox = this.CHTML, H = bbox.h, D = bbox.d, hasNegative; + for (var i = 0, m = this.data.length; i < m; i++) { + this.CHTMLstretchChildV(i,H,D); + if (this.data[i] && this.data[i].CHTML && this.data[i].CHTML.w < 0) hasNegative = true; + } + if (this.CHTMLlineBreaks()) { + this.CHTMLmultiline(node); + } else { + if (hasNegative && bbox.w) node.style.width = CHTML.Em(Math.max(0,bbox.w)); + if (bbox.w < 0) node.style.marginRight = CHTML.Em(bbox.w); + } return node; }, CHTMLlineBreaks: function () {