Skip to content

Commit

Permalink
Fixed: Context2d setters with invalid values ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Feb 6, 2012
1 parent f8ffa3f commit f866dd8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/context2d.js
Expand Up @@ -165,6 +165,7 @@ Context2d.prototype.setTransform = function(){
*/

Context2d.prototype.__defineSetter__('fillStyle', function(val){
if (!val) return;
if ('CanvasGradient' == val.constructor.name
|| 'CanvasPattern' == val.constructor.name) {
this.lastFillStyle = val;
Expand Down Expand Up @@ -192,6 +193,7 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){
*/

Context2d.prototype.__defineSetter__('strokeStyle', function(val){
if (!val) return;
if ('CanvasGradient' == val.constructor.name
|| 'CanvasPattern' == val.constructor.name) {
this.lastStrokeStyle = val;
Expand Down Expand Up @@ -221,6 +223,7 @@ Context2d.prototype.__defineGetter__('strokeStyle', function(){
*/

Context2d.prototype.__defineSetter__('font', function(val){
if (!val) return;
if ('string' == typeof val) {
var font;
if (font = parseFont(val)) {
Expand Down Expand Up @@ -252,6 +255,7 @@ Context2d.prototype.__defineGetter__('font', function(){
*/

Context2d.prototype.__defineSetter__('textBaseline', function(val){
if (!val) return;
var n = baselines.indexOf(val);
if (~n) {
this.lastBaseline = val;
Expand Down

0 comments on commit f866dd8

Please sign in to comment.