From 594043e3301e95bfc76e441dccdddfb29e67b982 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 22 Apr 2013 08:26:38 -0400 Subject: [PATCH] Use ems (rounded to nearest pixel) for Chrome. Rounding makes the placement work more reliably, while still being in relative units. Resolves issue #443. --- unpacked/jax/output/HTML-CSS/config.js | 2 +- unpacked/jax/output/HTML-CSS/jax.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/config.js b/unpacked/jax/output/HTML-CSS/config.js index d8b61805d..7f334b79e 100644 --- a/unpacked/jax/output/HTML-CSS/config.js +++ b/unpacked/jax/output/HTML-CSS/config.js @@ -24,7 +24,7 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({ id: "HTML-CSS", - version: "2.1.2", + version: "2.1.3", directory: MathJax.OutputJax.directory + "/HTML-CSS", extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS", autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload", diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 0ed956ac5..c1e107b80 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -814,6 +814,11 @@ if (Math.abs(m) < .0006) {return "0em"} return m.toFixed(3).replace(/\.?0+$/,"") + "em"; }, + EmRounded: function (m) { + m = (Math.round(m*HTMLCSS.em)+.05)/HTMLCSS.em; + if (Math.abs(m) < .0006) {return "0em"} + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; + }, unEm: function (m) { return parseFloat(m); }, @@ -2811,10 +2816,8 @@ Chrome: function (browser) { HTMLCSS.Augment({ - Em: HTMLCSS.Px, // vertical alignment is better in pixels (since around v20) - unEm: HTMLCSS.unPx, - chromeHeightBug: true, // heights can be 1px off from the explicitly set size - cloneNodeBug: true, // Chrome gets heights wrong with the cloned ones + Em: HTMLCSS.EmRounded, // vertical alignment needs help (since around v20) + cloneNodeBug: true, // Chrome gets heights wrong with the cloned ones rfuzz: .011, AccentBug: true, AdjustSurd: true,