commit 46ba400ad6e8783d2e4df5bece6d51cbbd5c5e74
parent 6ba5f2a6242e5a2764fc6f5e3a861d773fd4a67d
Author: Davide P. Cervone <dpvc@union.edu>
Date: Thu, 10 Apr 2014 22:45:35 -0400
Work around WebKit bug with SVG sizes. Resolves issue #749.
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/unpacked/extensions/MathZoom.js b/unpacked/extensions/MathZoom.js
@@ -222,10 +222,12 @@
// Set the position of the zoom box and overlay
//
Position: function (zoom,bbox) {
+ zoom.style.display = "none"; // avoids getting excessive width in Resize()
var XY = this.Resize(), x = XY.x, y = XY.y, W = bbox.mW;
+ zoom.style.display = "";
var dx = -W-Math.floor((zoom.offsetWidth-W)/2), dy = bbox.Y;
zoom.style.left = Math.max(dx,10-x)+"px"; zoom.style.top = Math.max(dy,10-y)+"px";
- setTimeout(ZOOM.Resize); // refigure overlay position and size
+ if (!ZOOM.msiePositionBug) {ZOOM.SetWH()} // refigure overlay width/height
},
//
@@ -249,10 +251,11 @@
},
SetWH: function () {
var overlay = document.getElementById("MathJax_ZoomOverlay");
- overlay.style.width = overlay.style.height = "1px"; // so scrollWidth/Height will be right below
+ overlay.style.display = "none"; // so scrollWidth/Height will be right below
var doc = overlay.scroll_parent || document.documentElement || document.body;
overlay.style.width = doc.scrollWidth + "px";
overlay.style.height = Math.max(doc.clientHeight,doc.scrollHeight) + "px";
+ overlay.style.display = "";
},
findContainer: function (obj) {
var obj = obj.parentNode;
diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js
@@ -425,6 +425,13 @@
if (this.operaZoomRefresh)
{setTimeout(function () {span.firstChild.style.border="1px solid transparent"},1)}
//
+ // WebKit bug (issue #749)
+ //
+ if (span.offsetWidth < span.firstChild.offsetWidth) {
+ span.style.minWidth = span.firstChild.offsetWidth + "px";
+ math.style.minWidth = math.firstChild.offsetWidth + "px";
+ }
+ //
// Get height and width of zoomed math and original math
//
span.style.position = math.style.position = "absolute";