Closed Bug 293704 Opened 19 years ago Closed 11 years ago

xbl bindings that contain <svg:tspan> don't render

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: andrew, Unassigned)

Details

(Keywords: testcase)

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050509 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050509 Firefox/1.0+

The goal is to use <svg:tspan>'s inside an xbl binding. However even when using
a display of svg:generic, the anonymous content is created, but it's not
rendered. I'm at a loss. 

Reproducible: Always

Steps to Reproduce:
see test case
Actual Results:  
only get "Hello there"

Expected Results:  
expect to see "Hello there " + "Bob"

binding's that contain <svg:text> work as expected.. I just can't "be" an
<svg:tspan>
Hmm... I'm not seeing any SVG frames constructed here (the outer <svg> has an
inline frame).
Keywords: testcase
Comment on attachment 183241 [details]
tspan is not rendering when contained inside an xbl binding

fixing mimetype (hopefully)
Attachment #183241 - Attachment mime type: text/html → text/xml
Based on conversations on irc:

the problem here is that nsSVGTextFrame only iterates over its direct children
when laying out the text.

you need to change nsSVGTextFrame::GetFirstGlyphFragmentChildNode() and
GetNextGlyphFragmentChildNode() to traverse the children of nsISVGContainerFrame
children as well

the alternative is to make nsSVGGenericContainerFrame implement
nsISVGGlyphFragmentNode

also note: having the xbl binding extend svg:tspan doesn't apparently help.
-Andrew

So this seems like it's invalid to me. You're essentially creating a tree that looks like this:

<svg:svg>
  <svg:text y="15px">
    <svg:tspan>hello there </svg:tspan>
    <html:span class="givemetext"><svg:tspan>bob</svg:tspan></html:span>
  </svg:text>
</svg:svg>

Having that HTML 'span' in the SVG tree is invalid.
What's the point of the display="svg:generic" in that XBL, if I might ask?  It does nothing, right?
Well, this is a blast from the past - forgive me if my recollection is a little
weak. 

I believe the point of this was, while working with the xforms SVG bindings we
wanted to have tspan's be rendered out of an XBL binding for our tags that were
defined using xtf. It doesn't matter if it's an html:span that has it's content
replaced via xbl or if it's a Whatchamacallit tag. The point of XTF and xbl
working together was to have tags of any old namespace be replaced with xbl
content that could go anywhere, right? At least that was what I understood it
to be. 

If you use the same logic that it's "invalid", then why would I have said that
<svg:text> works? (it may or may not work now, I haven't checked).

In terms of the svg:generic - it was, as I recall, suggested that it might
help. It apparently didn't. It can probably be removed from the test case.

Thanks for looking into it!
-Andrew
I can see how extends="svg:generic" might help (at least until we disable that functionality)... but not display="svg:generic".
Updated test case to show that extends svg:generic is right and svg:text works. Hope this helps.
-Andrew
(In reply to comment #8)
> The point of XTF and xbl
> working together was to have tags of any old namespace be replaced with xbl
> content that could go anywhere, right? At least that was what I understood it
> to be. 

Yes, but not that it is the bound element's _content_ and not the bound element itself that is replaced. In other words that HTML 'span' is still in the resulting content tree after the binding is applied.

> If you use the same logic that it's "invalid", then why would I have said that
> <svg:text> works? (it may or may not work now, I haven't checked).

That would be a bug I'm afraid, and IMO we should fix it if that's still the case. The only way to put non-SVG in SVG should be by using a <foreignObject>. Anything else should not render, simply because the behavior is undefined.

Thanks for taking the time to come back to this Andrew.
I don't want to dirty up Bug 378518, but I've created examples before for charting:

<chart:piechart>
  <chart:pieslice value="50%"/>
  <chart:pieslice value="25%"/>
  <chart:pieslice value="25%"/>
</chart:piechart>

where the slices each draw their own path, and the piechart node creates an svg root. Heck, you can even convert a normal HTML table that way and get graceful degradation in browsers that don't support XBL.

I think there's a good use case there for being able to extend SVG in a way that's sensible... at least until sXBL is ratified and implemented and all that stuff.
Assignee: general → nobody
QA Contact: ian → general
If you want to use a <tspan> it's going to have to have a <text> parent for the positioning layout to work.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: