<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>66832</bug_id>
          
          <creation_ts>2011-08-23 18:06:01 -0700</creation_ts>
          <short_desc>LayoutTests/canvas/philip/tests/2d.path.stroke.prune.arc.html misinterprets pruning requirement</short_desc>
          <delta_ts>2011-08-29 11:20:53 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>55696</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Tom Zakrajsek">tomz</reporter>
          <assigned_to name="Tom Zakrajsek">tomz</assigned_to>
          <cc>kling</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>455897</commentid>
    <comment_count>0</comment_count>
      <attachid>104950</attachid>
    <who name="Tom Zakrajsek">tomz</who>
    <bug_when>2011-08-23 18:06:01 -0700</bug_when>
    <thetext>Created attachment 104950
Demo of path pruning when arc length = 0

WebKit incorrectly prunes the path when it contains a 0 length arc, and the 2d.path.stroke.prune.arc test is expecting/enforcing that behavior.  In addition to removing the 0 length arc, we are also removing the connecting line.  From the spec, at http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#complex-shapes-%28paths%29

&lt;quote&gt;
context.arc(x,y,radius,startAngle,endAngle[,anticlockwise]) adds points to the subpath such that the arc described by the arguments .../snip/... is added to the path, connected to the previous point by a straight line.
: : :
The arc(x, y, radius, startAngle, endAngle, anticlockwise) method draws an arc. If the context has any subpaths, then the method must add a straight line from the last point in the subpath to the start point of the arc. In any case, it must draw the arc between the start point of the arc and the end point of the arc, and add the start and end points of the arc to the subpath. The arc and its start and end points are defined as follows:
: : :
If the two points are the same, or if the radius is zero, then the arc is defined as being of zero length in both directions.
: : :
And then under general path stuff... &quot;Zero-length line segments must be pruned before stroking a path. Empty subpaths must be ignored.&quot;
&lt;/quote&gt;

Now consider the case of several arc calls.  If you follow all of the steps and construct paths you construct a series of arcs with connecting lines.  If we set one arc length to 0, the current interpretation (enforced by this test) has us removing the non-zero length connecting line also.  That goes beyond what the spec says, and differs from the interpretation of all other tested browsers, including: IE, Firefox, and Opera.  See the attached example.

Problems with the current interpretation include:
  * Divergence from *all* other browser engines,
  * Divergence from how svg handles analogous paths
  * Divergence from WebKit&apos;s own handling of 0 length line segments created by lineTo.
  * Violates principle of least surprise.  Behavior at arcLen == 0 differs (discontinuously) from behavior as arcLen approaches 0. 

We can fix the WebKit behavior under https://bugs.webkit.org/show_bug.cgi?id=55696, but this test will start failing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>456306</commentid>
    <comment_count>1</comment_count>
      <attachid>105042</attachid>
    <who name="Tom Zakrajsek">tomz</who>
    <bug_when>2011-08-24 12:28:16 -0700</bug_when>
    <thetext>Created attachment 105042
Demo of path pruning compared to path when arc is not pruned</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>458309</commentid>
    <comment_count>2</comment_count>
    <who name="Tom Zakrajsek">tomz</who>
    <bug_when>2011-08-29 11:20:53 -0700</bug_when>
    <thetext>Fixed by patch for https://bugs.webkit.org/show_bug.cgi?id=55696.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>104950</attachid>
            <date>2011-08-23 18:06:01 -0700</date>
            <delta_ts>2011-08-23 18:06:01 -0700</delta_ts>
            <desc>Demo of path pruning when arc length = 0</desc>
            <filename>prune-arc-demo.html</filename>
            <type>text/html</type>
            <size>416</size>
            <attacher name="Tom Zakrajsek">tomz</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5PgogICA8Y2FudmFzIGlkPSJjdnMiIHdpZHRoPSI2MDAiIGhlaWdodD0iNjAw
IiBzdHlsZT0iYm9yZGVyOiAxcHggZGFzaGVkIGJsYWNrIj5bTm8gY2FudmFzIHN1cHBvcnRdPC9j
YW52YXM+CiAgIDxzY3JpcHQ+CiAgICAgICBjbyA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJj
dnMiKS5nZXRDb250ZXh0KCcyZCcpOwogICAgICAgY28uYmVnaW5QYXRoKCk7CiAgICAgICAgICAg
Y28uYXJjKDEwMCwxMDAsMzAsMC43NSwzLjc1LDApOwogICAgICAgICAgIGNvLmFyYygzMDAsMjAw
LDMwLDAuNzUsMC43NSwwKTsgICAvLyB6ZXJvIGFyYy1sZW5ndGgKICAgICAgICAgICBjby5hcmMo
NTAwLDEwMCwzMCwwLjc1LDMuNzUsMCk7CiAgICAgICBjby5zdHJva2UoKTsKICA8L3NjcmlwdD4K
PC9ib2R5Lz4KPC9odG1sPgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>105042</attachid>
            <date>2011-08-24 12:28:16 -0700</date>
            <delta_ts>2011-08-24 12:28:16 -0700</delta_ts>
            <desc>Demo of path pruning compared to path when arc is not pruned</desc>
            <filename>prune-arc-compare.html</filename>
            <type>text/html</type>
            <size>610</size>
            <attacher name="Tom Zakrajsek">tomz</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5PgogICA8Y2FudmFzIGlkPSJjdnMiIHdpZHRoPSI2MDAiIGhlaWdodD0iNjAw
IiBzdHlsZT0iYm9yZGVyOiAxcHggZGFzaGVkIGJsYWNrIj5bTm8gY2FudmFzIHN1cHBvcnRdPC9j
YW52YXM+CiAgIDxzY3JpcHQ+CiAgICAgICBjbyA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJj
dnMiKS5nZXRDb250ZXh0KCcyZCcpOwogICAgICAgY28uYmVnaW5QYXRoKCk7CiAgICAgICAgICAg
Y28uYXJjKDEwMCwxMDAsMzAsMC43NSwzLjc1LDApOwogICAgICAgICAgIGNvLmFyYygzMDAsMjAw
LDMwLDAuNzUsMC43NSwwKTsgICAvLyB6ZXJvIGFyYy1sZW5ndGgKICAgICAgICAgICBjby5hcmMo
NTAwLDEwMCwzMCwwLjc1LDMuNzUsMCk7CiAgICAgICBjby5zdHJva2UoKTsKICAgICAgIGNvLmJl
Z2luUGF0aCgpOwogICAgICAgICAgIGNvLmFyYygxMDAsNDAwLDMwLDAuNzUsMy43NSwwKTsKICAg
ICAgICAgICBjby5hcmMoMzAwLDUwMCwzMCwwLjc1LDMuNzUsMCk7ICAgLy8gemVybyBhcmMtbGVu
Z3RoCiAgICAgICAgICAgY28uYXJjKDUwMCw0MDAsMzAsMC43NSwzLjc1LDApOwogICAgICAgY28u
c3Ryb2tlKCk7CiAgIDwvc2NyaXB0Pgo8L2JvZHkvPgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>