diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 4989039802d..c12abc32c96 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -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); diff --git a/components/style/legacy.rs b/components/style/legacy.rs index b10376981a8..57343341e29 100644 --- a/components/style/legacy.rs +++ b/components/style/legacy.rs @@ -13,7 +13,7 @@ use node::TElementAttributes; use values::{CSSFloat, specified}; use properties::DeclaredValue::SpecifiedValue; use properties::PropertyDeclaration; -use properties::longhands::{self, border_spacing}; +use properties::longhands; use selector_matching::Stylist; use util::geometry::Au; @@ -41,8 +41,6 @@ pub enum IntegerAttribute { pub enum UnsignedIntegerAttribute { /// `
` ColSpan, } @@ -123,21 +121,6 @@ impl PresentationalHintSynthesis for Stylist { element, matching_rules_list, shareable); - match element.get_unsigned_integer_attribute( - UnsignedIntegerAttribute::CellSpacing) { - None => {} - Some(length) => { - let width_value = specified::Length::Absolute(Au::from_px(length as i32)); - matching_rules_list.push(from_declaration( - PropertyDeclaration::BorderSpacing( - SpecifiedValue( - border_spacing::SpecifiedValue { - horizontal: width_value, - vertical: width_value, - })))); - *shareable = false - } - } } name if *name == atom!("input") => { // FIXME(pcwalton): More use of atoms, please! |