[librsvg: 17/37] WritingMode.is_vertical(): new convenience function



commit 2bb03ab4c5dfbcd1cdd912792f8ed1f02d5265d3
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 31 08:22:29 2018 -0600

    WritingMode.is_vertical(): new convenience function
    
    We'll start using this instead of
    ComputedValues.text_gravity_is_vertical(), which requires a whole
    ComputedValues.

 rsvg_internals/src/state.rs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/state.rs b/rsvg_internals/src/state.rs
index 753f21c7..0be5b4e7 100644
--- a/rsvg_internals/src/state.rs
+++ b/rsvg_internals/src/state.rs
@@ -206,10 +206,7 @@ impl ComputedValues {
     }
 
     pub fn text_gravity_is_vertical(&self) -> bool {
-        match self.writing_mode {
-            WritingMode::Tb | WritingMode::TbRl => true,
-            _ => false,
-        }
+        self.writing_mode.is_vertical()
     }
 }
 
@@ -1360,6 +1357,15 @@ make_property!(
     "tb-rl" => TbRl,
 );
 
+impl WritingMode {
+    pub fn is_vertical(&self) -> bool {
+        match *self {
+            WritingMode::Tb | WritingMode::TbRl => true,
+            _ => false,
+        }
+    }
+}
+
 make_property!(
     ComputedValues,
     XmlLang,


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