Bug 20474 - setting Canvas fillStyle or strokeStyle to an invalid value should have no effect
Summary: setting Canvas fillStyle or strokeStyle to an invalid value should have no ef...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL: http://philip.html5.org/tests/canvas/...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-21 00:04 PDT by Dirk Schulze
Modified: 2008-09-02 23:03 PDT (History)
0 users

See Also:


Attachments
Canvas invalid styles (8.84 KB, patch)
2008-08-28 10:31 PDT, Dirk Schulze
eric: review-
Details | Formatted Diff | Diff
Canvas and invalid styles (7.55 KB, patch)
2008-08-28 22:11 PDT, Dirk Schulze
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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

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