mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
stylo: Support -x-span for <col span>
This commit is contained in:
parent
b85e1f5f0c
commit
f27cd541b3
3 changed files with 57 additions and 4 deletions
|
@ -2230,6 +2230,15 @@ fn static_assert() {
|
||||||
|
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
|
<%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>
|
||||||
|
|
||||||
<%self:impl_trait style_struct_name="Effects"
|
<%self:impl_trait style_struct_name="Effects"
|
||||||
skip_longhands="box-shadow filter">
|
skip_longhands="box-shadow filter">
|
||||||
pub fn set_box_shadow(&mut self, v: longhands::box_shadow::computed_value::T) {
|
pub fn set_box_shadow(&mut self, v: longhands::box_shadow::computed_value::T) {
|
||||||
|
|
|
@ -9,3 +9,39 @@
|
||||||
${helpers.single_keyword("table-layout", "auto fixed",
|
${helpers.single_keyword("table-layout", "auto fixed",
|
||||||
gecko_ffi_name="mLayoutStrategy", animatable=False,
|
gecko_ffi_name="mLayoutStrategy", animatable=False,
|
||||||
spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")}
|
spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")}
|
||||||
|
|
||||||
|
<%helpers:longhand name="-x-span" products="gecko"
|
||||||
|
spec="Internal-only (for `<col span>` 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<W>(&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<SpecifiedValue, ()> {
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
</%helpers:longhand>
|
||||||
|
|
|
@ -1041,10 +1041,18 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(declarations:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_SetIntValue(_: RawServoDeclarationBlockBorrowed,
|
pub extern "C" fn Servo_DeclarationBlock_SetIntValue(declarations: RawServoDeclarationBlockBorrowed,
|
||||||
_: nsCSSPropertyID,
|
property: nsCSSPropertyID,
|
||||||
_: i32) {
|
value: i32) {
|
||||||
error!("stylo: Don't know how to handle integer presentation attributes (-x-span)");
|
use style::properties::{DeclaredValue, PropertyDeclaration, LonghandId};
|
||||||
|
use style::properties::longhands::_x_span::computed_value::T as Span;
|
||||||
|
|
||||||
|
let declarations = RwLock::<PropertyDeclarationBlock>::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]
|
#[no_mangle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue