diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 4a7f2814cbf..b97aeb4c1fa 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -2853,8 +2853,8 @@ impl ServoComputedValuesCursorUtility for ServoComputedValues { fn get_cursor(&self, default_cursor: Cursor) -> Option { match (self.get_pointing().pointer_events, self.get_pointing().cursor) { (pointer_events::T::none, _) => None, - (pointer_events::T::auto, cursor::Keyword::AutoCursor) => Some(default_cursor), - (pointer_events::T::auto, cursor::Keyword::SpecifiedCursor(cursor)) => Some(cursor), + (pointer_events::T::auto, cursor::Keyword::Auto) => Some(default_cursor), + (pointer_events::T::auto, cursor::Keyword::Cursor(cursor)) => Some(cursor), } } } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 0df0ee4bde6..dddf02c19de 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -4191,8 +4191,8 @@ clip-path use style_traits::cursor::Cursor; self.gecko.mCursor = match v.keyword { - Keyword::AutoCursor => structs::NS_STYLE_CURSOR_AUTO, - Keyword::SpecifiedCursor(cursor) => match cursor { + Keyword::Auto => structs::NS_STYLE_CURSOR_AUTO, + Keyword::Cursor(cursor) => match cursor { Cursor::None => structs::NS_STYLE_CURSOR_NONE, Cursor::Default => structs::NS_STYLE_CURSOR_DEFAULT, Cursor::Pointer => structs::NS_STYLE_CURSOR_POINTER, diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index bba9b160638..05f014a07da 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -17,17 +17,19 @@ no_viewport_percentage!(SpecifiedValue); pub mod computed_value { + #[cfg(feature = "gecko")] use std::fmt; - use style_traits::cursor::Cursor; + #[cfg(feature = "gecko")] use style_traits::ToCss; + use style_traits::cursor::Cursor; #[cfg(feature = "gecko")] use values::specified::url::SpecifiedUrl; - #[derive(Clone, PartialEq, Copy, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[derive(Clone, Copy, Debug, PartialEq, ToCss)] pub enum Keyword { - AutoCursor, - SpecifiedCursor(Cursor), + Auto, + Cursor(Cursor), } #[cfg(not(feature = "gecko"))] @@ -47,15 +49,6 @@ pub keyword: Keyword, } - impl ToCss for Keyword { - fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - Keyword::AutoCursor => dest.write_str("auto"), - Keyword::SpecifiedCursor(c) => c.to_css(dest), - } - } - } - #[cfg(feature = "gecko")] impl ToCss for Image { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { @@ -85,7 +78,7 @@ #[cfg(not(feature = "gecko"))] #[inline] pub fn get_initial_value() -> computed_value::T { - computed_value::Keyword::AutoCursor + computed_value::Keyword::Auto } #[cfg(feature = "gecko")] @@ -93,7 +86,7 @@ pub fn get_initial_value() -> computed_value::T { computed_value::T { images: vec![], - keyword: computed_value::Keyword::AutoCursor + keyword: computed_value::Keyword::Auto } } @@ -103,9 +96,9 @@ use style_traits::cursor::Cursor; let ident = try!(input.expect_ident()); if ident.eq_ignore_ascii_case("auto") { - Ok(computed_value::Keyword::AutoCursor) + Ok(computed_value::Keyword::Auto) } else { - Cursor::from_css_keyword(&ident).map(computed_value::Keyword::SpecifiedCursor) + Cursor::from_css_keyword(&ident).map(computed_value::Keyword::Cursor) } } }