Skip to content
Browse files

Support empty strings as the repeat argument (CreatePattern)

According to the third step in the specification [1], createPattern
should let the repetition argument be "repeat" when it is the empty

The code in CanvasRenderingContext2D::CreatePattern did not implement
this step and instead threw a SyntaxError exception when an empty
string was supplied as the repetition argument.

Fixes #9079.

  • Loading branch information...
nerith committed Dec 31, 2015
1 parent 0f5c614 commit 1ccab328f9bc7e2952bbbfe7591804b6ce65ee9e
@@ -1147,7 +1147,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
fn CreatePattern(&self,
image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
repetition: DOMString)
mut repetition: DOMString)
-> Fallible<Root<CanvasPattern>> {
let (image_data, image_size) = match image {
HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(ref image) => {
@@ -1169,6 +1169,10 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {

if repetition.is_empty() {

if let Ok(rep) = RepetitionStyle::from_str(&repetition) {

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

0 comments on commit 1ccab32

Please sign in to comment.
You can’t perform that action at this time.