Closed Bug 1999989 Opened 4 months ago Closed 4 months ago

Support media fragments with SVG documents

Categories

(Core :: SVG, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: longsonr, Assigned: longsonr, NeedInfo)

Details

(Keywords: dev-doc-complete)

Attachments

(3 files)

No description provided.
Assignee: nobody → longsonr
Status: NEW → ASSIGNED

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.

Attachment #9526502 - Attachment description: Bug 1999989 Part 1 - Rename and export MediaFragmentURIParser r=emilio → Bug 1999989 Part 1 - Rename, move and export MediaFragmentURIParser r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/56116 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Upstream PR merged by moz-wptsync-bot

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

Flags: in-testsuite+
Keywords: dev-doc-needed

If you've found that spatial values work unreliably with percentages maybe you could raise a new bug with an example of the issue.

Flags: needinfo?(chrisdavidmills)

(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:

  1. 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.
  2. Modify the src attribute of the <img> element to src="/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.

Flags: needinfo?(chrisdavidmills) → needinfo?(longsonr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: