Fixed gradient import bug for webkit browsers

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1765 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-09-28 20:21:22 +00:00
parent a8df84c328
commit 7674ea3564
1 changed files with 10 additions and 1 deletions

View File

@ -8119,7 +8119,15 @@ var uniquifyElems = this.uniquifyElems = function(g) {
// Function convertGradients
// Converts gradients from userSpaceOnUse to objectBoundingBox
var convertGradients = this.convertGradients = function(elem) {
$(elem).find('linearGradient, radialGradient').each(function() {
var elems = $(elem).find('linearGradient, radialGradient');
if(!elems.length && isWebkit) {
// Bug in webkit prevents regular *Gradient selector search
elems = $(elem).find('*').filter(function() {
return (this.tagName.indexOf('Gradient') !== -1);
});
}
elems.each(function() {
var grad = this;
if($(grad).attr('gradientUnits') === 'userSpaceOnUse') {
// TODO: Support more than one element with this ref by duplicating parent grad
@ -8240,6 +8248,7 @@ var convertToGroup = this.convertToGroup = function(elem) {
}
batchCmd.addSubCommand(new InsertElementCommand(g));
}
convertGradients(g);
// recalculate dimensions on the top-level children so that unnecessary transforms