diff options
Diffstat (limited to 'components/style_traits/cursor.rs')
-rw-r--r-- | components/style_traits/cursor.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/style_traits/cursor.rs b/components/style_traits/cursor.rs index 9f28924601b..ebd7e13c42c 100644 --- a/components/style_traits/cursor.rs +++ b/components/style_traits/cursor.rs @@ -35,6 +35,15 @@ macro_rules! define_cursor { _ => Err(()) } } + + /// From the C u8 value, get the corresponding Cursor enum. + pub fn from_u8(value: u8) -> Result<Cursor, ()> { + match value { + $( $c_value => Ok(Cursor::$c_variant), )+ + $( #[cfg(feature = "gecko")] $g_value => Ok(Cursor::$g_variant), )+ + _ => Err(()) + } + } } impl ToCss for Cursor { |