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

@ -5,7 +5,7 @@
//! Traits that nodes must implement. Breaks the otherwise-cyclic dependency between layout and
//! style.
use legacy::{IntegerAttribute, LengthAttribute};
use legacy::{IntegerAttribute, LengthAttribute, UnsignedIntegerAttribute};
use selectors::AttrSelector;
use servo_util::str::LengthOrPercentageOrAuto;
use string_cache::{Atom, Namespace};
@ -47,6 +47,7 @@ pub trait TElement<'a> : Copy {
fn get_enabled_state(self) -> bool;
fn get_checked_state(self) -> bool;
fn has_class(self, name: &Atom) -> bool;
fn has_nonzero_border(self) -> bool;
// Ordinarily I wouldn't use callbacks like this, but the alternative is
// really messy, since there is a `JSRef` and a `RefCell` involved. Maybe
@ -58,4 +59,5 @@ pub trait TElement<'a> : Copy {
pub trait TElementAttributes : Copy {
fn get_length_attribute(self, attribute: LengthAttribute) -> LengthOrPercentageOrAuto;
fn get_integer_attribute(self, attribute: IntegerAttribute) -> Option<i32>;
fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option<u32>;
}