<?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>17332</bug_id>
          
          <creation_ts>2008-02-12 12:46:58 -0800</creation_ts>
          <short_desc>SVGTextElement.getSubStringLength returns wrong result (affects Acid3)</short_desc>
          <delta_ts>2008-02-29 14:17:09 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>17078</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Seidel (no email)">eric</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70430</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-02-12 12:46:58 -0800</bug_when>
    <thetext>SVGTextElement.getSubStringLength returns wrong result (affects Acid3)

Now that the SVGDocument mimetype issue has been fixed, we fail Test 78 in a new way:

Test 78: expected: 42, got: 65 - getSubStringLength #1 failed.

    function () {
      // test 78: external SVG fonts, from Erik Dahlstrom
      //
      // SVGFonts are described here[3], and the relevant DOM methods
      // used in the test are defined here[4].
      //
      // Note that in order to be more predictable the svg should be
      // visible, so that clause &quot;For non-rendering environments, the
      // user agent shall make reasonable assumptions about glyph
      // metrics.&quot; doesn&apos;t influence the results. We use &apos;opacity:0&apos;
      // to hide the SVG, but arguably it&apos;s still a &quot;rendering
      // environment&quot;.
      //
      // The font-size 4000 was chosen because that matches the
      // unitsPerEm value in the svgfont, which makes it easy to check
      // the glyph advances since they will then be exactly what was
      // specified in the svgfont.
      //
      // [3] http://www.w3.org/TR/SVG11/fonts.html
      // [4] http://www.w3.org/TR/SVG11/text.html#InterfaceSVGTextContentElement

      var svgns = &quot;http://www.w3.org/2000/svg&quot;;
      var xlinkns = &quot;http://www.w3.org/1999/xlink&quot;;
      var svgdoc = kungFuDeathGrip.firstChild.contentDocument;
      assert(svgdoc, &quot;contentDocument failed on &lt;object&gt; for svg document.&quot;);
      var svg = svgdoc.documentElement;
      var text = svgdoc.createElementNS(svgns, &quot;text&quot;);
      text.setAttribute(&quot;y&quot;, &quot;1em&quot;);
      text.setAttribute(&quot;font-size&quot;, &quot;4000&quot;);
      text.setAttribute(&quot;font-family&quot;, &quot;ACID3svgfont&quot;);
      var textContent = svgdoc.createTextNode(&quot;abc&quot;);
      text.appendChild(textContent);
      svg.appendChild(text);
      // The font-size 4000 was chosen because that matches the unitsPerEm value in the svgfont, 
      // which makes it easy to check the glyph advances since they will then be exactly what was specified in the svgfont.
      assert(text.getNumberOfChars, &quot;SVGTextContentElement.getNumberOfChars() not supported.&quot;);
      assertEquals(text.getNumberOfChars(), 3, &quot;getNumberOfChars returned incorrect string length.&quot;);
      assertEquals(text.getComputedTextLength(), 4711+42+23, &quot;getComputedTextLength failed.&quot;);
      assertEquals(text.getSubStringLength(0,1), 42, &quot;getSubStringLength #1 failed.&quot;);
      assertEquals(text.getSubStringLength(0,2), 42+23, &quot;getSubStringLength #2 failed.&quot;);
      assertEquals(text.getSubStringLength(1,1), 23, &quot;getSubStringLength #3 failed.&quot;);
      assertEquals(text.getSubStringLength(1,0), 0, &quot;getSubStringLength #4 failed.&quot;);
      var code = -1000;
      try {
        var sl = text.getSubStringLength(1,3);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getSubStringLength #1 didn&apos;t throw exception.&quot;);
      code = -1000;
      try {
        var sl = text.getSubStringLength(0,3);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getSubStringLength #2 didn&apos;t throw exception.&quot;);
      code = -1000;
      try {
        var sl = text.getSubStringLength(1,2);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getSubStringLength #3 didn&apos;t throw exception.&quot;);
      code = -1000;
      try {
        var sl = text.getSubStringLength(-17,20);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getSubStringLength #4 didn&apos;t throw exception.&quot;);
      code = -1000;
      try {
        var sl = text.getSubStringLength(1,2);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getSubStringLength #5 didn&apos;t throw exception.&quot;);
      assertEquals(text.getStartPositionOfChar(0).x, 0, &quot;getStartPositionOfChar(0).x returned invalid value.&quot;);
      assertEquals(text.getStartPositionOfChar(1).x, 42, &quot;getStartPositionOfChar(1).x returned invalid value.&quot;);
      assertEquals(text.getStartPositionOfChar(2).x, 42+23, &quot;getStartPositionOfChar(2).x returned invalid value.&quot;);
      assertEquals(text.getStartPositionOfChar(0).y, 4000, &quot;getStartPositionOfChar(0).y returned invalid value.&quot;);
      code = -1000;
      try {
        var val = text.getStartPositionOfChar(-1);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getStartPositionOfChar #1 exception failed.&quot;);
      code = -1000;
      try {
        var val = text.getStartPositionOfChar(4);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getStartPositionOfChar #2 exception failed.&quot;);
      assertEquals(text.getEndPositionOfChar(0).x, 42, &quot;getEndPositionOfChar(0).x returned invalid value.&quot;);
      assertEquals(text.getEndPositionOfChar(1).x, 42+23, &quot;getEndPositionOfChar(1).x returned invalid value.&quot;);
      assertEquals(text.getEndPositionOfChar(2).x, 42+23+4711, &quot;getEndPositionOfChar(2).x returned invalid value.&quot;);
      code = -1000;
      try {
        var val = text.getEndPositionOfChar(-17);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getEndPositionOfChar #1 exception failed.&quot;);
      code = -1000;
      try {
        var val = text.getEndPositionOfChar(4);
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, &quot;getEndPositionOfChar #2 exception failed.&quot;);
      return 5;
    },</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72380</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-02-29 14:17:09 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 17078 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>