diff options
author | Igor Gutorov <igootorov@gmail.com> | 2018-01-15 16:21:44 +0200 |
---|---|---|
committer | Igor Gutorov <igootorov@gmail.com> | 2018-01-20 19:06:29 +0200 |
commit | 4ee9eb8563fc5842f7139bcd60a36468e4222fc0 (patch) | |
tree | 245aacd9fd013d16311ef6bb575ada4f02fd73fb /components/style_traits/cursor.rs | |
parent | 671b69c0b77f9a4bd0c098cb2a2f73c95dacb954 (diff) | |
download | servo-4ee9eb8563fc5842f7139bcd60a36468e4222fc0.tar.gz servo-4ee9eb8563fc5842f7139bcd60a36468e4222fc0.zip |
style: Move cursor property out of mako
Diffstat (limited to 'components/style_traits/cursor.rs')
-rw-r--r-- | components/style_traits/cursor.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/components/style_traits/cursor.rs b/components/style_traits/cursor.rs index 28a575f1cca..ca40c4aed79 100644 --- a/components/style_traits/cursor.rs +++ b/components/style_traits/cursor.rs @@ -20,43 +20,42 @@ macro_rules! define_cursor { #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[repr(u8)] #[allow(missing_docs)] - pub enum Cursor { + pub enum CursorKind { $( $c_variant = $c_value, )+ $( #[cfg(feature = "gecko")] $g_variant = $g_value, )+ } - impl Cursor { + impl CursorKind { /// Given a CSS keyword, get the corresponding cursor enum. - pub fn from_css_keyword(keyword: &str) -> Result<Cursor, ()> { + pub fn from_css_keyword(keyword: &str) -> Result<Self, ()> { match_ignore_ascii_case! { &keyword, - $( $c_css => Ok(Cursor::$c_variant), )+ - $( #[cfg(feature = "gecko")] $g_css => Ok(Cursor::$g_variant), )+ + $( $c_css => Ok(CursorKind::$c_variant), )+ + $( #[cfg(feature = "gecko")] $g_css => Ok(CursorKind::$g_variant), )+ _ => Err(()) } } /// From the C u8 value, get the corresponding Cursor enum. - pub fn from_u8(value: u8) -> Result<Cursor, ()> { + pub fn from_u8(value: u8) -> Result<Self, ()> { match value { - $( $c_value => Ok(Cursor::$c_variant), )+ - $( #[cfg(feature = "gecko")] $g_value => Ok(Cursor::$g_variant), )+ + $( $c_value => Ok(CursorKind::$c_variant), )+ + $( #[cfg(feature = "gecko")] $g_value => Ok(CursorKind::$g_variant), )+ _ => Err(()) } } } - impl ToCss for Cursor { + impl ToCss for CursorKind { fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write { match *self { - $( Cursor::$c_variant => dest.write_str($c_css), )+ - $( #[cfg(feature = "gecko")] Cursor::$g_variant => dest.write_str($g_css), )+ + $( CursorKind::$c_variant => dest.write_str($c_css), )+ + $( #[cfg(feature = "gecko")] CursorKind::$g_variant => dest.write_str($g_css), )+ } } } } } - define_cursor! { common properties = [ "none" => None = 0, @@ -94,12 +93,13 @@ define_cursor! { "all-scroll" => AllScroll = 32, "zoom-in" => ZoomIn = 33, "zoom-out" => ZoomOut = 34, + "auto" => Auto = 35, ] // gecko only properties gecko properties = [ - "-moz-grab" => MozGrab = 35, - "-moz-grabbing" => MozGrabbing = 36, - "-moz-zoom-in" => MozZoomIn = 37, - "-moz-zoom-out" => MozZoomOut = 38, + "-moz-grab" => MozGrab = 36, + "-moz-grabbing" => MozGrabbing = 37, + "-moz-zoom-in" => MozZoomIn = 38, + "-moz-zoom-out" => MozZoomOut = 39, ] } |