diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 1fd99818047..99cc94033bf 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2230,6 +2230,15 @@ fn static_assert() { +<%self:impl_trait style_struct_name="Table" skip_longhands="-x-span"> + #[allow(non_snake_case)] + pub fn set__x_span(&mut self, v: longhands::_x_span::computed_value::T) { + self.gecko.mSpan = v.0 + } + + ${impl_simple_copy('_x_span', 'mSpan')} + + <%self:impl_trait style_struct_name="Effects" skip_longhands="box-shadow filter"> pub fn set_box_shadow(&mut self, v: longhands::box_shadow::computed_value::T) { diff --git a/components/style/properties/longhand/table.mako.rs b/components/style/properties/longhand/table.mako.rs index 36e2216ef62..c145dde146c 100644 --- a/components/style/properties/longhand/table.mako.rs +++ b/components/style/properties/longhand/table.mako.rs @@ -9,3 +9,39 @@ ${helpers.single_keyword("table-layout", "auto fixed", gecko_ffi_name="mLayoutStrategy", animatable=False, spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")} + +<%helpers:longhand name="-x-span" products="gecko" + spec="Internal-only (for `` pres attr)" + animatable="False" + internal="True"> + use values::HasViewportPercentage; + use values::computed::ComputedValueAsSpecified; + + impl ComputedValueAsSpecified for SpecifiedValue {} + no_viewport_percentage!(SpecifiedValue); + pub type SpecifiedValue = computed_value::T; + pub mod computed_value { + use std::fmt; + use style_traits::ToCss; + + #[derive(PartialEq, Clone, Copy, Debug)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub struct T(pub i32); + + impl ToCss for T { + fn to_css(&self, _: &mut W) -> fmt::Result where W: fmt::Write { + Ok(()) + } + } + } + + #[inline] + pub fn get_initial_value() -> computed_value::T { + computed_value::T(1) + } + + // never parse it, only set via presentation attribute + fn parse(_: &ParserContext, _: &mut Parser) -> Result { + Err(()) + } + diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 1ca1fb0b4b1..c2d0a742ef5 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -1041,10 +1041,18 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations: } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_SetIntValue(_: RawServoDeclarationBlockBorrowed, - _: nsCSSPropertyID, - _: i32) { - error!("stylo: Don't know how to handle integer presentation attributes (-x-span)"); +pub extern "C" fn Servo_DeclarationBlock_SetIntValue(declarations: RawServoDeclarationBlockBorrowed, + property: nsCSSPropertyID, + value: i32) { + use style::properties::{DeclaredValue, PropertyDeclaration, LonghandId}; + use style::properties::longhands::_x_span::computed_value::T as Span; + + let declarations = RwLock::::as_arc(&declarations); + let long = get_longhand_from_id!(property); + let prop = match_wrap_declared! { long, + XSpan => Span(value), + }; + declarations.write().declarations.push((prop, Default::default())); } #[no_mangle]