style: Parse the legacy border attribute per the legacy HTML specification.

Additionally, this patch cleans up some miscellaneous formatting issues
and refactors files in `layout/css/` somewhat to eliminate needless
levels of indirection. It also fixes our handling of presentational
hints that only apply if border is nonzero.
This commit is contained in:
Patrick Walton 2014-12-07 22:54:56 -08:00
parent e0e14c60d6
commit 10f1ed5e31
19 changed files with 350 additions and 127 deletions

View file

@ -79,7 +79,8 @@ pub enum SimpleSelector {
NthLastOfType(i32, i32),
FirstOfType,
LastOfType,
OnlyOfType
OnlyOfType,
ServoNonzeroBorder,
// ...
}
@ -231,7 +232,7 @@ fn compute_specificity(mut selector: &CompoundSelector,
// | &Empty | &Lang(*)
| &NthChild(..) | &NthLastChild(..)
| &NthOfType(..) | &NthLastOfType(..)
| &FirstOfType | &LastOfType | &OnlyOfType
| &FirstOfType | &LastOfType | &OnlyOfType | &ServoNonzeroBorder
=> specificity.class_like_selectors += 1,
&NamespaceSelector(..) => (),
&Negation(ref negated)
@ -506,6 +507,10 @@ fn parse_simple_pseudo_class(name: &str) -> Result<SimpleSelector, ()> {
"first-of-type" => Ok(FirstOfType),
"last-of-type" => Ok(LastOfType),
"only-of-type" => Ok(OnlyOfType),
"-servo-nonzero-border" => {
// TODO(pcwalton): Have some mechanism whereby we forbid Web content from using this.
Ok(ServoNonzeroBorder)
}
// "empty" => Ok(Empty),
_ => Err(())
}