Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move some presentational hints to the new infrastructure. #5988

Merged
merged 4 commits into from May 12, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Move table cellspacing to the new infrastructure.

  • Loading branch information
Ms2ger committed May 11, 2015
commit 83f4b077eb37733bf2be22e315f0e0569b284c62
@@ -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);
@@ -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 {
/// `<td border>`
Border,
/// `<table cellspacing>`
CellSpacing,
/// `<td colspan>`
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!
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.