Move table cellspacing to the new infrastructure.

This commit is contained in:
Ms2ger 2015-04-28 11:43:48 +02:00
parent c1e15e827e
commit 83f4b077eb
2 changed files with 22 additions and 29 deletions

View file

@ -62,7 +62,9 @@ use style;
use style::legacy::{UnsignedIntegerAttribute, IntegerAttribute, LengthAttribute, from_declaration};
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
use style::properties::DeclaredValue::SpecifiedValue;
use style::values::specified::CSSColor;
use style::properties::longhands::border_spacing;
use style::values::specified::{self, CSSColor};
use util::geometry::Au;
use util::namespace;
use util::smallvec::VecLike;
use util::str::{DOMString, LengthOrPercentageOrAuto};
@ -260,6 +262,24 @@ impl RawLayoutElementHelpers for Element {
PropertyDeclaration::BackgroundColor(SpecifiedValue(
CSSColor { parsed: Color::RGBA(color), authored: None }))));
}
let cellspacing = if self.is_htmltableelement() {
let this: &HTMLTableElement = mem::transmute(self);
this.get_cellspacing()
} else {
None
};
if let Some(cellspacing) = cellspacing {
let width_value = specified::Length::Absolute(Au::from_px(cellspacing as i32));
hints.push(from_declaration(
PropertyDeclaration::BorderSpacing(SpecifiedValue(
border_spacing::SpecifiedValue {
horizontal: width_value,
vertical: width_value,
}))));
}
}
#[inline]
@ -345,16 +365,6 @@ impl RawLayoutElementHelpers for Element {
None
}
}
UnsignedIntegerAttribute::CellSpacing => {
if self.is_htmltableelement() {
let this: &HTMLTableElement = mem::transmute(self);
this.get_cellspacing()
} else {
// Don't panic since `display` can cause this to be called on arbitrary
// elements.
None
}
}
UnsignedIntegerAttribute::ColSpan => {
if self.is_htmltablecellelement() {
let this: &HTMLTableCellElement = mem::transmute(self);