Skip line caps for closed ellipse paths

As discussed in the github issue, https://github.com/whatwg/html/issues/1079, it's generally agreed to skip drawing line caps for closed paths. Add test cases for full
ellipse path.

Bug: 644067

Change-Id: I3fde274f4b15a96d4ecaa593b0317c585eeb4a25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4919559
Commit-Queue: Yi Xu <yiyix@google.com>
Reviewed-by: Justin Novosad <junov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1208078}
diff --git a/html/canvas/element/path-objects/2d.path.stroke.prune.ellipse.html b/html/canvas/element/path-objects/2d.path.stroke.prune.ellipse.html
new file mode 100644
index 0000000..d555079
--- /dev/null
+++ b/html/canvas/element/path-objects/2d.path.stroke.prune.ellipse.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.path.stroke.prune.ellipse</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.path.stroke.prune.ellipse</h1>
+<p class="desc">Zero-length full ellipse are removed before stroking with miters</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+var t = async_test("Zero-length full ellipse are removed before stroking with miters");
+_addTest(function(canvas, ctx) {
+
+  ctx.fillStyle = '#0f0';
+  ctx.fillRect(0, 0, 100, 50);
+
+  ctx.strokeStyle = '#f00';
+  ctx.lineWidth = 100;
+  ctx.lineCap = 'round';
+  ctx.lineJoin = 'round';
+
+  ctx.beginPath();
+  ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI);
+  ctx.stroke();
+
+  _assertPixel(canvas, 50,25, 0,255,0,255);
+
+});
+</script>
+
diff --git a/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.html b/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.html
new file mode 100644
index 0000000..5eea854
--- /dev/null
+++ b/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.path.stroke.prune.ellipse</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.path.stroke.prune.ellipse</h1>
+<p class="desc">Zero-length full ellipse are removed before stroking with miters</p>
+
+
+<script>
+var t = async_test("Zero-length full ellipse are removed before stroking with miters");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+    throw reason;
+});
+t.step(function() {
+
+  var canvas = new OffscreenCanvas(100, 50);
+  var ctx = canvas.getContext('2d');
+
+  ctx.fillStyle = '#0f0';
+  ctx.fillRect(0, 0, 100, 50);
+
+  ctx.strokeStyle = '#f00';
+  ctx.lineWidth = 100;
+  ctx.lineCap = 'round';
+  ctx.lineJoin = 'round';
+
+  ctx.beginPath();
+  ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI);
+  ctx.stroke();
+
+  _assertPixel(canvas, 50,25, 0,255,0,255);
+  t.done();
+
+});
+</script>
diff --git a/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.worker.js b/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.worker.js
new file mode 100644
index 0000000..a1fbabd
--- /dev/null
+++ b/html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.worker.js
@@ -0,0 +1,34 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.path.stroke.prune.ellipse
+// Description:Zero-length full ellipse are removed before stroking with miters
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Zero-length full ellipse are removed before stroking with miters");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+    throw reason;
+});
+t.step(function() {
+
+  var canvas = new OffscreenCanvas(100, 50);
+  var ctx = canvas.getContext('2d');
+
+  ctx.fillStyle = '#0f0';
+  ctx.fillRect(0, 0, 100, 50);
+
+  ctx.strokeStyle = '#f00';
+  ctx.lineWidth = 100;
+  ctx.lineCap = 'round';
+  ctx.lineJoin = 'round';
+
+  ctx.beginPath();
+  ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI);
+  ctx.stroke();
+
+  _assertPixel(canvas, 50,25, 0,255,0,255);
+  t.done();
+});
+done();
diff --git a/html/canvas/tools/yaml-new/path-objects.yaml b/html/canvas/tools/yaml-new/path-objects.yaml
index eec142c..fab92b9 100644
--- a/html/canvas/tools/yaml-new/path-objects.yaml
+++ b/html/canvas/tools/yaml-new/path-objects.yaml
@@ -2853,6 +2853,23 @@
     @assert pixel 50,25 == 0,255,0,255;
   expected: green
 
+- name: 2d.path.stroke.prune.ellipse
+  desc: Zero-length full ellipse are removed before stroking with miters
+  code: |
+    ctx.fillStyle = '#0f0';
+    ctx.fillRect(0, 0, 100, 50);
+
+    ctx.strokeStyle = '#f00';
+    ctx.lineWidth = 100;
+    ctx.lineCap = 'round';
+    ctx.lineJoin = 'round';
+
+    ctx.beginPath();
+    ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI);
+    ctx.stroke();
+
+    @assert pixel 50,25 == 0,255,0,255;
+  expected: green
 
 - name: 2d.path.transformation.basic
   code: |