mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix webkit-gradient() parsing
This commit is contained in:
parent
861a18f977
commit
2bb926c7d0
@ -818,9 +818,10 @@ _html2canvas.Parse = function (images, options) {
|
|||||||
function renderBackgroundImage(element, bounds, ctx) {
|
function renderBackgroundImage(element, bounds, ctx) {
|
||||||
var backgroundImage = getCSS(element, "backgroundImage"),
|
var backgroundImage = getCSS(element, "backgroundImage"),
|
||||||
backgroundImages = _html2canvas.Util.parseBackgroundImage(backgroundImage),
|
backgroundImages = _html2canvas.Util.parseBackgroundImage(backgroundImage),
|
||||||
image;
|
image,
|
||||||
|
imageIndex = backgroundImages.length;
|
||||||
|
|
||||||
for(var imageIndex = backgroundImages.length; imageIndex-- > 0;) {
|
while(imageIndex--) {
|
||||||
backgroundImage = backgroundImages[imageIndex];
|
backgroundImage = backgroundImages[imageIndex];
|
||||||
|
|
||||||
if (!backgroundImage.args || backgroundImage.args.length === 0) {
|
if (!backgroundImage.args || backgroundImage.args.length === 0) {
|
||||||
@ -829,7 +830,7 @@ _html2canvas.Parse = function (images, options) {
|
|||||||
|
|
||||||
var key = backgroundImage.method === 'url' ?
|
var key = backgroundImage.method === 'url' ?
|
||||||
backgroundImage.args[0] :
|
backgroundImage.args[0] :
|
||||||
backgroundImage.value + '/' + element.__html2canvas__id + '/' + imageIndex;
|
backgroundImage.value;
|
||||||
|
|
||||||
image = loadImage(key);
|
image = loadImage(key);
|
||||||
|
|
||||||
@ -837,7 +838,7 @@ _html2canvas.Parse = function (images, options) {
|
|||||||
if (image) {
|
if (image) {
|
||||||
renderBackgroundRepeating(element, bounds, ctx, image, imageIndex);
|
renderBackgroundRepeating(element, bounds, ctx, image, imageIndex);
|
||||||
} else {
|
} else {
|
||||||
h2clog("html2canvas: Error loading background:" + backgroundImage);
|
h2clog("html2canvas: Error loading background:", backgroundImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,16 +139,15 @@ _html2canvas.Preload = function( options ) {
|
|||||||
src = background_image.args[0];
|
src = background_image.args[0];
|
||||||
methods.loadImage(src);
|
methods.loadImage(src);
|
||||||
|
|
||||||
} else if( background_image.method.match( /\-gradient$/ ) ) {
|
} else if( background_image.method.match( /\-?gradient$/ ) ) {
|
||||||
if(bounds === undefined) {
|
if(bounds === undefined) {
|
||||||
bounds = _html2canvas.Util.Bounds( el );
|
bounds = _html2canvas.Util.Bounds( el );
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = background_image.value + '/' + el.__html2canvas__id + '/' + imageIndex;
|
|
||||||
img = _html2canvas.Generate.Gradient( background_image.value, bounds);
|
img = _html2canvas.Generate.Gradient( background_image.value, bounds);
|
||||||
|
|
||||||
if ( img !== undefined ){
|
if ( img !== undefined ){
|
||||||
images[ key ] = {
|
images[background_image.value] = {
|
||||||
img: img,
|
img: img,
|
||||||
succeeded: true
|
succeeded: true
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user