aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-30 04:16:04 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-30 04:16:04 -0600
commit1bd8e18d92c291418ce6a5712f7b4503d9b5104c (patch)
treed5e933a27edb2820b37613bf306edbc038cb9a31 /components/script/dom
parent350a35428ab547e45e86826d2a818cb15d004bf5 (diff)
parent0a3b4f2f651f8c4268ed15a55d30df03fc3377a7 (diff)
downloadservo-1bd8e18d92c291418ce6a5712f7b4503d9b5104c.tar.gz
servo-1bd8e18d92c291418ce6a5712f7b4503d9b5104c.zip
auto merge of #5455 : mmatyas/servo/canvas_arc_negativeradius, r=Ms2ger
"Negative values for radius must cause the implementation to throw an IndexSizeError exception."
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs8
-rw-r--r--components/script/dom/webidls/CanvasRenderingContext2D.webidl1
2 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 427f8d78501..4145c8e28cc 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -460,15 +460,21 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Point2D(x as f32, y as f32))).unwrap();
}
- fn Arc(self, x: Finite<f64>, y: Finite<f64>, r: Finite<f64>, start: Finite<f64>, end: Finite<f64>, ccw: bool) {
+ fn Arc(self, x: Finite<f64>, y: Finite<f64>, r: Finite<f64>,
+ start: Finite<f64>, end: Finite<f64>, ccw: bool) -> Fallible<()> {
let x = *x;
let y = *y;
let r = *r;
let start = *start;
let end = *end;
+ if r < 0.0 {
+ return Err(IndexSize);
+ }
+
self.renderer.send(CanvasMsg::Arc(Point2D(x as f32, y as f32), r as f32,
start as f32, end as f32, ccw)).unwrap();
+ Ok(())
}
// https://html.spec.whatwg.org/#dom-context-2d-imagesmoothingenabled
diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
index a3d40dc7c52..96624deb0fa 100644
--- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl
+++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
@@ -150,6 +150,7 @@ interface CanvasPathMethods {
//void rect(double x, double y, double w, double h);
+ [Throws]
void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false);
// NOT IMPLEMENTED [LenientFloat] void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise);
};