Bug 12290

Summary: SVGTextContentElement is missing all its DOM methods
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: SVGAssignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Enhancement CC: a.neumann, good4me, hyatt, justin.garcia, ml, oliver
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
testing the interface SVGTextContentElement
none
correct rendering of the test in Apache Batik.
none
Initial patch
none
Layout test results
none
Updated patch eric: review+

Description Eric Seidel (no email) 2007-01-15 18:11:41 PST
SVGTextContentElement needs implementations for the following methods:

Oliver and I talked about this on IRC, we expect them all to be pretty trivial (ignoring text-on-path or any other currently-unsupported layout for the moment).

        long getNumberOfChars() const;
        float getComputedTextLength() const;
        float getSubStringLength(unsigned long charnum, unsigned long nchars, ExceptionCode&) const;
        FloatPoint getStartPositionOfChar(unsigned long charnum, ExceptionCode&) const;
        FloatPoint getEndPositionOfChar(unsigned long charnum, ExceptionCode&) const;
        FloatRect getExtentOfChar(unsigned long charnum, ExceptionCode&) const;
        float getRotationOfChar(unsigned long charnum, ExceptionCode&) const;
        long getCharNumAtPosition(const FloatPoint&) const;
        void selectSubString(unsigned long charnum, unsigned long nchars, ExceptionCode&) const;

Oliver agreed to add pseudo-code for each to this bug.  So I'm adding this as a master bug. If needed, we can break of individual bugs for each, of fix a few of them in this bug and file a second one.
Comment 1 Andreas Neumann 2007-01-16 05:48:59 PST
http://www.carto.net/neumann/webkitsvgbugs/text-dom-01-f.svg is testing all methods and parts of the properties of the SVGTextContentElement. I also uploaded it as a testcase.

The testcase is in the W3C SVG testsuit format and will probably also be added to the testsuite.

I will probably later provide individual test cases if you want.

So far Apache Batik is the only SVG UA passing all the subtests. ASV3 passes most of the subtests.
Comment 2 Andreas Neumann 2007-01-16 05:51:11 PST
Created attachment 12483 [details]
testing the interface SVGTextContentElement

http://www.carto.net/neumann/webkitsvgbugs/text-dom-01-f.png shows how the correct rendering looks like in Batik
Comment 3 Andreas Neumann 2007-01-16 05:52:04 PST
Created attachment 12484 [details]
correct rendering of the test in Apache Batik.
Comment 4 Eric Seidel (no email) 2007-02-04 03:22:12 PST
Another example test:
http://www.w3.org/Graphics/SVG/Test/20061213/htmlEmbedHarness/full-text-tselect-02-f.html
Comment 5 Eric Seidel (no email) 2007-09-26 17:59:27 PDT
I peaked at this again today.  I expect this will be a couple hour hack for WildFox once he finds time.  Eventually I'll spend the time to understand his fancy text-chunk system... but not tonight.
Comment 6 Eric Seidel (no email) 2007-10-23 20:19:59 PDT
*** Bug 15622 has been marked as a duplicate of this bug. ***
Comment 7 Nikolas Zimmermann 2007-11-15 14:32:10 PST
Created attachment 17302 [details]
Initial patch
Comment 8 Nikolas Zimmermann 2007-11-15 14:56:18 PST
Created attachment 17303 [details]
Layout test results
Comment 9 Eric Seidel (no email) 2007-11-15 15:43:31 PST
Comment on attachment 17303 [details]
Layout test results

The layout test results look fine.  They're of no use w/o the patch however, so just clearing the flag.
Comment 10 Eric Seidel (no email) 2007-11-15 15:45:42 PST
Comment on attachment 17302 [details]
Initial patch

This looks OK.  We talked over IRC about a nicer design for the QueryWalker which used subclasses and specific variable names/methods instead of generic query variables.  Possibly virtual methods or templates instead of a switch statement.

You're currently working out the nextPosition stuff with Harrison.  When that's done we can review your final patch.
Comment 11 Nikolas Zimmermann 2007-11-15 16:04:58 PST
Created attachment 17304 [details]
Updated patch

A much better version of selectSubString() thanks to the help of Justin & Harrison.
Comment 12 Eric Seidel (no email) 2007-11-16 02:54:56 PST
Comment on attachment 17304 [details]
Updated patch

Looks fine.
Comment 13 Nikolas Zimmermann 2007-11-19 05:46:51 PST
Landed in r27848.