[librsvg: 7/10] Inline Length::from_cssparser into Length::parse
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/10] Inline Length::from_cssparser into Length::parse
- Date: Wed, 13 Nov 2019 03:38:51 +0000 (UTC)
commit 710c4879104c8d63dc9ac180f8bd5d1492212350
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 12 18:53:58 2019 -0600
Inline Length::from_cssparser into Length::parse
rsvg_internals/src/length.rs | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 5431438e..13a7b49d 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -265,7 +265,7 @@ macro_rules! define_length_type {
/// [`check_nonnegative`]: #method.check_nonnegative
#[allow(unused)]
pub fn from_cssparser(parser: &mut Parser<'_, '_>) -> Result<Self, ValueErrorKind> {
- Ok($name(Length::from_cssparser(parser)?))
+ Ok($name(Length::parse(parser)?))
}
}
@@ -347,16 +347,6 @@ impl Parse for Length {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<Length, ValueErrorKind> {
- Length::from_cssparser(parser)
- }
-}
-
-impl Length {
- pub fn new(l: f64, unit: LengthUnit) -> Length {
- Length { length: l, unit }
- }
-
- pub(crate) fn from_cssparser(parser: &mut Parser<'_, '_>) -> Result<Length, ValueErrorKind> {
let length = {
let token = parser.next().map_err(|_| {
ValueErrorKind::Parse(ParseError::new(
@@ -433,6 +423,12 @@ impl Length {
}
}
+impl Length {
+ pub fn new(l: f64, unit: LengthUnit) -> Length {
+ Length { length: l, unit }
+ }
+}
+
fn font_size_from_values(values: &ComputedValues, params: &ViewParams) -> f64 {
let v = &values.font_size.0.value().0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]