]> granicus.if.org Git - graphviz/commitdiff
fix misidentified gradient fills when using IDs
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 12 Nov 2022 23:35:22 +0000 (15:35 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 12 Nov 2022 23:40:10 +0000 (15:40 -0800)
465cef702370966f17d27d455093cf69a651af9c fixed an issue where `id` attributes
were not propagated to SVG output. However unfortunately it broke references to
such attributes in fill gradients. This commit makes the corresponding
adjustment to the references, so they once again align with their targets.

Gitlab: fixes #2307
Reported-by: Ronny H
CHANGELOG.md
plugin/core/gvrender_core_svg.c
tests/test_regression.py

index 665f4e4df2287e293ee44838fbc86d5ce38d2ae6..8bd575510aaf2ce039479830f894606d99e36f35 100644 (file)
@@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - `gxl2gv`, when dealing with `name` attributes, may be less likely to crash. We
   say “may be less likely” because a bug remains that makes a crash still
   the most likely outcome. #2300
+- Gradient URL references in SVG output once again align with their targets
+  (linear or radial gradients) when `id` attributes are in use. This was
+  arguably a regression in Graphviz 6.0.1. #2307
 
 ## [7.0.1] – 2022-11-09
 
index 363ef2985d2b9afee43c9a18dcf5681ffa50ee80..6505911427f2f324ac843de5e8d91186ab6bdfed 100644 (file)
@@ -163,9 +163,19 @@ static void svg_grstyle(GVJ_t * job, int filled, int gid)
 
     gvputs(job, " fill=\"");
     if (filled == GRADIENT) {
-       gvprintf(job, "url(#l_%d)", gid);
+       gvputs(job, "url(#");
+       if (obj->id != NULL) {
+           gvputs_xml(job, obj->id);
+           gvputc(job, '_');
+       }
+       gvprintf(job, "l_%d)", gid);
     } else if (filled == RGRADIENT) {
-       gvprintf(job, "url(#r_%d)", gid);
+       gvputs(job, "url(#");
+       if (obj->id != NULL) {
+           gvputs_xml(job, obj->id);
+           gvputc(job, '_');
+       }
+       gvprintf(job, "r_%d)", gid);
     } else if (filled) {
        svg_print_paint(job, obj->fillcolor);
        if (obj->fillcolor.type == RGBA_BYTE
index 2fb8de5ee11eab6eca4ece4dfb9e6817d33e9715..ad442c262004184463059a06a5876b1f48132775 100644 (file)
@@ -2001,7 +2001,6 @@ def test_2300_1():
   # ask `gxl2gv` to process this
   subprocess.check_call(["gxl2gv", input])
 
-@pytest.mark.xfail(strict=True)
 def test_2307():
   """
   'id' attribute should be propagated to 'url' links in SVG output