Use ems (rounded to nearest pixel) for Chrome. Rounding makes the placement work more reliably, while still being in relative units. Resolves issue #443.

This commit is contained in:
Davide P. Cervone 2013-04-22 08:26:38 -04:00
parent f4cc34706a
commit 594043e330
2 changed files with 8 additions and 5 deletions

View File

@ -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",

View File

@ -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,