<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:mrobinson&#64;webkit.org" title="Martin Robinson &lt;mrobinson&#64;webkit.org&gt;"> <span class="fn">Martin Robinson</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Cairo] SVG path not rendered with all-zero dasharray"
   href="https://bugs.webkit.org/show_bug.cgi?id=146997">bug 146997</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #256903 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Cairo] SVG path not rendered with all-zero dasharray"
   href="https://bugs.webkit.org/show_bug.cgi?id=146997#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Cairo] SVG path not rendered with all-zero dasharray"
   href="https://bugs.webkit.org/show_bug.cgi?id=146997">bug 146997</a>
              from <span class="vcard"><a class="email" href="mailto:mrobinson&#64;webkit.org" title="Martin Robinson &lt;mrobinson&#64;webkit.org&gt;"> <span class="fn">Martin Robinson</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=256903&amp;action=diff" name="attach_256903" title="Patch">attachment 256903</a> <a href="attachment.cgi?id=256903&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=256903&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=256903&amp;action=review</a>

Nice. Fix. I have a few small nits.

<span class="quote">&gt; Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:907
&gt; +    // Avoid all-zero patterns that would trigger the CAIRO_STATUS_INVALID_DASH context error state.
&gt; +    bool allZero = true;
&gt; +    for (auto&amp; dash : dashes) {
&gt; +        if (dash) {
&gt; +            allZero = false;
&gt; +            break;
&gt; +        }</span >

I think you could pull this bit out into a helper function that returns a boolean. Something like isDashArrayAllZero.

<span class="quote">&gt; Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:911
&gt; +    if (allZero)
&gt; +        return;
&gt; +</span >

What should the behavior of an all-zero dash array be? Should it disable dashes? If so, perhaps in that case you should call cairo_set_dash with num_dashes=0. Either way, I think you need to adjust the state appropriately.

<span class="quote">&gt; LayoutTests/fast/canvas/script-tests/canvas-lineDash.js:107
&gt; +// Verify all-zero dash rendering</span >

Nit: missing period.

<span class="quote">&gt; LayoutTests/fast/canvas/script-tests/canvas-lineDash.js:110
&gt; +ctx.lineWidth = 4; // To make the test immune to plaform anti-aliasing discrepancies</span >

Ditto.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>