Support media fragments with SVG documents
Categories
(Core :: SVG, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox147 | --- | fixed |
People
(Reporter: longsonr, Assigned: longsonr, NeedInfo)
Details
(Keywords: dev-doc-complete)
Attachments
(3 files)
| Assignee | ||
Comment 1•4 months ago
|
||
Updated•4 months ago
|
| Assignee | ||
Comment 2•4 months ago
|
||
| Assignee | ||
Comment 3•4 months ago
|
||
From https://svgwg.org/svg2-draft/linking.html#SVGFragmentIdentifiers
-
If the SVG fragment identifier addresses a space segment (e.g., MyDrawing.svg#xywh=0,0,100,100),then the initial view into the SVG document is established using the view specification attributes on the outermost svg element where the 'viewBox' is overriden by the x, y, width and height values provided by the fragment identifier.
-
If the SVG fragment identifier addresses a time segment (e.g., MyDrawing.svg#t=10),then the initial view into the SVG document is established as if no fragment identifier was provided. The rendering of the SVG Document shall be as if the setCurrentTime method on the SVG Document element had been called with the begin time value from the fragment identifier. Additionally, if an end time value is provided in the fragment identifier, the effect is equivalent to calling the pauseAnimations method on the SVG Document when the document time reaches the end time of the fragment identifier.
Updated•4 months ago
|
| Assignee | ||
Comment 4•4 months ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2528ce0feb60
https://hg.mozilla.org/mozilla-central/rev/8c5742cd1005
https://hg.mozilla.org/mozilla-central/rev/a083f2717228
| Assignee | ||
Comment 9•4 months ago
|
||
SVG Documents now work the same as videos i.e. they support media fragment identifiers as defined in https://www.w3.org/TR/media-frags/
-
you can play a portion of a SMIL animation from a specific start time to a specific end time (where the animation will pause) via the temporal dimension syntax.
-
you can display a specific area of an SVG document via the spatial dimension syntax. This works in a similar way to the existing #svgView(viewBox(x,y,w,h)) syntax
Comment 10•2 months ago
|
||
Media fragments documentation now published: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Media_fragments.
| Assignee | ||
Comment 11•2 months ago
|
||
If you've found that spatial values work unreliably with percentages maybe you could raise a new bug with an example of the issue.
Comment 12•2 months ago
•
|
||
(In reply to Robert Longson [:longsonr] from comment #11)
If you've found that spatial values work unreliably with percentages maybe you could raise a new bug with an example of the issue.
Thanks for bringing this up, Robert. I should have explored this further with you before publishing.
This might be due to my misunderstanding of how the spatial syntax % values should be used, but when testing them, I was unable to get it to work as I'd expect. I'll give you a couple of examples, and you can tell me whether it is worth filing a separate bug.
If I:
- Go to the example at https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Media_fragments#displaying_a_subset_of_an_svg_image.
- Modify the
srcattribute of the<img>element tosrc="/shared-assets/images/examples/firefox-logo.svg#xywh=percent:0,0,50,50".
I would expect the image displayed to be the top-left quarter of the Firefox logo. But it isn't. It seems to display a tiny fraction of it. In fact, if you test it on the raw image displayed in a browser tab, it seems to display nothing: https://bef81064f6f7ee9660c9e8b81a0b2c12a080bab7.mdnplay.dev/shared-assets/images/examples/firefox-logo.svg#xywh=percent:0,0,50,50
If I change the fragment to #xywh=percent:0,0,100,100, I'd expect it to display the entire image (top corner = 0%,0%, width and height 100%), but it doesn't: https://bef81064f6f7ee9660c9e8b81a0b2c12a080bab7.mdnplay.dev/shared-assets/images/examples/firefox-logo.svg#xywh=percent:0,0,100,100.
Description
•