[librsvg: 9/10] text: rename NodeChars to Chars
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 9/10] text: rename NodeChars to Chars
- Date: Mon, 16 Mar 2020 23:43:21 +0000 (UTC)
commit efe4047afe1899cd440e74057a7f3c4c9b09710e
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Mar 16 13:47:29 2020 +0100
text: rename NodeChars to Chars
rsvg_internals/src/node.rs | 12 ++++++------
rsvg_internals/src/text.rs | 24 ++++++++++++------------
2 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 668d7d89..b0e29355 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -24,7 +24,7 @@ use crate::error::*;
use crate::filters::FilterEffect;
use crate::properties::{ComputedValues, SpecifiedValues};
use crate::property_bag::PropertyBag;
-use crate::text::NodeChars;
+use crate::text::Chars;
/// Strong reference to an element in the SVG tree.
///
@@ -72,7 +72,7 @@ pub type RsvgWeakNode = rctree::WeakNode<NodeData>;
/// `borrow_chars`, `borrow_element`, or `borrow_element_mut`.
pub enum NodeData {
Element(Box<Element>),
- Text(NodeChars),
+ Text(Chars),
}
impl NodeData {
@@ -81,7 +81,7 @@ impl NodeData {
}
pub fn new_chars() -> NodeData {
- NodeData::Text(NodeChars::new())
+ NodeData::Text(Chars::new())
}
}
@@ -219,10 +219,10 @@ pub trait NodeBorrow {
/// Returns `true` for NodeData::Text, `false` otherwise.
fn is_chars(&self) -> bool;
- /// Borrows a `NodeChars` reference.
+ /// Borrows a `Chars` reference.
///
/// Panics: will panic if `&self` is not a `NodeData::Text` node
- fn borrow_chars(&self) -> Ref<NodeChars>;
+ fn borrow_chars(&self) -> Ref<Chars>;
/// Borrows an `Element` reference
///
@@ -250,7 +250,7 @@ impl NodeBorrow for RsvgNode {
}
}
- fn borrow_chars(&self) -> Ref<NodeChars> {
+ fn borrow_chars(&self) -> Ref<Chars> {
Ref::map(self.borrow(), |n| match *n {
NodeData::Text(ref c) => c,
_ => panic!("tried to borrow_chars for a non-text node"),
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index da8c2b99..a03991e7 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -469,37 +469,37 @@ fn children_to_chunks(
}
}
-/// In SVG text elements, we use `NodeChars` to store character data. For example,
+/// In SVG text elements, we use `Chars` to store character data. For example,
/// an element like `<text>Foo Bar</text>` will be a `Text` with a single child,
-/// and the child will be a `NodeChars` with "Foo Bar" for its contents.
+/// and the child will be a `Chars` with "Foo Bar" for its contents.
///
/// Text elements can contain `<tspan>` sub-elements. In this case,
-/// those `tspan` nodes will also contain `NodeChars` children.
+/// those `tspan` nodes will also contain `Chars` children.
///
-/// A text or tspan element can contain more than one `NodeChars` child, for example,
+/// A text or tspan element can contain more than one `Chars` child, for example,
/// if there is an XML comment that splits the character contents in two:
///
/// ```xml
/// <text>
-/// This sentence will create a NodeChars.
+/// This sentence will create a Chars.
/// <!-- this comment is ignored -->
-/// This sentence will cretea another NodeChars.
+/// This sentence will cretea another Chars.
/// </text>
/// ```
///
/// When rendering a text element, it will take care of concatenating the strings
-/// in its `NodeChars` children as appropriate, depending on the
-/// `xml:space="preserve"` attribute. A `NodeChars` stores the characters verbatim
+/// in its `Chars` children as appropriate, depending on the
+/// `xml:space="preserve"` attribute. A `Chars` stores the characters verbatim
/// as they come out of the XML parser, after ensuring that they are valid UTF-8.
-pub struct NodeChars {
+pub struct Chars {
string: RefCell<String>,
space_normalized: RefCell<Option<String>>,
}
-impl NodeChars {
- pub fn new() -> NodeChars {
- NodeChars {
+impl Chars {
+ pub fn new() -> Chars {
+ Chars {
string: RefCell::new(String::new()),
space_normalized: RefCell::new(None),
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]