Skip to content

Commit

Permalink
Fix reading fillStyle after setting it from gradient to color
Browse files Browse the repository at this point in the history
  • Loading branch information
caldwell authored and zbjornson committed Dec 22, 2017
1 parent 727cb2c commit b18ae15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/context2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Context2d.prototype.__defineSetter__('fillStyle', function(val){
this.lastFillStyle = val;
this._setFillPattern(val);
} else if ('string' == typeof val) {
this.lastFillStyle = undefined;
this._setFillColor(val);
}
});
Expand Down
4 changes: 4 additions & 0 deletions test/public/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ tests['createLinearGradient()'] = function (ctx) {

ctx.fillRect(10, 10, 130, 130)
ctx.strokeRect(50, 50, 50, 50)

ctx.fillStyle = '#13b575'
ctx.fillStyle = ctx.fillStyle
ctx.fillRect(65, 65, 20, 20)
}

tests['createRadialGradient()'] = function (ctx) {
Expand Down

0 comments on commit b18ae15

Please sign in to comment.