diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 9ceee25a718..a63d6943043 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -148,7 +148,7 @@ impl ThreadSafeLayoutNodeHelpers for T { let style = self.as_element().unwrap().resolved_style(); return match style.as_ref().get_counters().content { - content::T::Content(ref value) if !value.is_empty() => { + content::T::Items(ref value) if !value.is_empty() => { TextContent::GeneratedContent((*value).clone()) } _ => TextContent::GeneratedContent(vec![]), diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 0fb75af9d31..2e9af13b226 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -4238,8 +4238,8 @@ clip-path } match v { - T::none | - T::normal => { + T::None | + T::Normal => { // Ensure destructors run, otherwise we could leak. if !self.gecko.mContents.is_empty() { unsafe { @@ -4247,7 +4247,14 @@ clip-path } } }, - T::Content(items) => { + T::MozAltContent => { + unsafe { + Gecko_ClearAndResizeStyleContents(&mut self.gecko, 1); + *self.gecko.mContents[0].mContent.mString.as_mut() = ptr::null_mut(); + } + self.gecko.mContents[0].mType = eStyleContentType_AltContent; + }, + T::Items(items) => { unsafe { Gecko_ClearAndResizeStyleContents(&mut self.gecko, items.len() as u32); @@ -4289,8 +4296,6 @@ clip-path => self.gecko.mContents[i].mType = eStyleContentType_NoOpenQuote, ContentItem::NoCloseQuote => self.gecko.mContents[i].mType = eStyleContentType_NoCloseQuote, - ContentItem::MozAltContent - => self.gecko.mContents[i].mType = eStyleContentType_AltContent, ContentItem::Counter(name, style) => { unsafe { bindings::Gecko_SetContentDataArray(&mut self.gecko.mContents[i], diff --git a/components/style/properties/longhand/counters.mako.rs b/components/style/properties/longhand/counters.mako.rs index c961e073b21..9f86c3acf03 100644 --- a/components/style/properties/longhand/counters.mako.rs +++ b/components/style/properties/longhand/counters.mako.rs @@ -55,8 +55,6 @@ NoCloseQuote, % if product == "gecko": - /// `-moz-alt-content` - MozAltContent, /// `attr([namespace? `|`]? ident)` Attr(Option, String), /// `url(url)` @@ -92,7 +90,6 @@ ContentItem::NoCloseQuote => dest.write_str("no-close-quote"), % if product == "gecko": - ContentItem::MozAltContent => dest.write_str("-moz-alt-content"), ContentItem::Attr(ref ns, ref attr) => { dest.write_str("attr(")?; if let Some(ref ns) = *ns { @@ -108,21 +105,25 @@ } } - #[allow(non_camel_case_types)] #[derive(Debug, PartialEq, Eq, Clone)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum T { - normal, - none, - Content(Vec), + Normal, + None, + #[cfg(feature = "gecko")] + MozAltContent, + Items(Vec), } impl ToCss for T { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { - T::normal => dest.write_str("normal"), - T::none => dest.write_str("none"), - T::Content(ref content) => { + T::Normal => dest.write_str("normal"), + T::None => dest.write_str("none"), + % if product == "gecko": + T::MozAltContent => dest.write_str("-moz-alt-content"), + % endif + T::Items(ref content) => { let mut iter = content.iter(); try!(iter.next().unwrap().to_css(dest)); for c in iter { @@ -136,8 +137,8 @@ } } #[inline] - pub fn get_initial_value() -> computed_value::T { - computed_value::T::normal + pub fn get_initial_value() -> computed_value::T { + computed_value::T::Normal } #[cfg(feature = "servo")] @@ -162,11 +163,17 @@ pub fn parse(context: &ParserContext, input: &mut Parser) -> Result { if input.try(|input| input.expect_ident_matching("normal")).is_ok() { - return Ok(SpecifiedValue::normal) + return Ok(SpecifiedValue::Normal) } if input.try(|input| input.expect_ident_matching("none")).is_ok() { - return Ok(SpecifiedValue::none) + return Ok(SpecifiedValue::None) } + % if product == "gecko": + if input.try(|input| input.expect_ident_matching("-moz-alt-content")).is_ok() { + return Ok(SpecifiedValue::MozAltContent) + } + % endif + let mut content = vec![]; loop { % if product == "gecko": @@ -233,10 +240,6 @@ "no-open-quote" => content.push(ContentItem::NoOpenQuote), "no-close-quote" => content.push(ContentItem::NoCloseQuote), - % if product == "gecko": - "-moz-alt-content" => content.push(ContentItem::MozAltContent), - % endif - _ => return Err(()) } } @@ -244,11 +247,10 @@ _ => return Err(()) } } - if !content.is_empty() { - Ok(SpecifiedValue::Content(content)) - } else { - Err(()) + if content.is_empty() { + return Err(()); } + Ok(SpecifiedValue::Items(content)) } diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index d3c85c64470..d61f4205773 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1820,9 +1820,8 @@ impl ComputedValues { pub fn ineffective_content_property(&self) -> bool { use properties::longhands::content::computed_value::T; match self.get_counters().content { - T::normal | - T::none => true, - T::Content(ref items) => items.is_empty(), + T::Normal | T::None => true, + T::Items(ref items) => items.is_empty(), } }