[librsvg: 1/3] (#92): In the use element, honor the overflow:hidden property of a referenced symbol
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/3] (#92): In the use element, honor the overflow:hidden property of a referenced symbol
- Date: Sat, 27 Aug 2022 02:28:50 +0000 (UTC)
commit a1b134bf0a4c6ad884d3ae88a0767563ea68a438
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Aug 26 19:32:09 2022 -0500
(#92): In the use element, honor the overflow:hidden property of a referenced symbol
We meant to look at the referenced <symbol>'s computed values, not the
<use>'s computed values.
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/92
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/737>
src/drawing_ctx.rs | 10 +++++-----
tests/fixtures/reftests/bugs-reftests/92-symbol-clip-ref.svg | 5 +++++
tests/fixtures/reftests/bugs-reftests/92-symbol-clip.svg | 12 ++++++++++++
tests/src/reference.rs | 6 ++++++
4 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 6347304f7..7ba1c015b 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -108,6 +108,8 @@ pub struct FontOptions {
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum ClipMode {
ClipToViewport,
+
+ // FIXME: this is not used anymore!?
ClipToVbox,
}
@@ -1690,12 +1692,10 @@ impl DrawingCtx {
let elt = child.borrow_element();
let symbol = borrow_element_as!(child, Symbol);
+ let symbol_values = elt.get_computed_values();
- let clip_mode = if !values.is_overflow()
- || (values.overflow() == Overflow::Visible
- && elt.get_specified_values().is_overflow())
- {
- Some(ClipMode::ClipToVbox)
+ let clip_mode = if !symbol_values.is_overflow() {
+ Some(ClipMode::ClipToViewport)
} else {
None
};
diff --git a/tests/fixtures/reftests/bugs-reftests/92-symbol-clip-ref.svg
b/tests/fixtures/reftests/bugs-reftests/92-symbol-clip-ref.svg
new file mode 100644
index 000000000..c319e2fac
--- /dev/null
+++ b/tests/fixtures/reftests/bugs-reftests/92-symbol-clip-ref.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="100" height="100" viewBox="0 0 100 100">
+ <rect x="0" y="0" width="40" height="40" fill="lime"/>
+</svg>
diff --git a/tests/fixtures/reftests/bugs-reftests/92-symbol-clip.svg
b/tests/fixtures/reftests/bugs-reftests/92-symbol-clip.svg
new file mode 100644
index 000000000..f25b65b24
--- /dev/null
+++ b/tests/fixtures/reftests/bugs-reftests/92-symbol-clip.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="100" height="100" viewBox="0 0 100 100">
+ <defs>
+ <symbol id="foo" viewBox="0 0 50 50">
+ <rect x="0" y="0" width="40" height="40" fill="lime"/>
+ <rect x="50" y="0" width="40" height="40" fill="red"/>
+ </symbol>
+ </defs>
+
+ <use x="0" y="0" width="50" height="50" xlink:href="#foo"/>
+</svg>
diff --git a/tests/src/reference.rs b/tests/src/reference.rs
index 665baec01..00d6428c1 100644
--- a/tests/src/reference.rs
+++ b/tests/src/reference.rs
@@ -406,3 +406,9 @@ test_svg_reference!(
"tests/fixtures/reftests/bugs-reftests/880-stroke-wide-line.svg",
"tests/fixtures/reftests/bugs-reftests/880-stroke-wide-line-ref.svg"
);
+
+test_svg_reference!(
+ bug_92_symbol_clip,
+ "tests/fixtures/reftests/bugs-reftests/92-symbol-clip.svg",
+ "tests/fixtures/reftests/bugs-reftests/92-symbol-clip-ref.svg"
+);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]