aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpylbrecht <palbrecht@mailbox.org>2020-01-19 09:23:18 +0100
committerpylbrecht <palbrecht@mailbox.org>2020-01-19 09:23:18 +0100
commit3c7205c99f9e1105fd6a56a4bd841e409a385e5f (patch)
tree5c052f792ac8acfa0dbe1ed1a7c4faf6444e56bf
parent77c07a26fd10e60b2451b083080aa17e3059d483 (diff)
downloadservo-3c7205c99f9e1105fd6a56a4bd841e409a385e5f.tar.gz
servo-3c7205c99f9e1105fd6a56a4bd841e409a385e5f.zip
Create new subpath with origin after drawing rect
Step 4 has been missing. https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-rect
-rw-r--r--components/canvas/canvas_data.rs17
-rw-r--r--tests/wpt/metadata/2dcontext/path-objects/2d.path.rect.zero.4.html.ini4
-rw-r--r--tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.html.ini4
-rw-r--r--tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.worker.js.ini4
4 files changed, 11 insertions, 18 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs
index 5e2348b58d7..f66bd626cda 100644
--- a/components/canvas/canvas_data.rs
+++ b/components/canvas/canvas_data.rs
@@ -143,11 +143,12 @@ impl<'a> PathBuilderRef<'a> {
),
Point2D::new(rect.origin.x, rect.origin.y + rect.size.height),
);
- self.builder.move_to(self.transform.transform_point(first));
- self.builder.line_to(self.transform.transform_point(second));
- self.builder.line_to(self.transform.transform_point(third));
- self.builder.line_to(self.transform.transform_point(fourth));
- self.builder.close();
+ self.move_to(&first);
+ self.line_to(&second);
+ self.line_to(&third);
+ self.line_to(&fourth);
+ self.close();
+ self.move_to(&first);
}
fn quadratic_curve_to(&mut self, cp: &Point2D<f32>, endpoint: &Point2D<f32>) {
@@ -210,6 +211,10 @@ impl<'a> PathBuilderRef<'a> {
None => None,
}
}
+
+ fn close(&mut self) {
+ self.builder.close();
+ }
}
// TODO(pylbrecht)
@@ -573,7 +578,7 @@ impl<'a> CanvasData<'a> {
}
pub fn close_path(&mut self) {
- self.path_builder().builder.close();
+ self.path_builder().close();
}
fn ensure_path(&mut self) {
diff --git a/tests/wpt/metadata/2dcontext/path-objects/2d.path.rect.zero.4.html.ini b/tests/wpt/metadata/2dcontext/path-objects/2d.path.rect.zero.4.html.ini
deleted file mode 100644
index a3406ea4dd7..00000000000
--- a/tests/wpt/metadata/2dcontext/path-objects/2d.path.rect.zero.4.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[2d.path.rect.zero.4.html]
- [Canvas test: 2d.path.rect.zero.4]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.html.ini b/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.html.ini
deleted file mode 100644
index 5c1a4ec2a63..00000000000
--- a/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[2d.path.rect.zero.4.html]
- [OffscreenCanvas test: 2d.path.rect.zero.4]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.worker.js.ini b/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.worker.js.ini
deleted file mode 100644
index 7ae67f1ba53..00000000000
--- a/tests/wpt/metadata/offscreen-canvas/path-objects/2d.path.rect.zero.4.worker.js.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[2d.path.rect.zero.4.worker.html]
- [2d]
- expected: FAIL
-