Skip to content

Commit

Permalink
Bug 784809. Allow null for the repeat argument of canvas createPatter…
Browse files Browse the repository at this point in the history
…n. r=peterv, a=akeybl
  • Loading branch information
bzbarsky committed Aug 23, 2012
1 parent 13db000 commit 439332a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions content/canvas/test/test_canvas.html
Original file line number Diff line number Diff line change
Expand Up @@ -15975,9 +15975,17 @@
var canvas = document.getElementById('c494');
var ctx = canvas.getContext('2d');

var _thrown = undefined; try {
ctx.createPattern(canvas, null);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
var img = document.getElementById('green-1x1_2.png');
var pattern = ctx.createPattern(img, null);
ctx.fillStyle = pattern;
ctx.fillRect(0, 0, 100, 50);

isPixel(ctx, 1,1, 0,255,0,255, 0);
isPixel(ctx, 98,1, 0,255,0,255, 0);
isPixel(ctx, 1,48, 0,255,0,255, 0);
isPixel(ctx, 98,48, 0,255,0,255, 0);


}
Expand Down Expand Up @@ -16014,9 +16022,12 @@
var canvas = document.getElementById('c496');
var ctx = canvas.getContext('2d');

var undefinedHandler = IsAzureEnabled() ? todo : ok;

var _thrown = undefined; try {
ctx.createPattern(canvas, undefined);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
// XXXbz TODO fix bug 784869
} catch (e) { _thrown = e }; undefinedHandler(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");


}
Expand Down
2 changes: 1 addition & 1 deletion dom/interfaces/canvas/nsIDOMCanvasRenderingContext2D.idl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ enum CanvasMultiGetterType {

nsIDOMCanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1);
nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, [Null(Stringify)] in DOMString repetition);
nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, in DOMString repetition);
attribute float lineWidth; /* default 1 */
[binaryname(MozLineCap)]
attribute DOMString lineCap; /* "butt", "round", "square" (default) */
Expand Down
2 changes: 1 addition & 1 deletion dom/webidl/CanvasRenderingContext2D.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ interface CanvasRenderingContext2D {
attribute any fillStyle; // (default black)
CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition);
CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString? repetition);

// shadows
[Infallible]
Expand Down

0 comments on commit 439332a

Please sign in to comment.