diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 963a7981562..eda755f177c 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -20,7 +20,6 @@ use model::MaybeAuto; use std::fmt; use std::sync::Arc; use style::computed_values::{border_collapse, border_top_style}; -use style::legacy::UnsignedIntegerAttribute; use style::properties::ComputedValues; use table::InternalTable; use table_row::{CollapsedBorder, CollapsedBorderProvenance}; @@ -52,8 +51,7 @@ impl TableCellFlow { TableCellFlow { block_flow: BlockFlow::from_fragment(fragment, None), collapsed_borders: CollapsedBordersForCell::new(), - column_span: node.get_unsigned_integer_attribute(UnsignedIntegerAttribute::ColSpan) - .unwrap_or(1), + column_span: node.get_colspan(), visible: visible, } } diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index b5f507f0108..8feba75a690 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -1039,6 +1039,12 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { iframe_element.pipeline_id().unwrap() } } + + pub fn get_colspan(&self) -> u32 { + unsafe { + self.get_jsmanaged().downcast::().unwrap().get_colspan() + } + } } pub struct ThreadSafeLayoutNodeChildrenIterator<'a> { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 158d9612442..a1a98e78edf 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -225,6 +225,8 @@ pub trait LayoutElementHelpers { unsafe fn synthesize_presentational_hints_for_legacy_attributes(&self, &mut V) where V: VecLike>>; #[allow(unsafe_code)] + unsafe fn get_colspan(self) -> u32; + #[allow(unsafe_code)] unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute) -> Option; #[allow(unsafe_code)] @@ -499,6 +501,17 @@ impl LayoutElementHelpers for LayoutJS { } } + #[allow(unsafe_code)] + unsafe fn get_colspan(self) -> u32 { + if let Some(this) = self.downcast::() { + this.get_colspan().unwrap_or(1) + } else { + // Don't panic since `display` can cause this to be called on arbitrary + // elements. + 1 + } + } + #[allow(unsafe_code)] unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute)