Work around WebKit bug with SVG sizes. Resolves issue #749.

This commit is contained in:
Davide P. Cervone 2014-04-10 22:45:35 -04:00
parent 6ba5f2a624
commit 46ba400ad6
2 changed files with 12 additions and 2 deletions

View File

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

View File

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