[librsvg: 3/4] Do not count tspan attributes on `<a>`




commit d0fdccda2055942166dc988877f3307940b78f83
Author: Michael Howell <michael notriddle com>
Date:   Fri Oct 8 18:25:58 2021 -0700

    Do not count tspan attributes on `<a>`
    
    After re-reading the description of links,
    and testing in other implementations,
    it seems like these attributes don't count on <a> tags,
    even when they're nested in text.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/601>

 src/structure.rs | 5 -----
 src/text.rs      | 4 +++-
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/structure.rs b/src/structure.rs
index 28fde6d1..77cc49eb 100644
--- a/src/structure.rs
+++ b/src/structure.rs
@@ -15,7 +15,6 @@ use crate::length::*;
 use crate::node::{CascadedValues, Node, NodeBorrow, NodeDraw};
 use crate::parsers::{Parse, ParseValue};
 use crate::rect::Rect;
-use crate::text::TSpan;
 use crate::viewbox::*;
 use crate::xml::Attributes;
 
@@ -513,8 +512,6 @@ impl Draw for Mask {}
 #[derive(Default)]
 pub struct Link {
     pub link: Option<String>,
-    // These attributes are only applicable in <text><a></a></text>.
-    pub tspan: TSpan,
 }
 
 impl SetAttributes for Link {
@@ -526,8 +523,6 @@ impl SetAttributes for Link {
             }
         }
 
-        self.tspan.set_attributes(attrs)?;
-
         Ok(())
     }
 }
diff --git a/src/text.rs b/src/text.rs
index 20a673c6..f5d715f9 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -364,7 +364,9 @@ fn children_to_chunks(
                 }
 
                 Element::Link(ref link) => {
-                    let tspan = &link.tspan;
+                    // TSpan::default tes all offsets to 0,
+                    // which is what we want in links.
+                    let tspan = TSpan::default();
                     let cascaded = CascadedValues::new(cascaded, &child);
                     tspan.to_chunks(
                         &child,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]