mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Move table cellspacing to the new infrastructure.
This commit is contained in:
parent
c1e15e827e
commit
83f4b077eb
2 changed files with 22 additions and 29 deletions
|
@ -62,7 +62,9 @@ use style;
|
||||||
use style::legacy::{UnsignedIntegerAttribute, IntegerAttribute, LengthAttribute, from_declaration};
|
use style::legacy::{UnsignedIntegerAttribute, IntegerAttribute, LengthAttribute, from_declaration};
|
||||||
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
|
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
|
||||||
use style::properties::DeclaredValue::SpecifiedValue;
|
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::namespace;
|
||||||
use util::smallvec::VecLike;
|
use util::smallvec::VecLike;
|
||||||
use util::str::{DOMString, LengthOrPercentageOrAuto};
|
use util::str::{DOMString, LengthOrPercentageOrAuto};
|
||||||
|
@ -260,6 +262,24 @@ impl RawLayoutElementHelpers for Element {
|
||||||
PropertyDeclaration::BackgroundColor(SpecifiedValue(
|
PropertyDeclaration::BackgroundColor(SpecifiedValue(
|
||||||
CSSColor { parsed: Color::RGBA(color), authored: None }))));
|
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]
|
#[inline]
|
||||||
|
@ -345,16 +365,6 @@ impl RawLayoutElementHelpers for Element {
|
||||||
None
|
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 => {
|
UnsignedIntegerAttribute::ColSpan => {
|
||||||
if self.is_htmltablecellelement() {
|
if self.is_htmltablecellelement() {
|
||||||
let this: &HTMLTableCellElement = mem::transmute(self);
|
let this: &HTMLTableCellElement = mem::transmute(self);
|
||||||
|
|
|
@ -13,7 +13,7 @@ use node::TElementAttributes;
|
||||||
use values::{CSSFloat, specified};
|
use values::{CSSFloat, specified};
|
||||||
use properties::DeclaredValue::SpecifiedValue;
|
use properties::DeclaredValue::SpecifiedValue;
|
||||||
use properties::PropertyDeclaration;
|
use properties::PropertyDeclaration;
|
||||||
use properties::longhands::{self, border_spacing};
|
use properties::longhands;
|
||||||
use selector_matching::Stylist;
|
use selector_matching::Stylist;
|
||||||
|
|
||||||
use util::geometry::Au;
|
use util::geometry::Au;
|
||||||
|
@ -41,8 +41,6 @@ pub enum IntegerAttribute {
|
||||||
pub enum UnsignedIntegerAttribute {
|
pub enum UnsignedIntegerAttribute {
|
||||||
/// `<td border>`
|
/// `<td border>`
|
||||||
Border,
|
Border,
|
||||||
/// `<table cellspacing>`
|
|
||||||
CellSpacing,
|
|
||||||
/// `<td colspan>`
|
/// `<td colspan>`
|
||||||
ColSpan,
|
ColSpan,
|
||||||
}
|
}
|
||||||
|
@ -123,21 +121,6 @@ impl PresentationalHintSynthesis for Stylist {
|
||||||
element,
|
element,
|
||||||
matching_rules_list,
|
matching_rules_list,
|
||||||
shareable);
|
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") => {
|
name if *name == atom!("input") => {
|
||||||
// FIXME(pcwalton): More use of atoms, please!
|
// FIXME(pcwalton): More use of atoms, please!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue