From 757660863f251706c3139212995bb41eae1d0098 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sat, 5 Dec 2015 18:43:31 -0500 Subject: [PATCH 1/2] Handle boxes with negative widths in CHTML. Resolves issue #1280 --- unpacked/jax/output/CommonHTML/jax.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js index f8b438d38..7852aeb9f 100644 --- a/unpacked/jax/output/CommonHTML/jax.js +++ b/unpacked/jax/output/CommonHTML/jax.js @@ -1518,6 +1518,9 @@ } else if (BBOX.pwidth) { BBOX.mwidth = BBOX.w; style.width = "100%"; + } else if (BBOX.w < 0) { + style.width = "0px"; + style.marginRight = CHTML.Em(BBOX.w); } if (!this.style) return; // ### FIXME: adjust for width, height, vertical-align? @@ -1688,6 +1691,7 @@ MML.math.Augment({ toCommonHTML: function (node) { node = this.CHTMLdefaultNode(node); + if (this.CHTML.w < 0) node.parentNode.style.marginRight = CHTML.Em(this.CHTML.w); var alttext = this.Get("alttext"); if (alttext && !node.getAttribute("aria-label")) node.setAttribute("aria-label",alttext); if (!node.getAttribute("role")) node.setAttribute("role","math"); From 21dd8a4b462f20a4e3ee8306dcce1934af7e1544 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sun, 6 Dec 2015 07:49:24 -0500 Subject: [PATCH 2/2] Make sure main container element gets width set when using right margin for negative size --- unpacked/jax/output/CommonHTML/jax.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js index 7852aeb9f..825be8f02 100644 --- a/unpacked/jax/output/CommonHTML/jax.js +++ b/unpacked/jax/output/CommonHTML/jax.js @@ -1691,7 +1691,10 @@ MML.math.Augment({ toCommonHTML: function (node) { node = this.CHTMLdefaultNode(node); - if (this.CHTML.w < 0) node.parentNode.style.marginRight = CHTML.Em(this.CHTML.w); + if (this.CHTML.w < 0) { + node.parentNode.style.width = "0px"; + node.parentNode.style.marginRight = CHTML.Em(this.CHTML.w); + } var alttext = this.Get("alttext"); if (alttext && !node.getAttribute("aria-label")) node.setAttribute("aria-label",alttext); if (!node.getAttribute("role")) node.setAttribute("role","math");