Fix #688 fatal exception on unmatched color stop

This commit is contained in:
MoyuScript
2015-10-18 16:51:53 +03:00
parent e6344db0d6
commit c3697eb362
5 changed files with 41 additions and 16 deletions

View File

@ -35,6 +35,15 @@ describe("Gradients", function() {
" to(rgb(191, 110, 78))"
]
},
{
method: 'linear-gradient',
args: [
"0deg",
" rgb(221, 221, 221)",
" rgb(221, 221, 221) 50%",
" transparent 50%"
]
},
{
method: "radial-gradient",
args: [
@ -97,7 +106,7 @@ describe("Gradients", function() {
}
];
$('#backgroundGradients div').each(function(i, node) {
[].slice.call(document.querySelectorAll('#backgroundGradients div'), 0).forEach(function(node, i) {
var container = new html2canvas.NodeContainer(node, null);
var value = container.css("backgroundImage");
it(value, function() {

View File

@ -108,6 +108,11 @@
/* W3C */
background: linear-gradient(top, #f0b7a1 0%, #8c3310 50%, #752201 51%, #bf6e4e 100%);
}
.linearGradient4 {
background: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);
}
.radialGradient {
background: -moz-radial-gradient(75% 19%, ellipse closest-side, #ababab, #0000ff 33%,#991f1f 100%);
background: -webkit-radial-gradient(75% 19%, ellipse closest-side, #ababab, #0000ff 33%,#991f1f 100%);
@ -156,6 +161,7 @@
<div class="linearGradientSimple"></div>
<div class="linearGradientWithStops"></div>
<div class="linearGradient3"></div>
<div class="linearGradient4"></div>
<div class="radialGradient"></div>
<div class="radialGradient2"></div>
<div class="radialGradient3"></div>