Introduce a get_colspan method on LayoutJS<Element>.

This commit is contained in:
Ms2ger 2015-11-14 21:18:45 +01:00
parent 8f2a3a64f1
commit 5417df6397
3 changed files with 20 additions and 3 deletions

View file

@ -225,6 +225,8 @@ pub trait LayoutElementHelpers {
unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
#[allow(unsafe_code)]
unsafe fn get_colspan(self) -> u32;
#[allow(unsafe_code)]
unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute)
-> Option<u32>;
#[allow(unsafe_code)]
@ -499,6 +501,17 @@ impl LayoutElementHelpers for LayoutJS<Element> {
}
}
#[allow(unsafe_code)]
unsafe fn get_colspan(self) -> u32 {
if let Some(this) = self.downcast::<HTMLTableCellElement>() {
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)