Fixed bug where imported images would lose their gradient in Firefox

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1780 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-10-07 17:41:53 +00:00
parent 55d7aeab18
commit aea8325858
1 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* /*
* svgcanvas.js * svgcanvas.js
* *
* Licensed under the Apache License, Version 2 * Licensed under the Apache License, Version 2
@ -4707,7 +4707,8 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
"font-size": cur_text.font_size, "font-size": cur_text.font_size,
"font-family": cur_text.font_family, "font-family": cur_text.font_family,
"text-anchor": "middle", "text-anchor": "middle",
"xml:space": "preserve" "xml:space": "preserve",
"opacity": cur_shape.opacity
} }
}); });
// newText.textContent = "text"; // newText.textContent = "text";
@ -8596,17 +8597,17 @@ this.importSvgString = function(xmlString) {
// Hack to make recalculateDimensions understand how to scale // Hack to make recalculateDimensions understand how to scale
ts = "translate(0) " + ts + " translate(0)"; ts = "translate(0) " + ts + " translate(0)";
// Uncomment this once Firefox has fixed their symbol bug:
// https://bugzilla.mozilla.org/show_bug.cgi?id=353575
var symbol = svgdoc.createElementNS(svgns, "symbol"); var symbol = svgdoc.createElementNS(svgns, "symbol");
var defs = findDefs(); var defs = findDefs();
if(isGecko) {
// Move all gradients into root for Firefox, workaround for this bug:
// https://bugzilla.mozilla.org/show_bug.cgi?id=353575
$(svg).find('linearGradient, radialGradient').appendTo(defs);
}
while (svg.firstChild) { while (svg.firstChild) {
var first = svg.firstChild; var first = svg.firstChild;
if(isGecko && first.tagName === 'defs') {
// Move all gradients into root for Firefox
$(first).find('linearGradient, radialGradient').appendTo(defs);
}
symbol.appendChild(first); symbol.appendChild(first);
} }
var attrs = svg.attributes; var attrs = svg.attributes;