[librsvg: 1/2] Expand `font:inherit` and `marker:inherit`
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/2] Expand `font:inherit` and `marker:inherit`
- Date: Wed, 13 Oct 2021 00:17:30 +0000 (UTC)
commit b6cb910167cd042f3c7b15012cc35e3337791623
Author: Michael Howell <michael notriddle com>
Date: Sun Oct 10 15:37:46 2021 -0700
Expand `font:inherit` and `marker:inherit`
Fixes #800
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/602>
src/properties.rs | 40 +++++++++++++++++++++++++++++++
tests/fixtures/crash/800-font-inherit.svg | 1 +
tests/fixtures/crash/800-marker.svg | 1 +
3 files changed, 42 insertions(+)
---
diff --git a/src/properties.rs b/src/properties.rs
index cefcdce6..d2ea9f85 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -542,6 +542,12 @@ impl SpecifiedValues {
ParsedProperty::Marker(SpecifiedValue::Specified(ref m)) => {
self.expand_marker_shorthand(m, replace)
}
+ ParsedProperty::Font(SpecifiedValue::Inherit) => {
+ self.expand_font_shorthand_inherit(replace)
+ }
+ ParsedProperty::Marker(SpecifiedValue::Inherit) => {
+ self.expand_marker_shorthand_inherit(replace)
+ }
_ => self.set_property(prop, replace),
}
@@ -605,6 +611,40 @@ impl SpecifiedValues {
);
}
+ fn expand_font_shorthand_inherit(&mut self, replace: bool) {
+ self.set_property(&ParsedProperty::FontStyle(SpecifiedValue::Inherit), replace);
+ self.set_property(
+ &ParsedProperty::FontVariant(SpecifiedValue::Inherit),
+ replace,
+ );
+ self.set_property(
+ &ParsedProperty::FontWeight(SpecifiedValue::Inherit),
+ replace,
+ );
+ self.set_property(
+ &ParsedProperty::FontStretch(SpecifiedValue::Inherit),
+ replace,
+ );
+ self.set_property(&ParsedProperty::FontSize(SpecifiedValue::Inherit), replace);
+ self.set_property(
+ &ParsedProperty::LineHeight(SpecifiedValue::Inherit),
+ replace,
+ );
+ self.set_property(
+ &ParsedProperty::FontFamily(SpecifiedValue::Inherit),
+ replace,
+ );
+ }
+
+ fn expand_marker_shorthand_inherit(&mut self, replace: bool) {
+ self.set_property(
+ &ParsedProperty::MarkerStart(SpecifiedValue::Inherit),
+ replace,
+ );
+ self.set_property(&ParsedProperty::MarkerMid(SpecifiedValue::Inherit), replace);
+ self.set_property(&ParsedProperty::MarkerEnd(SpecifiedValue::Inherit), replace);
+ }
+
pub fn set_parsed_property(&mut self, prop: &ParsedProperty) {
self.set_property_expanding_shorthands(prop, true);
}
diff --git a/tests/fixtures/crash/800-font-inherit.svg b/tests/fixtures/crash/800-font-inherit.svg
new file mode 100644
index 00000000..517af776
--- /dev/null
+++ b/tests/fixtures/crash/800-font-inherit.svg
@@ -0,0 +1 @@
+<svg><text style="font: inherit"></text><text styyle=""></text></svg>
diff --git a/tests/fixtures/crash/800-marker.svg b/tests/fixtures/crash/800-marker.svg
new file mode 100644
index 00000000..ac7020fd
--- /dev/null
+++ b/tests/fixtures/crash/800-marker.svg
@@ -0,0 +1 @@
+<svg width="10" height="10"><text style="marker: inherit"></text></svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]