Closed Bug 937268 Opened 6 years ago Closed 7 months ago
SVG 2 text
Path/tspan get BBox method broken
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.8 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.8 Steps to reproduce: Hello, I'm not used to posting here so sorry if I'm not following procedure or if this is not a real bug... Start with a simple SVG: <svg id="svg" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="800" height="400"> <defs> <path id="myPath" d="M412.88330078125,176.73333740234375 A968.5681923990925,968.5681923990925 0 0,1 765.0479813818788,242.24454536947826" /> </defs> <text style="fill: #000000;" font-family="'Alex Brush', sans-serif" font-size="36" font-weight="normal" font-style="normal"> <textPath id="myTextpath" xlink:href="#myPath">hello</textPath> </text> </svg> Actual results: In console: document.getElementById('myTextpath').getBBox returns "getBBox()" (indicating method is defined), however document.getElementById('myTextpath').getBBox() triggers "Method not implemented" error. This now happens in FF 25 on both OS X and Windows 8. Expected results: In FF 24, document.getElementById('myTextpath').getBBox() returns an SVGRect object.
Component: Untriaged → SVG
Product: Firefox → Core
textPath having a bounding box is part of SVG 2. The SVG 2 specification is not finished yet. Does this work in any other current browser?
Summary: SVG getBBox method not implemented in FF 25 → SVG 2 textPath/tspan getBBox method not implemented
That's good to know about the SVG 2 spec. I just tested the latest versions of Chrome, Safari and IE 9/10 and only Chrome now returns an SVGRect object. The problem we were having is that our script tested whether getBBox existed (e.g., if (path.getBBox) then doStuffWith(path.getBBox())...), but since path.getBBox was still defined it threw it off. Easy fix in the script but seemed strange that it was taken out in a later version. Anyway thanks for your help and quick response. This issue can be closed as far as I'm concerned.
Not sure what you mean about later version, SVG 1.1 is the latest complete version, SVG 2 is the upcoming version, this functionality is new with SVG 2 which is why it's not implemented widely as the specification is not yet complete. We will be implementing this at some point so we'll leave this bug open for that.
I just meant that it worked fine in FF 24 (getBBox() returns a valid SVGRect object) but it stopped working in FF 25.
Good to know, perhaps that raises its priority then. Cam, it looks like css text frames broke this SVG 2 feature.
I'll take a look (probably next week though; feel free to steal if you want, Robert).
Assignee: nobody → cam
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Can be closed? Works now.
Attachment #8590853 - Attachment mime type: text/plain → image/svg+xml
Doesn't work for me, which is not surprising as the code's still not been written to do this.
Ah. Should have read the whole bug report and not just the first half …
I've adjusted the summary to make it clearer. Because it works for other SVG elements like SVGPathElement and was already working for <textPath> elements in previous stable versions of Firefox, I set the bug severity back to 'normal'. (In reply to Robert Longson from comment #5) > Cam, it looks like css text frames broke this SVG 2 feature. I can confirm that enabling svg.text.css-frames.enabled (see bug 839955) caused the problem. Cam, you assigned this bug to you two years ago. Are you still planning to work on this? Sebastian
Severity: enhancement → normal
OS: Mac OS X → All
Hardware: x86 → All
See Also: → 839955
Summary: SVG 2 textPath/tspan getBBox method not implemented → SVG 2 textPath/tspan getBBox method broken
It was not working for textPath in any previous version.
Severity: normal → enhancement
I don't have time to work on this at the moment.
Assignee: cam → nobody
Status: ASSIGNED → NEW
(In reply to Robert Longson from comment #12) > It was not working for textPath in any previous version. It *was* working in Firefox 24. See comment 4. I also tried it myself earlier today and can confirm that it returned an SVGRect object for <textPath> and <tspan>. I didn't check, though, whether the values within the SVGRect were actually correct. Sebastian
Pretty sure the rect would have been wrong. Would have been the rect for the complete text element and not the tspan/textPath only rect.
(In reply to Robert Longson from comment #15) > Pretty sure the rect would have been wrong. Would have been the rect for the > complete text element and not the tspan/textPath only rect. Correct. I've created a new test case, which is creates transparent blue rects indicating the bounding boxes of two <textPath> and one <tspan> based on the data returned by getBBox(). In Firefox 24 the three rects surround the whole <text> element instead. Btw. the same is happening in Chrome 47 and Opera 34, so I may file bugs for them, too. Sebastian
(In reply to Sebastian Zartner [:sebo] from comment #16) > In Firefox 24 the three rects surround the whole <text> element instead. > Btw. the same is happening in Chrome 47 and Opera 34, so I may file bugs for > them, too. There's already an issue filed for this: https://code.google.com/p/chromium/issues/detail?id=349835 Sebastian
Assignee: nobody → violet.bugreport
Status: NEW → ASSIGNED
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/ee2d5ba2854c Should implement getBBox() for tspan r=longsonr
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/332599ee861c Should implement getBBox() for tspan r=longsonr
You need to log in before you can comment on or make changes to this bug.