Bug 17063 - SVGTextElement.getRotationOfChar() sometimes fails (and then test 78 of Acid3 fails)
Summary: SVGTextElement.getRotationOfChar() sometimes fails (and then test 78 of Acid3...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://acid3.acidtests.org
Keywords:
Depends on:
Blocks: Acid3
  Show dependency treegraph
 
Reported: 2008-01-29 00:36 PST by Eric Seidel (no email)
Modified: 2011-05-22 14:19 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-01-29 00:36:07 PST
SVGTextElement.getRotationOfChar() fails (Acid3 bug)

Test 79: expected 90, got: 0 - getRotationOfChar(0) failed.

    function () {
      // test 79: SVG textPath and getRotationOfChar(), from Erik Dahlstrom
      //
      // The getRotationOfChar[4] method fetches the midpoint rotation
      // of a glyph defined by a character (in this testcase there is
      // a simple 1:1 correspondence between the two). The path is
      // defined in the empty.svg file, and consists of first a line
      // going down, then followed by a line that has a 45 degree
      // slope and then followed by a horizontal line. The length of
      // each path segment have been paired with the advance of each
      // glyph, so that each glyph will be on each of the three
      // different path segments (see text on a path layout rules[5]).
      // Thus the rotation of the first glyph is 90 degrees, the
      // second 45 degrees and the third 0 degrees.
      //
      // [4] http://www.w3.org/TR/SVG11/text.html#InterfaceSVGTextContentElement
      // [5] http://www.w3.org/TR/SVG11/text.html#TextpathLayoutRules

      var svgns = "http://www.w3.org/2000/svg";
      var xlinkns = "http://www.w3.org/1999/xlink";
      var svgdoc = kungFuDeathGrip.firstChild.contentDocument;
      assert(svgdoc, "contentDocument failed on <object> for svg document.");
      var svg = svgdoc.documentElement;
      var text = svgdoc.createElementNS(svgns, "text");
      text.setAttribute("font-size", "4000");
      text.setAttribute("font-family", "ACID3svgfont");
      var textpath = svgdoc.createElementNS(svgns, "textPath");
      textpath.setAttributeNS(xlinkns, "xlink:href", "#path");
      var textContent = svgdoc.createTextNode("abc");
      textpath.appendChild(textContent);
      text.appendChild(textpath);
      svg.appendChild(text);
      assertEquals(text.getRotationOfChar(0), 90, "getRotationOfChar(0) failed.");
      assertEquals(text.getRotationOfChar(1), 45, "getRotationOfChar(1) failed.");
      assertEquals(text.getRotationOfChar(2), 0, "getRotationOfChar(2) failed.");
      var code = -1000;
      try {
        var val = text.getRotationOfChar(-1)
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, "getRotationOfChar #1 exception failed.");
      code = -1000;
      try {
        var val = text.getRotationOfChar(4)
      } catch(e) {
        code = e.code;
      }
      assertEquals(code, DOMException.INDEX_SIZE_ERR, "getRotationOfChar #2 exception failed.");
      return 5;
    },
Comment 1 Eric Seidel (no email) 2008-01-29 00:59:21 PST
I don't see where Acid3 ever bothers to load the empty.svg file... so I think this test is invalid.
Comment 2 Ian 'Hixie' Hickson 2008-01-29 11:18:58 PST
Right now they're loaded in test 65.
Comment 3 Eric Seidel (no email) 2008-01-29 11:47:50 PST
Ok, so the comment in the test is just wrong.  it says "empty.svg"
when you mean "svg.xml"

http://www.hixie.ch/tests/evil/acid/003/svg.xml

Comment 4 Ian 'Hixie' Hickson 2008-01-30 16:15:08 PST
It's actually now empty.svg again.
Comment 5 Eric Seidel (no email) 2008-02-03 16:32:34 PST
Wow. How entertaining, this test fails intermittently.  It seems to succeed on the first load, but fail on any successive reload.

Test 79: expected: 90, got: 0 - getRotationOfChar(0) failed.

I doubt that has anything to do with the SVG portion of this test.
Comment 6 Dave Hyatt 2008-02-21 17:13:34 PST
I think it does have to do with SVG.  SVG is reporting an angle of 0 in its own code for the character.  I suspect something going wrong with the SVG font, but I'm not sure what.

Comment 7 Dave Hyatt 2008-02-21 17:35:49 PST
This was a bug in the test.  Eric was right.  Because Hixie did not use the custom svg font at all, it never downloaded until attempts were made to use it in tests.  But because the font downloaded async it isn't necessarily coming in in time.

Acid3 has been changed so that svg.xml now uses the custom font, forcing it to load and delay the onload handler.

Comment 8 Robert Blaut 2008-02-24 12:24:39 PST
The test "Test 78: expected: 90, got: 0 - getRotationOfChar(0) failed." still sometimes fails.  The behavior is similar to the one observed in test 80.


I think we should reopen the bug to track the issue.
Comment 9 Eric Seidel (no email) 2008-03-03 17:58:53 PST
WildFox was having some trouble making the "use the font to delay the onload" handler trick work.  Which would suggest that Acid3 is still timing dependent... and that Robert might not be seeing ghosts. :)

@hyatt: WildFox said he'd ask you about it tomorrow.
Comment 10 Darin Adler 2008-03-15 18:34:50 PDT
I have not seen this failure at all in the last few weeks.
Comment 11 Robert Blaut 2008-03-16 02:09:34 PDT
(In reply to comment #10)
> I have not seen this failure at all in the last few weeks.
> 

Darin, I still able to reproduce the problem. Try to reload the Acid3 test a couple of times. The test should shows you 89/100 score sometimes or crash sometimes ;)  
Comment 12 Ismail Donmez 2010-06-24 01:53:56 PDT
I can reproduce this on Qt/Windows CE, here is the exact error;

Test 78 failed: expected '90' but got '89.99998474121094' - getRotationOfChar(0) failed.

Looks like there is a rounding problem somewhere.
Comment 13 Chang Shu 2011-01-07 14:02:58 PST
I am not able to reproduce the problem on Mac. However, it's consistently reproducible on Qt Linux (Ubuntu 10.04). I will investigate it.
Comment 14 zalan 2011-01-11 05:59:25 PST
(In reply to comment #13)
> I am not able to reproduce the problem on Mac. However, it's consistently reproducible on Qt Linux (Ubuntu 10.04). I will investigate it.

for Qt, this is a regression, introduced by http://trac.webkit.org/changeset/66979
I have a fix on this and going to reopen https://bugs.webkit.org/show_bug.cgi?id=43837
Comment 15 Chang Shu 2011-01-12 07:32:53 PST
(In reply to comment #14)
> (In reply to comment #13)
> > I am not able to reproduce the problem on Mac. However, it's consistently reproducible on Qt Linux (Ubuntu 10.04). I will investigate it.
> 
> for Qt, this is a regression, introduced by http://trac.webkit.org/changeset/66979
> I have a fix on this and going to reopen https://bugs.webkit.org/show_bug.cgi?id=43837

The problem I saw on QtLinux is the same as what Zalan is working on. But it's not related to the original problems reported earlier. I will get myself off the hook. :)
Comment 16 Dirk Schulze 2011-05-18 10:53:44 PDT
I run the test 2 dozen times and can't reproduce it on Mac. Does it still fail for someone else?
Comment 17 Dirk Schulze 2011-05-22 14:19:20 PDT
Closing the bug now. If someone can reproduce it, or better has a test, please reopen the bug again.