Bug 44144

Summary: References to markers in external SVG documents not applied.
Product: WebKit Reporter: Mike Hemesath <mike.hemesath>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: cigitia, ivan.enderlin, karlcow, krit, rene.peinl, rwlbuis, taher_ali, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.6   
See Also: https://bugs.webkit.org/show_bug.cgi?id=258781
Bug Depends on: 65344    
Bug Blocks:    
Attachments:
Description Flags
SVG file containing the marker
none
rendering in safari, firefox, chrome
none
testcase + server none

Mike Hemesath
Reported 2010-08-17 17:26:55 PDT
Created attachment 64656 [details] SVG file containing the marker If a path is given a marker-end reference that is external to its SVG document, that marker will not be applied. Example: #myMarker located in marker.svg is not applied because it is external to the document the path is in. <path d="M0,30 h100" stroke-width="10" stroke="#000" id="myPath" marker-end="url(marker.svg#myMarker)" /> The marker is correctly applied on Firefox 3.6 and Opera 10.6 I will attach a working example that exposes the issue.
Attachments
SVG file containing the marker (534 bytes, image/svg+xml)
2010-08-17 17:26 PDT, Mike Hemesath
no flags
rendering in safari, firefox, chrome (280.22 KB, image/png)
2026-05-11 03:29 PDT, Karl Dubost
no flags
testcase + server (4.37 KB, application/zip)
2026-05-11 03:30 PDT, Karl Dubost
no flags
Mike Hemesath
Comment 1 2010-08-17 17:36:55 PDT
For whatever reason, the SVG document won't find the marker for any browser when it references the attachment. Here is a URL showing the issue: http://www.mikehemesath.com/svg_markers/demo3/arrow.svg
Dirk Schulze
Comment 2 2010-08-17 22:31:34 PDT
We don't support external SVG-resources right now.
Mike Hemesath
Comment 3 2010-08-18 06:09:22 PDT
Given the behavior of the other browsers, specifically relating to bug https://bugs.webkit.org/show_bug.cgi?id=44047. Applying markers to SVG inline HTML5 documents using external stylesheets will be impossible to do until this is resolved.
René Peinl
Comment 4 2013-10-23 02:45:23 PDT
This bug is pretty old, given the development speed of Webkit and still the problem exists, not only on Mac OS X, but also on Windows. Both Firefox and Opera until version 12 support this. Now that Opera switched to Webkit, it is not supported any more. IE10 does not support this. I don't know about IE11. Can't you push the priority of this a little?
Karl Dubost
Comment 5 2026-05-11 03:29:08 PDT
Created attachment 479598 [details] rendering in safari, firefox, chrome testcase with different types of marker.
Karl Dubost
Comment 6 2026-05-11 03:30:54 PDT
Created attachment 479599 [details] testcase + server unzip then python3 serve.py then http://localhost:8000/testcase.html
Karl Dubost
Comment 7 2026-05-11 03:32:19 PDT
A self-contained replacement testcase covering all three vertex-marker properties (the original bug only mentioned `marker-end`): - `markers.svg` — external marker-definition document. Three markers with distinct shapes and colors so a failure (no marker painted) is trivially distinguishable from a success: - `#markerStart` — green circle - `#markerMid` — blue square - `#markerEnd` — red triangle - `testcase-external.svg` — path referencing the three markers via `url(markers.svg#id)`. **This is the bug-reproducing file.** - `testcase-inline-control.svg` — identical path with inline marker definitions. **Must render correctly in every engine** — it does not exercise external resources. It exists as a baseline to confirm the visual expectation. - `testcase.html` — wrapper that loads both SVGs in `<object>` elements so the external-vs-inline difference is obvious side-by-side. - `serve.py` — minimal HTTP server that forces `Content-Type: image/svg+xml` on `.svg` (WebKit over `file://` infers the MIME from the extension, so HTTP is not strictly required, but it eliminates MIME-inference as a variable). ## Path geometry — why 5 vertices The path `M 40 70 L 80 30 L 120 80 L 160 30 L 200 70` is a zigzag with five vertices, which is the minimum that exercises all three vertex-marker properties distinctly: | Vertex | Coord | Property painted | |--------|-----------|-------------------| | 1 | (40, 70) | `marker-start` | | 2 | (80, 30) | `marker-mid` #1 | | 3 | (120, 80) | `marker-mid` #2 | | 4 | (160, 30) | `marker-mid` #3 | | 5 | (200, 70) | `marker-end` | Total: 5 painted markers. A file that shows only the grey zigzag stroke with no markers has failed. ## Spec grounding SVG 2 §13.9 "Vertex markers: the 'marker-start', 'marker-mid' and 'marker-end' properties" (https://svgwg.org/svg2-draft/painting.html#VertexMarkerProperties): > Value: `none | <marker-ref>` > Initial: `none` > Applies to: shapes > Inherited: yes > The 'marker-start' and 'marker-end' properties are used to specify the > marker that will be drawn at the first and last vertices of the given > shape, respectively. 'marker-mid' is used to specify the marker that > will be drawn at all other vertices (i.e., every vertex except the first > and last). > `<marker-ref> = <url>` The property value accepts any `<url>` — the spec does not restrict the URL to same-document fragment references. An external document reference such as `url(markers.svg#markerStart)` is therefore spec-conforming syntax, and the behavior under test is whether WebKit fetches the referenced document and resolves the `<marker>` element by id. Note: per SVG 2 §13.4.5 "Computed value", the computed value has `<url>` values *made absolute*, which means the engine is expected to resolve the relative reference — another confirmation that external references are in scope of the spec. ## Expected vs actual - **Firefox / Chromium (Blink):** render the external case identically to the inline control — 5 markers. - **WebKit (as of 2026-05-11):** renders the path stroke with no markers attached to the external-reference case. The inline control renders correctly.
Karl Dubost
Comment 8 2026-05-11 03:38:21 PDT
There are probably missing WPT test cases for this too.
Karl Dubost
Comment 9 2026-05-11 03:46:31 PDT
SVGURIReference::fragmentIdentifierFromIRIString (Source/WebCore/svg/SVGURIReference.cpp:73-90) silently returns emptyAtom() for any URL that doesn't resolve to the current document, and both marker-lookup paths call it. WebKit's marker resolution pipeline has no knowledge of external SVG documents. The URL is silently truncated to its fragment inside `SVGURIReference::fragmentIdentifierFromIRIString`, which returns `emptyAtom()` whenever the URL points outside the current document. The marker-lookup code then looks up an empty id in the current document's tree scope and finds nothing. There is no `CachedSVGDocumentReference`, no fetch, no external-doc tree-scope lookup, and no invalidation plumbing for markers. Filters (e.g. `filter: url(sheet.svg#blur)`) *do* support external refs via a well-defined pattern; markers do not.
Radar WebKit Bug Importer
Comment 10 2026-07-05 09:45:34 PDT
Note You need to log in before you can comment on or make changes to this bug.