Bug 20474

Summary: setting Canvas fillStyle or strokeStyle to an invalid value should have no effect
Product: WebKit Reporter: Dirk Schulze <krit>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
URL: http://philip.html5.org/tests/canvas/suite/tests/2d.fillStyle.parse.invalid.rgb-1.html
Description Flags
Canvas invalid styles
eric: review-
Canvas and invalid styles darin: review+

Description Dirk Schulze 2008-08-21 00:04:54 PDT
If fillStyle() and strokeStyle() gets wrong arguments, they are set to transparent black.
But fillStyle() and strokeStyle() should be ignored in this case and Canvas should fallback to the last fillStyle() or strokeStyle(), if there are no styles before, it should be transparent black.
Comment 1 Dirk Schulze 2008-08-28 10:31:48 PDT
Created attachment 23057 [details]
Canvas invalid styles

I changed the behaviour on invalid styles from transparent black to the last valid style. FF and Opera initialise canvas with a 'fillStyle' and 'strokeStyle' of black like webkit. That's why I don't follow the spec on that.
Comment 2 Eric Seidel (no email) 2008-08-28 13:05:27 PDT
Comment on attachment 23057 [details]
Canvas invalid styles

The gradient and pattern if's aren't necessary.  We shouldn't be ever applying with a NULL gradient or pattern.

Otherwise this looks great!  Nice use of the js tests!

If you were a commiter I would just r+ this and you could fix it as you commit, as is, you should upload a new patch so it's easier for someone else to land.
Comment 3 Dirk Schulze 2008-08-28 22:11:47 PDT
Created attachment 23064 [details]
Canvas and invalid styles

Changes to the comment from eseidel above.
Comment 4 Darin Adler 2008-08-28 22:30:06 PDT
Comment on attachment 23064 [details]
Canvas and invalid styles

Comment 5 Mark Rowe (bdash) 2008-09-02 23:03:50 PDT
Landed in r36044.