Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 667064 - SVG: text elements inside a <svg> element
: SVG: text elements inside a <svg> element
Product: Core
Classification: Components
Component: SVG (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla7
Assigned To: Jonathan Watt [:jwatt]
: Jet Villegas (:jet)
Depends on: 652832
  Show dependency treegraph
Reported: 2011-06-24 14:38 PDT by Séamus O'Connor
Modified: 2012-03-26 04:55 PDT (History)
4 users (show)
jwatt: in‑testsuite?
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

SVG Text positioning bug example (1.85 KB, image/svg+xml)
2011-06-24 14:39 PDT, Séamus O'Connor
no flags Details
other fixes (2.09 KB, patch)
2011-06-25 02:20 PDT, Robert Longson
jwatt: review+
Details | Diff | Splinter Review

Description Séamus O'Connor 2011-06-24 14:38:07 PDT
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0

I am using a inner <svg> element (lets call it 'inner-svg') in my web app to control positioning of a bunch of children. To make my life easier I have been using a lot of percentage based coordinates.

In the attached testcase I have a example of the kind of behaviour I want. The inner-svg element controls the whole size for a bunch of dependent children. All the children's coordinates are specified using percentages.

I noticed that when I re-size inner-svg by changing the width / height attribute that rect, line, etc update using the new coordinate space. However <text> nodes don't.

Reproducible: Always

Steps to Reproduce:
1. View attachment
2 [review]. Click the 'Update Inner SVG' button

Actual Results:  
The red square re-sizes & positions properly. The bottom right text does not and falls 'outside'.

Expected Results:  
The bottom right text should move to be inside the red square.

Chrome seems to be worse. :-)
Comment 1 Séamus O'Connor 2011-06-24 14:39:14 PDT
Created attachment 541806 [details]
SVG Text positioning bug example
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2011-06-24 17:46:43 PDT
I can reproduce with older builds, but this works for me on trunk.  Looks like it got fixed in this range 3 days ago:

But the only sorta-related thing in that range is bug 652832 and even that's a stretch...
Comment 3 Séamus O'Connor 2011-06-24 20:59:17 PDT
If this is fixed in trunk should this bug be closed?
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2011-06-24 21:54:43 PDT
Well, it would be good to understand whether it's really fixed or whether just the testcase you attached happens to work now for some semi-unrelated reason....  Going to wait for one of the SVG folks to look at this to tell which it is.
Comment 5 Daniel Holbert [:dholbert] (PTO Oct 21-25) 2011-06-25 00:18:08 PDT
(In reply to comment #2)
> But the only sorta-related thing in that range is bug 652832 and even that's
> a stretch...

I confirmed with a local backout that that bug's cset (30c1b4519b2a) fixed the attached testcase.
Comment 6 Daniel Holbert [:dholbert] (PTO Oct 21-25) 2011-06-25 00:18:38 PDT
(Robert, does it make sense that your commit fixed this?)
Comment 7 Robert Longson 2011-06-25 01:39:42 PDT
bug 652832 makes nsSVGLength2::SetBaseValueString call nsSVGlement::DidChangeLength. This is overridden in nsSVGSVGElement and that override expects to be called when the length changes as it does here.
Comment 8 Jonathan Watt [:jwatt] 2011-06-25 01:56:42 PDT
I'll write a test for this.
Comment 9 Jonathan Watt [:jwatt] 2011-06-25 01:57:04 PDT
Reftest, that is.
Comment 10 Robert Longson 2011-06-25 02:20:51 PDT
Created attachment 541919 [details] [diff] [review]
other fixes

If you're going to write tests then neither nsSVGEnum, nor SVGPreserveAspect ratio work for the same reason (see patch). nsSVGSVGElement and nsSVGMarkerElement override these methods and when DOM setAttribute is called the overrides need to be called too.
Comment 11 Robert Longson 2011-09-19 06:16:33 PDT
Comment on attachment 541919 [details] [diff] [review]
other fixes

In the end I moved the first part to bug 687340 and decided the second part (the enum change) was not required as bug 687340 removes all enum overrides.
Comment 12 Robert Longson 2012-03-26 04:55:05 PDT
Brian wrote mochitests that cover this now.

Note You need to log in before you can comment on or make changes to this bug.