Bug 18230

Summary: tspan in link not working
Product: WebKit Reporter: Jeff Schiller <jeffschiller>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Minimal test case
none
First attempt
eric: review-
Safer cast none

Description Jeff Schiller 2008-03-30 23:40:24 PDT
The following construct does not render:

<text><a><tspan>foo</tspan></a></text> 

If I remove the <a> or the <tspan> it renders fine.
Comment 1 Jeff Schiller 2008-03-30 23:42:15 PDT
Created attachment 20230 [details]
Minimal test case

Works in Firefox and Opera...
Comment 2 Rob Buis 2008-04-03 00:16:47 PDT
Created attachment 20308 [details]
First attempt

Implement the errata given at:

http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment

This change of behaviour implements the Minimal test case, I also included
a testcase that tests the possible content of the <a> when contained in a <text>.
Cheers,

Rob.
Comment 3 Eric Seidel (no email) 2008-04-13 22:32:37 PDT
Comment on attachment 20308 [details]
First attempt

This is *great*.  But I don't think it's safe to assume that your parent is always an SVG element:

if (static_cast<SVGElement*>(parent()))

I bet that it's possible to add an SVGAElement into an arbitrary XML DOM and we don't prevent that.  Whether we should is another question.  You'll need to check the type of the parent before making the case.

r- for the potential crasher.
Comment 4 Rob Buis 2008-04-13 23:49:08 PDT
Created attachment 20520 [details]
Safer cast

I did not check but I a convinced it will crash in mixed content, this cast is safer.
Cheers,

Rob.
Comment 5 Eric Seidel (no email) 2008-04-13 23:50:35 PDT
Comment on attachment 20520 [details]
Safer cast

Awesome.
Comment 6 Darin Adler 2008-04-14 08:38:07 PDT
(In reply to comment #3)
> I bet that it's possible to add an SVGAElement into an arbitrary XML DOM and we
> don't prevent that.  Whether we should is another question.

We definitely shouldn't prevent that. Keep in mind that in XML you can have arbitrary content, any element child with any element as parent, in markup without any DOM calls.
Comment 7 Rob Buis 2008-05-02 23:02:59 PDT
Landed in r31859.
Comment 8 Jeff Schiller 2008-07-24 08:52:06 PDT
This broke again - not sure when (Safari 3.1.2)
Comment 9 Jeff Schiller 2008-07-24 08:58:19 PDT
Hm, works in a more recent WebKit build (34603).  Which build of WebKit is Safari 3.1 using?  This might be FIXED after all (just not in Safari yet).
Comment 10 mitz 2008-07-25 13:12:24 PDT
Comment on attachment 20520 [details]
Safer cast

Clearing the review flag because the patch was landed.
Comment 11 Robert Blaut 2008-07-29 04:54:25 PDT
(In reply to comment #9)
> Hm, works in a more recent WebKit build (34603).  Which build of WebKit is
> Safari 3.1 using?  

Safari 3.1 was build from branched source tree of WebKit: http://trac.webkit.org/browser/branches/Safari-3-1-branch. The bug is fixed only in trunk for now: http://trac.webkit.org/browser/trunk

>This might be FIXED after all (just not in Safari yet).

Indeed.