diff options
author | Federico Mena Quintero <federico@gnome.org> | 2019-09-19 15:25:03 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2019-09-19 18:25:56 -0500 |
commit | ae7ecfa0846b40d75f5b20c4f122df9a0b78ee4f (patch) | |
tree | d18eafe476e8e16a63495cae2f22a7545d39ab42 /tests | |
parent | b4aa8d277d30f4042797dc8b64c073b10f8bac4b (diff) | |
download | librsvg-ae7ecfa0846b40d75f5b20c4f122df9a0b78ee4f.tar.gz |
(#506): Fix empty patterns which reference a fallback pattern with children
When we do draw_ctx.acquired_nodes().get_node_of_type() to acquire a
pattern, or its fallback, we need to set the NodePattern.node to the
corresponding node weakref.
This was being done correctly at the beginning of the implementation
of resolve(), as of commit 03cbbe96, where the sequence is this:
DrawingCtx.set_source_paint_server()
paint_server = acquired_nodes.get_node()
<paint_server as NodePattern>.resolve_fallbacks_and_set_pattern()
self.resolve(node, ...)
*self.node.borrow_mut() = Some(node.downgrade());
However, this setting of self.node (where self is a NodePattern) to
the corresponding weakref was missing in the "while" loop in
NodePattern.resolve(), where it acquires the fallback pattern - the
fallback's NodePattern also needs its .node to be set to its node's
weakref.
We'll clean this up at some point.
Fixes https://gitlab.gnome.org/GNOME/librsvg/issues/506
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/reftests/bugs/506-pattern-fallback-ref.png | bin | 0 -> 486 bytes | |||
-rw-r--r-- | tests/fixtures/reftests/bugs/506-pattern-fallback.svg | 19 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/fixtures/reftests/bugs/506-pattern-fallback-ref.png b/tests/fixtures/reftests/bugs/506-pattern-fallback-ref.png Binary files differnew file mode 100644 index 00000000..b9fec4e9 --- /dev/null +++ b/tests/fixtures/reftests/bugs/506-pattern-fallback-ref.png diff --git a/tests/fixtures/reftests/bugs/506-pattern-fallback.svg b/tests/fixtures/reftests/bugs/506-pattern-fallback.svg new file mode 100644 index 00000000..64f71050 --- /dev/null +++ b/tests/fixtures/reftests/bugs/506-pattern-fallback.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.1" + width="256" + height="256" + viewBox="0 0 256 256"> + <defs> + <pattern id="pattern1" xlink:href="#pattern2"/> + <pattern id="pattern2" patternUnits="userSpaceOnUse" width="1" height="1"> + <image width="1" height="1" preserveAspectRatio="none" + xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12Ng+M8AAAICAQCqKp4n +AAAAAElFTkSuQmCC" + x="0" + y="0"/> + </pattern> + </defs> + <rect x="100" y="100" width="56" height="56" style="fill:url(#pattern1);"/> +</svg> |