fix shadow parsing for IE9

This commit is contained in:
Niklas von Hertzen 2013-08-04 15:41:00 +03:00
parent ebd7828dc8
commit 2d39cd0719
2 changed files with 3 additions and 6 deletions

View File

@ -21,12 +21,11 @@ _html2canvas.Util.trimText = (function(isNative){
})( String.prototype.trim );
(function() {
// TODO: support all possible length values
var TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
var TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
_html2canvas.Util.parseTextShadows = function (value) {
if (value === 'none') {
if (!value || value === 'none') {
return [];
}

View File

@ -80,7 +80,7 @@ _html2canvas.Parse = function (images, options) {
bold = getCSS(el, "fontWeight"),
family = getCSS(el, "fontFamily"),
size = getCSS(el, "fontSize"),
shadow = getCSS(el, "textShadow");
shadows = _html2canvas.Util.parseTextShadows(getCSS(el, "textShadow"));
switch(parseInt(bold, 10)){
case 401:
@ -95,9 +95,7 @@ _html2canvas.Parse = function (images, options) {
ctx.setVariable("font", [getCSS(el, "fontStyle"), getCSS(el, "fontVariant"), bold, size, family].join(" "));
ctx.setVariable("textAlign", (align) ? "right" : "left");
if (shadow !== "none") {
var shadows = _html2canvas.Util.parseTextShadows(shadow);
if (shadows.length) {
// TODO: support multiple text shadows
// apply the first text shadow
ctx.setVariable("shadowColor", shadows[0].color);