Problem with fragment identifiers (ID) for svg graphs
When generating svg images with id and href, it is impossible to scroll to the right location in the svg image because of the following mechanism (function emit_page in lib/common/emit.c):
- First, the code generates the <g id="a_ID"> label (calling svg_begin_anchor in file gvrender_core_svg.c)
- Then it generates the <a href="URL"> label inside the previous g
- Inside the previous a, it generates the background (using the function emit_background in lib/common/emit.c that calls gvrender_box in render.c)
- Inside the a, it generates the label itself (emit_label in lib/common/labels.c).
The problem is that there are no coordinates given for the label g that contains the id, given that all coordinates are located in the background box and the label itself. Hence, when going to myfile.svg#a_ID, the browser is not able to determine where it is.
One solution (in the common files) would be to change the way the anchor is generated resulting in the id attribute being written inside the emit_label function. This would require some changes in the prototype of the functions (so that it could be possible to pass an id to emit_label). In this case, the id attribute would be directly tied to the coordinates x and y of the label and not put on top of it. Another solution (this time in the svg render core) would be to replace the <g> label by a <text text-anchor="start" x="XXXX" y="YYYY" id="a_ID" fill="none">a_ID that would allow giving coordinates along the id (note https://bugzilla.mozilla.org/show_bug.cgi?id=1431446 and crbug.com/803440 ).