diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index db3d9648..9f252b02 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2516,26 +2516,28 @@ var getMouseTarget = this.getMouseTarget = function(evt) { tlist.appendItem(svgroot.createSVGTransform()); if(svgedit.browser.supportsNonScalingStroke()) { - //Handle crash for newer Chrome: https://code.google.com/p/svg-edit/issues/detail?id=904 - //Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625 - // TODO: Remove this workaround (all isChrome blocks) once vendor fixes the issue - var isChrome = svgedit.browser.isChrome(); - if(isChrome) { + // Handle crash for newer Chrome and Safari 6 (Mobile and Desktop): + // https://code.google.com/p/svg-edit/issues/detail?id=904 + // Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625 + // TODO: Remove this workaround once vendor fixes the issue + var isWebkit = svgedit.browser.isWebkit(); + + if(isWebkit) { var delayedStroke = function(ele) { var _stroke = ele.getAttributeNS(null, 'stroke'); ele.removeAttributeNS(null, 'stroke'); //Re-apply stroke after delay. Anything higher than 1 seems to cause flicker - setTimeout(function() { ele.setAttributeNS(null, 'stroke', _stroke) }, 1); + setTimeout(function() { ele.setAttributeNS(null, 'stroke', _stroke) }, 0); } } mouse_target.style.vectorEffect = 'non-scaling-stroke'; - if(isChrome) delayedStroke(mouse_target); + if(isWebkit) delayedStroke(mouse_target); var all = mouse_target.getElementsByTagName('*'), len = all.length; for(var i = 0; i < len; i++) { all[i].style.vectorEffect = 'non-scaling-stroke'; - if(isChrome) delayedStroke(all[i]); + if(isWebkit) delayedStroke(all[i]); } } }