diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-08-29 15:30:25 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-08-29 15:30:25 -0500 |
commit | 72a5138804110fd9ce9f03bf8de321f7ab898750 (patch) | |
tree | 5681bd5f9f71012468dd7b3b96d93d0f68ac2be2 | |
parent | 98f0643d999ca8c1522f7fdf4e411a20bac84421 (diff) | |
download | librsvg-72a5138804110fd9ce9f03bf8de321f7ab898750.tar.gz |
Inline function in its only caller
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>
-rw-r--r-- | src/document.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/document.rs b/src/document.rs index bc9ded7d..e1060088 100644 --- a/src/document.rs +++ b/src/document.rs @@ -614,20 +614,16 @@ impl DocumentBuilder { /// Creates a node for an XML text element as a child of `parent`. pub fn append_characters(&mut self, text: &str, parent: &mut Node) { if !text.is_empty() { - self.append_chars_to_parent(text, parent); + // When the last child is a Chars node we can coalesce + // the text and avoid screwing up the Pango layouts + if let Some(child) = parent.last_child().filter(|c| c.is_chars()) { + child.borrow_chars().append(text); + } else { + parent.append(Node::new(NodeData::new_chars(text))); + }; } } - fn append_chars_to_parent(&mut self, text: &str, parent: &mut Node) { - // When the last child is a Chars node we can coalesce - // the text and avoid screwing up the Pango layouts - if let Some(child) = parent.last_child().filter(|c| c.is_chars()) { - child.borrow_chars().append(text); - } else { - parent.append(Node::new(NodeData::new_chars(text))); - }; - } - pub fn resolve_href(&self, href: &str) -> Result<AllowedUrl, AllowedUrlError> { self.load_options.url_resolver.resolve_href(href) } |