Commit fe5d9d5d authored by Paolo Borelli's avatar Paolo Borelli

Rename RsvgLength to simply Length

Now that it is not used from C, we can drop the manual namespacing.
parent 39427d7f
......@@ -3,7 +3,7 @@ use cairo::{self, MatrixTrait};
use bbox::BoundingBox;
use drawing_ctx::DrawingCtx;
use length::RsvgLength;
use length::Length;
use super::context::{FilterContext, FilterInput, FilterOutput, IRect};
......@@ -20,10 +20,10 @@ pub struct BoundsBuilder<'a> {
standard_input_was_referenced: bool,
/// Filter primitive properties.
x: Option<RsvgLength>,
y: Option<RsvgLength>,
width: Option<RsvgLength>,
height: Option<RsvgLength>,
x: Option<Length>,
y: Option<Length>,
width: Option<Length>,
height: Option<Length>,
}
impl<'a> BoundsBuilder<'a> {
......@@ -31,10 +31,10 @@ impl<'a> BoundsBuilder<'a> {
#[inline]
pub fn new(
ctx: &'a FilterContext,
x: Option<RsvgLength>,
y: Option<RsvgLength>,
width: Option<RsvgLength>,
height: Option<RsvgLength>,
x: Option<Length>,
y: Option<Length>,
width: Option<Length>,
height: Option<Length>,
) -> Self {
Self {
ctx,
......
......@@ -7,7 +7,7 @@ use cairo::{self, MatrixTrait};
use bbox::BoundingBox;
use coord_units::CoordUnits;
use drawing_ctx::DrawingCtx;
use length::RsvgLength;
use length::Length;
use node::RsvgNode;
use paint_server::{self, PaintServer};
use srgb::{linearize_surface, unlinearize_surface};
......@@ -434,7 +434,7 @@ impl FilterContext {
pub fn with_primitive_units<F, T>(&self, draw_ctx: &mut DrawingCtx, f: F) -> T
// TODO: Get rid of this Box? Can't just impl Trait because Rust cannot do higher-ranked types.
where
for<'b> F: FnOnce(Box<Fn(&RsvgLength) -> f64 + 'b>) -> T,
for<'b> F: FnOnce(Box<Fn(&Length) -> f64 + 'b>) -> T,
{
// Filters use the properties of the target node.
let cascaded = self.node_being_filtered.get_cascaded_values();
......@@ -445,12 +445,12 @@ impl FilterContext {
// See comments in compute_effects_region() for how this works.
if filter.primitiveunits.get() == CoordUnits::ObjectBoundingBox {
draw_ctx.push_view_box(1.0, 1.0);
let rv = f(Box::new(RsvgLength::get_unitless));
let rv = f(Box::new(Length::get_unitless));
draw_ctx.pop_view_box();
rv
} else {
f(Box::new(|length: &RsvgLength| {
f(Box::new(|length: &Length| {
length.normalize(values, draw_ctx)
}))
}
......
......@@ -9,7 +9,7 @@ use coord_units::CoordUnits;
use drawing_ctx::DrawingCtx;
use error::AttributeError;
use handle::RsvgHandle;
use length::{LengthDir, LengthUnit, RsvgLength};
use length::{Length, LengthDir, LengthUnit};
use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
use parsers::{parse_and_validate, ParseError};
use property_bag::PropertyBag;
......@@ -70,10 +70,10 @@ trait Filter: NodeTrait {
/// The base filter primitive node containing common properties.
struct Primitive {
x: Cell<Option<RsvgLength>>,
y: Cell<Option<RsvgLength>>,
width: Cell<Option<RsvgLength>>,
height: Cell<Option<RsvgLength>>,
x: Cell<Option<Length>>,
y: Cell<Option<Length>>,
width: Cell<Option<Length>>,
height: Cell<Option<Length>>,
result: RefCell<Option<String>>,
}
......@@ -124,7 +124,7 @@ impl NodeTrait for Primitive {
.unwrap_or(CoordUnits::UserSpaceOnUse);
let no_units_allowed = primitiveunits == CoordUnits::ObjectBoundingBox;
let check_units = |length: RsvgLength| {
let check_units = |length: Length| {
if !no_units_allowed {
return Ok(length);
}
......@@ -137,7 +137,7 @@ impl NodeTrait for Primitive {
}
};
let check_units_and_ensure_nonnegative =
|length: RsvgLength| check_units(length).and_then(RsvgLength::check_nonnegative);
|length: Length| check_units(length).and_then(Length::check_nonnegative);
for (_key, attr, value) in pbag.iter() {
match attr {
......
......@@ -5,17 +5,17 @@ use attributes::Attribute;
use coord_units::CoordUnits;
use error::AttributeError;
use handle::RsvgHandle;
use length::{LengthDir, LengthUnit, RsvgLength};
use length::{Length, LengthDir, LengthUnit};
use node::{NodeResult, NodeTrait, RsvgNode};
use parsers::{parse, parse_and_validate, Parse, ParseError};
use property_bag::PropertyBag;
/// The <filter> node.
pub struct NodeFilter {
pub x: Cell<RsvgLength>,
pub y: Cell<RsvgLength>,
pub width: Cell<RsvgLength>,
pub height: Cell<RsvgLength>,
pub x: Cell<Length>,
pub y: Cell<Length>,
pub width: Cell<Length>,
pub height: Cell<Length>,
pub filterunits: Cell<CoordUnits>,
pub primitiveunits: Cell<CoordUnits>,
}
......@@ -25,10 +25,10 @@ impl NodeFilter {
#[inline]
pub fn new() -> Self {
Self {
x: Cell::new(RsvgLength::parse_str("-10%", LengthDir::Horizontal).unwrap()),
y: Cell::new(RsvgLength::parse_str("-10%", LengthDir::Vertical).unwrap()),
width: Cell::new(RsvgLength::parse_str("120%", LengthDir::Horizontal).unwrap()),
height: Cell::new(RsvgLength::parse_str("120%", LengthDir::Vertical).unwrap()),
x: Cell::new(Length::parse_str("-10%", LengthDir::Horizontal).unwrap()),
y: Cell::new(Length::parse_str("-10%", LengthDir::Vertical).unwrap()),
width: Cell::new(Length::parse_str("120%", LengthDir::Horizontal).unwrap()),
height: Cell::new(Length::parse_str("120%", LengthDir::Vertical).unwrap()),
filterunits: Cell::new(CoordUnits::ObjectBoundingBox),
primitiveunits: Cell::new(CoordUnits::UserSpaceOnUse),
}
......@@ -52,7 +52,7 @@ impl NodeTrait for NodeFilter {
// With ObjectBoundingBox, only fractions and percents are allowed.
let no_units_allowed = self.filterunits.get() == CoordUnits::ObjectBoundingBox;
let check_units = |length: RsvgLength| {
let check_units = |length: Length| {
if !no_units_allowed {
return Ok(length);
}
......@@ -65,7 +65,7 @@ impl NodeTrait for NodeFilter {
}
};
let check_units_and_ensure_nonnegative =
|length: RsvgLength| check_units(length).and_then(RsvgLength::check_nonnegative);
|length: Length| check_units(length).and_then(Length::check_nonnegative);
// Parse the rest of the attributes.
for (_key, attr, value) in pbag.iter() {
......
......@@ -91,18 +91,18 @@ struct GradientCommon {
#[derive(Copy, Clone)]
enum GradientVariant {
Linear {
x1: Option<RsvgLength>,
y1: Option<RsvgLength>,
x2: Option<RsvgLength>,
y2: Option<RsvgLength>,
x1: Option<Length>,
y1: Option<Length>,
x2: Option<Length>,
y2: Option<Length>,
},
Radial {
cx: Option<RsvgLength>,
cy: Option<RsvgLength>,
r: Option<RsvgLength>,
fx: Option<RsvgLength>,
fy: Option<RsvgLength>,
cx: Option<Length>,
cy: Option<Length>,
r: Option<Length>,
fx: Option<Length>,
fy: Option<Length>,
},
}
......@@ -249,10 +249,10 @@ impl GradientVariant {
// https://www.w3.org/TR/SVG/pservers.html#LinearGradients
GradientVariant::Linear {
x1: Some(RsvgLength::parse_str("0%", LengthDir::Horizontal).unwrap()),
y1: Some(RsvgLength::parse_str("0%", LengthDir::Vertical).unwrap()),
x2: Some(RsvgLength::parse_str("100%", LengthDir::Horizontal).unwrap()),
y2: Some(RsvgLength::parse_str("0%", LengthDir::Vertical).unwrap()),
x1: Some(Length::parse_str("0%", LengthDir::Horizontal).unwrap()),
y1: Some(Length::parse_str("0%", LengthDir::Vertical).unwrap()),
x2: Some(Length::parse_str("100%", LengthDir::Horizontal).unwrap()),
y2: Some(Length::parse_str("0%", LengthDir::Vertical).unwrap()),
}
}
......@@ -260,9 +260,9 @@ impl GradientVariant {
// https://www.w3.org/TR/SVG/pservers.html#RadialGradients
GradientVariant::Radial {
cx: Some(RsvgLength::parse_str("50%", LengthDir::Horizontal).unwrap()),
cy: Some(RsvgLength::parse_str("50%", LengthDir::Vertical).unwrap()),
r: Some(RsvgLength::parse_str("50%", LengthDir::Both).unwrap()),
cx: Some(Length::parse_str("50%", LengthDir::Horizontal).unwrap()),
cy: Some(Length::parse_str("50%", LengthDir::Vertical).unwrap()),
r: Some(Length::parse_str("50%", LengthDir::Both).unwrap()),
fx: None,
fy: None,
......
......@@ -20,10 +20,10 @@ use property_bag::PropertyBag;
pub struct NodeImage {
aspect: Cell<AspectRatio>,
x: Cell<RsvgLength>,
y: Cell<RsvgLength>,
w: Cell<RsvgLength>,
h: Cell<RsvgLength>,
x: Cell<Length>,
y: Cell<Length>,
w: Cell<Length>,
h: Cell<Length>,
surface: RefCell<Option<cairo::ImageSurface>>,
}
......@@ -31,10 +31,10 @@ impl NodeImage {
pub fn new() -> NodeImage {
NodeImage {
aspect: Cell::new(AspectRatio::default()),
x: Cell::new(RsvgLength::default()),
y: Cell::new(RsvgLength::default()),
w: Cell::new(RsvgLength::default()),
h: Cell::new(RsvgLength::default()),
x: Cell::new(Length::default()),
y: Cell::new(Length::default()),
w: Cell::new(Length::default()),
h: Cell::new(Length::default()),
surface: RefCell::new(None),
}
}
......@@ -59,13 +59,13 @@ impl NodeTrait for NodeImage {
"width",
value,
LengthDir::Horizontal,
RsvgLength::check_nonnegative,
Length::check_nonnegative,
)?),
Attribute::Height => self.h.set(parse_and_validate(
"height",
value,
LengthDir::Vertical,
RsvgLength::check_nonnegative,
Length::check_nonnegative,
)?),
Attribute::PreserveAspectRatio => {
......
......@@ -24,15 +24,15 @@ pub enum LengthDir {
}
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct RsvgLength {
pub struct Length {
pub length: f64,
pub unit: LengthUnit,
dir: LengthDir,
}
impl Default for RsvgLength {
fn default() -> RsvgLength {
RsvgLength {
impl Default for Length {
fn default() -> Length {
Length {
length: 0.0,
unit: LengthUnit::Default,
dir: LengthDir::Both,
......@@ -52,7 +52,7 @@ const PICA_PER_INCH: f64 = 6.0;
// need to know if they are horizontal/vertical/both. For example,
// a some_object.width="50%" is 50% with respect to the current
// viewport's width. In this case, the @dir argument is used
// inside RsvgLength::normalize(), when it needs to know to what the
// inside Length::normalize(), when it needs to know to what the
// length refers.
fn make_err() -> AttributeError {
......@@ -62,12 +62,12 @@ fn make_err() -> AttributeError {
))
}
impl Parse for RsvgLength {
impl Parse for Length {
type Data = LengthDir;
type Err = AttributeError;
fn parse(parser: &mut Parser, dir: LengthDir) -> Result<RsvgLength, AttributeError> {
let length = RsvgLength::from_cssparser(parser, dir)?;
fn parse(parser: &mut Parser, dir: LengthDir) -> Result<Length, AttributeError> {
let length = Length::from_cssparser(parser, dir)?;
parser.expect_exhausted().map_err(|_| make_err())?;
......@@ -75,16 +75,16 @@ impl Parse for RsvgLength {
}
}
impl RsvgLength {
pub fn new(l: f64, unit: LengthUnit, dir: LengthDir) -> RsvgLength {
RsvgLength {
impl Length {
pub fn new(l: f64, unit: LengthUnit, dir: LengthDir) -> Length {
Length {
length: l,
unit,
dir,
}
}
pub fn check_nonnegative(self) -> Result<RsvgLength, AttributeError> {
pub fn check_nonnegative(self) -> Result<Length, AttributeError> {
if self.length >= 0.0 {
Ok(self)
} else {
......@@ -131,21 +131,14 @@ impl RsvgLength {
) -> f64 {
match self.unit {
LengthUnit::Default => self.length,
LengthUnit::Percent => self.length * width_or_height,
LengthUnit::FontEm => self.length * font_size,
LengthUnit::FontEx => self.length * font_size / 2.0,
LengthUnit::Inch => self.length * pixels_per_inch,
}
}
pub fn from_cssparser(
parser: &mut Parser,
dir: LengthDir,
) -> Result<RsvgLength, AttributeError> {
pub fn from_cssparser(parser: &mut Parser, dir: LengthDir) -> Result<Length, AttributeError> {
let length = {
let token = parser.next().map_err(|_| {
AttributeError::Parse(ParseError::new(
......@@ -154,13 +147,13 @@ impl RsvgLength {
})?;
match *token {
Token::Number { value, .. } => RsvgLength {
Token::Number { value, .. } => Length {
length: f64::from(value),
unit: LengthUnit::Default,
dir,
},
Token::Percentage { unit_value, .. } => RsvgLength {
Token::Percentage { unit_value, .. } => Length {
length: f64::from(unit_value),
unit: LengthUnit::Percent,
dir,
......@@ -172,49 +165,49 @@ impl RsvgLength {
let value = f64::from(value);
match unit.as_ref() {
"em" => RsvgLength {
"em" => Length {
length: value,
unit: LengthUnit::FontEm,
dir,
},
"ex" => RsvgLength {
"ex" => Length {
length: value,
unit: LengthUnit::FontEx,
dir,
},
"pt" => RsvgLength {
"pt" => Length {
length: value / POINTS_PER_INCH,
unit: LengthUnit::Inch,
dir,
},
"in" => RsvgLength {
"in" => Length {
length: value,
unit: LengthUnit::Inch,
dir,
},
"cm" => RsvgLength {
"cm" => Length {
length: value / CM_PER_INCH,
unit: LengthUnit::Inch,
dir,
},
"mm" => RsvgLength {
"mm" => Length {
length: value / MM_PER_INCH,
unit: LengthUnit::Inch,
dir,
},
"pc" => RsvgLength {
"pc" => Length {
length: value / PICA_PER_INCH,
unit: LengthUnit::Inch,
dir,
},
"px" => RsvgLength {
"px" => Length {
length: value,
unit: LengthUnit::Default,
dir,
......@@ -275,11 +268,11 @@ pub enum FontSizeSpec {
Large,
XLarge,
XXLarge,
Value(RsvgLength),
Value(Length),
}
impl FontSizeSpec {
pub fn value(&self) -> RsvgLength {
pub fn value(&self) -> Length {
match self {
FontSizeSpec::Value(s) => s.clone(),
_ => unreachable!(),
......@@ -292,31 +285,31 @@ impl FontSizeSpec {
let size = v.font_size.0.value();
let new_size = match self {
FontSizeSpec::Smaller => RsvgLength::new(size.length / 1.2, size.unit, LengthDir::Both),
FontSizeSpec::Larger => RsvgLength::new(size.length * 1.2, size.unit, LengthDir::Both),
FontSizeSpec::Smaller => Length::new(size.length / 1.2, size.unit, LengthDir::Both),
FontSizeSpec::Larger => Length::new(size.length * 1.2, size.unit, LengthDir::Both),
FontSizeSpec::XXSmall => {
RsvgLength::new(compute_points(-3.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(-3.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::XSmall => {
RsvgLength::new(compute_points(-2.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(-2.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::Small => {
RsvgLength::new(compute_points(-1.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(-1.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::Medium => {
RsvgLength::new(compute_points(0.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(0.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::Large => {
RsvgLength::new(compute_points(1.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(1.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::XLarge => {
RsvgLength::new(compute_points(2.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(2.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::XXLarge => {
RsvgLength::new(compute_points(3.0), LengthUnit::Inch, LengthDir::Both)
Length::new(compute_points(3.0), LengthUnit::Inch, LengthDir::Both)
}
FontSizeSpec::Value(s) if s.unit == LengthUnit::Percent => {
RsvgLength::new(size.length * s.length, size.unit, LengthDir::Both)
Length::new(size.length * s.length, size.unit, LengthDir::Both)
}
FontSizeSpec::Value(s) => s.clone(),
};
......@@ -336,7 +329,7 @@ impl Parse for FontSizeSpec {
fn parse(parser: &mut Parser, _: Self::Data) -> Result<FontSizeSpec, ::error::AttributeError> {
let parser_state = parser.state();
RsvgLength::parse(parser, LengthDir::Both)
Length::parse(parser, LengthDir::Both)
.and_then(|s| Ok(FontSizeSpec::Value(s)))
.or_else(|e| {
parser.reset(&parser_state);
......@@ -372,7 +365,7 @@ impl Parse for FontSizeSpec {
#[derive(Debug, PartialEq, Clone)]
pub enum Dasharray {
None,
Array(Vec<RsvgLength>),
Array(Vec<Length>),
}
impl Default for Dasharray {
......@@ -395,13 +388,12 @@ impl Parse for Dasharray {
}
// This does not handle "inherit" or "none" state, the caller is responsible for that.
fn parse_dash_array(parser: &mut Parser) -> Result<Vec<RsvgLength>, AttributeError> {
fn parse_dash_array(parser: &mut Parser) -> Result<Vec<Length>, AttributeError> {
let mut dasharray = Vec::new();
loop {
dasharray.push(
RsvgLength::from_cssparser(parser, LengthDir::Both)
.and_then(RsvgLength::check_nonnegative)?,
Length::from_cssparser(parser, LengthDir::Both).and_then(Length::check_nonnegative)?,
);
if parser.is_exhausted() {
......@@ -421,8 +413,8 @@ mod tests {
#[test]
fn parses_default() {
assert_eq!(
RsvgLength::parse_str("42", LengthDir::Horizontal),
Ok(RsvgLength::new(
Length::parse_str("42", LengthDir::Horizontal),
Ok(Length::new(
42.0,
LengthUnit::Default,
LengthDir::Horizontal
......@@ -430,8 +422,8 @@ mod tests {
);
assert_eq!(
RsvgLength::parse_str("-42px", LengthDir::Horizontal),
Ok(RsvgLength::new(
Length::parse_str("-42px", LengthDir::Horizontal),
Ok(Length::new(
-42.0,
LengthUnit::Default,
LengthDir::Horizontal
......@@ -442,75 +434,63 @@ mod tests {
#[test]
fn parses_percent() {
assert_eq!(
RsvgLength::parse_str("50.0%", LengthDir::Horizontal),
Ok(RsvgLength::new(
0.5,
LengthUnit::Percent,
LengthDir::Horizontal
))
Length::parse_str("50.0%", LengthDir::Horizontal),
Ok(Length::new(0.5, LengthUnit::Percent, LengthDir::Horizontal))
);
}
#[test]
fn parses_font_em() {
assert_eq!(
RsvgLength::parse_str("22.5em", LengthDir::Vertical),
Ok(RsvgLength::new(
22.5,
LengthUnit::FontEm,
LengthDir::Vertical
))
Length::parse_str("22.5em", LengthDir::Vertical),
Ok(Length::new(22.5, LengthUnit::FontEm, LengthDir::Vertical))
);
}
#[test]
fn parses_font_ex() {
assert_eq!(
RsvgLength::parse_str("22.5ex", LengthDir::Vertical),
Ok(RsvgLength::new(
22.5,
LengthUnit::FontEx,
LengthDir::Vertical
))
Length::parse_str("22.5ex", LengthDir::Vertical),
Ok(Length::new(22.5, LengthUnit::FontEx, LengthDir::Vertical))
);
}
#[test]
fn parses_physical_units() {
assert_eq!(
RsvgLength::parse_str("72pt", LengthDir::Both),
Ok(RsvgLength::new(1.0, LengthUnit::Inch, LengthDir::Both))
Length::parse_str("72pt", LengthDir::Both),
Ok(Length::new(1.0, LengthUnit::Inch, LengthDir::Both))
);
assert_eq!(
RsvgLength::parse_str("-22.5in", LengthDir::Both),
Ok(RsvgLength::new(-22.5, LengthUnit::Inch, LengthDir::Both))
Length::parse_str("-22.5in", LengthDir::Both),
Ok(Length::new(-22.5, LengthUnit::Inch, LengthDir::Both))
);
assert_eq!(
RsvgLength::parse_str("-254cm", LengthDir::Both),
Ok(RsvgLength::new(-100.0, LengthUnit::Inch, LengthDir::Both))
Length::parse_str("-254cm", LengthDir::Both),
Ok(Length::new(-100.0, LengthUnit::Inch, LengthDir::Both))
);
assert_eq!(
RsvgLength::parse_str("254mm", LengthDir::Both),
Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both))
Length::parse_str("254mm", LengthDir::Both),
Ok(Length::new(10.0, LengthUnit::Inch, LengthDir::Both))
);
assert_eq!(
RsvgLength::parse_str("60pc", LengthDir::Both),
Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both))
Length::parse_str("60pc", LengthDir::Both),
Ok(Length::new(10.0, LengthUnit::Inch, LengthDir::Both))
);
}
#[test]
fn empty_length_yields_error() {
assert!(is_parse_error(&RsvgLength::parse_str("", LengthDir::Both)));
assert!(is_parse_error(&Length::parse_str("", LengthDir::Both)));
}
#[test]
fn invalid_unit_yields_error() {
assert!(is_parse_error(&RsvgLength::parse_str(
assert!(is_parse_error(&Length::parse_str(
"8furlong",
LengthDir::Both
)));
......@@ -519,12 +499,12 @@ mod tests {
#[test]
fn check_nonnegative_works() {
assert!(
RsvgLength::parse_str("0", LengthDir::Both)
Length::parse_str("0", LengthDir::Both)
.and_then(|l| l.check_nonnegative())
.is_ok()
);
assert!(
RsvgLength::parse_str("-10", LengthDir::Both)
Length::parse_str("-10", LengthDir::Both)
.and_then(|l| l.check_nonnegative())
.is_err()
);
......@@ -542,7 +522,7 @@ mod tests {
#[test]
fn parses_dash_array() {
// helper to cut down boilderplate
let length_parse = |s| RsvgLength::parse_str(s, LengthDir::Both).unwrap();
let length_parse = |s| Length::parse_str(s, LengthDir::Both).unwrap();
let expected = Dasharray::Array(vec![
length_parse("1"),
......
......@@ -11,7 +11,7 @@ use error::*;
use float_eq_cairo::ApproxEqCairo;
use handle::RsvgHandle;
use iri::IRI;
use length::{LengthDir, RsvgLength};
use length::{Length, LengthDir};
use node::*;
use parsers;
use parsers::ParseError;
......@@ -90,10 +90,10 @@ impl Parse for MarkerOrient {
pub struct NodeMarker {
units: Cell<MarkerUnits>,
ref_x: Cell<RsvgLength>,
ref_y: Cell<RsvgLength>,
width: Cell<RsvgLength>,
height: Cell<RsvgLength>,
ref_x: Cell<Length>,
ref_y: Cell<Length>,
width: Cell<Length>,
height: Cell<Length>,
orient: Cell<MarkerOrient>,
aspect: Cell<AspectRatio>,
vbox: Cell<Option<ViewBox>>,
......@@ -103,8 +103,8 @@ impl NodeMarker {
pub fn new() -> NodeMarker {
NodeMarker {
units: Cell::new(MarkerUnits::default()),
ref_x: Cell::new(RsvgLength::default()),
ref_y: Cell::new(RsvgLength::default()),
ref_x: Cell::new(Length::default()),
ref_y: Cell::new(Length::default()),
width: Cell::new(NodeMarker::get_default_size(LengthDir::Horizontal)),
height: Cell::new(NodeMarker::get_default_size(LengthDir::Vertical)),
orient: Cell::new(MarkerOrient::default()),
......@@ -113,9 +113,9 @@ impl NodeMarker {
}
}
fn get_default_size(dir: LengthDir) -> RsvgLength {
fn get_default_size(dir: LengthDir) -> Length {
// per the spec
RsvgLength::parse_str("3", dir).unwrap()
Length::parse_str("3", dir).unwrap()
}
fn render(
......@@ -218,14 +218,14 @@ impl NodeTrait for NodeMarker {
"markerWidth",
value,
LengthDir::Horizontal,
RsvgLength::check_nonnegative,
Length::check_nonnegative,
)?),
Attribute::MarkerHeight => self.height.set(parse_and_validate(
"markerHeight",
value,
LengthDir::Vertical,