SVG <view> IRIs that link to nested <svg> elements are not handled correctly




3 years ago
3 years ago


(Reporter: Paul LeBeau, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



3 years ago
Created attachment 8489950 [details]
testcase 1 -- Click "[sub view]" text to test

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36

Steps to reproduce:

The SVG 1.1 spec specifies:

If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport. 

So in the following SVG only the nested <svg> with id "inner" should be rendered when the <view> element is linked.

   ... content not rendered...
  <svg id="inner">
    .. content that *is* rendered...
    <view id="test" .../>

This is not what happens in FF however.  All views are treated the same.

Expected results:

In the attached test file, the red square and yellow rectangle should not be rendered.
Yup, the spec does say to only display "the closest ancestor 'svg' element", and we don't seem to have that implemented.  The text seems to be the same in SVG2, too:

Paul: Do you know if this works correctly in any rendering engine?  (I tested Opera 12.16 [Presto] and it matches the current Firefox behavior; Chrome 39 [Blink] doesn't do anything at all when I click the link in the testcase.)
Depends on: 512525
OS: Windows 7 → All
Hardware: x86_64 → All
Version: 32 Branch → Trunk
Ever confirmed: true
Attachment #8489950 - Attachment description: test_view_nested.svg → testcase 1 -- Click "[sub view]" text to test
Indeed, I didn't implement it because nobody else did and I didn't have any testcases I could rely on.
We could, of course just fix the spec so that it always goes to the root svg element and not implement this as it seems that nobody really wants it.

Comment 4

3 years ago
I tried FF, Chrome, IE and Batik. Only the first two support view IRIs anyway.

View IRIs could be useful if they worked everywhere - eg. SVG sprite sheets.  But I'm not sure what extra usefulness the nested view rule adds to views in general.

Also the spec isn't clear what exactly what "only displaying the closest ancestor" means anyway.  I can think of three ways someone might implement that:
1) Use the outermost <svg> for the viewport, but only display the nested one.
2) Treat the nested SVG as the outermost <svg> and use it for the viewport.
3) Apply the <view> viewBox to the outermost <svg> but only display the nested one.

So given that no-one implements it, and it is hidden behind a feature (view IRIs) that only half the browsers support anyway, I am leaning towards Robert's suggestion to propose its removal.

Comment 5

3 years ago
Correction: only FF and Batik (and, as Daniel discovered, Opera) support view IRIs.
You need to log in before you can comment on or make changes to this bug.