Closed Bug 703863 Opened 13 years ago Closed 13 years ago

[SVG] getBBox on a <g> inside a symbol or defs does not work

Categories

(Core :: SVG, defect)

8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 612118

People

(Reporter: rakssvg, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2

Steps to reproduce:

I did a getBBox on a <g> element which is a child of a <symbol> element or a <defs> element


Actual results:

The api call of getBBox returns a error with the following string
Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMSVGLocatable.getBBox]


Expected results:

The API should have returned the correct BBox values. Opera returns the correct values whereas Webkit returns correct values if defs is used.
Getting the BBox is important to understand the space occupied by a symbol
What's wrong with getting the bounding box on the <use> that refers to the symbol? 

If the symbol has elements that have percentage lengths then how are they supposed to be evaluated without knowing the context and its the <use> gives you that isn't it?
The percentage lengths problem is a valid one, let me see what does opera do with it, maybe in that case it would return 0

Let me check if getBBox on symbol and getBBox on use can yield different values because of transforms on the <use>. If so then I would like to know the bounding box of the symbol so that I can apply appropriate amount of transform on the <use> which refers the symbol.
(In reply to Raks from comment #2)
> 
> Let me check if getBBox on symbol and getBBox on use can yield different
> values because of transforms on the <use>. If so then I would like to know
> the bounding box of the symbol so that I can apply appropriate amount of
> transform on the <use> which refers the symbol.

So create a visibility:hidden untransformed use and get the bounding box of that.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Yes that is the workaround solution but would'nt that add extra work load on the SVG player, especially if I have say 100s of symbols, We use symbols as library of graphical units and that is why we are having 100s of them.
If there is no observable impact on performance, then it is OK
If you wanted to fix the bug in firefox you'd probably do something along the lines of comment 3 anyway so the performance would come out the same. Patches are always welcome if you want to work on this.
You need to log in before you can comment on or make changes to this bug.