Implement <font> 'face' attribute

This commit is contained in:
Corey Farwell 2015-09-13 22:54:23 -04:00
parent 768993f03f
commit 3ae76f4e76
8 changed files with 72 additions and 138 deletions

View file

@ -62,7 +62,7 @@ use devtools_traits::AttrInfo;
use smallvec::VecLike;
use style::legacy::{UnsignedIntegerAttribute, from_declaration};
use style::properties::DeclaredValue;
use style::properties::longhands::{self, background_image, border_spacing};
use style::properties::longhands::{self, background_image, border_spacing, font_family};
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA};
@ -302,6 +302,22 @@ impl RawLayoutElementHelpers for Element {
}))));
}
let font_family = if self.is_htmlfontelement() {
let this: &HTMLFontElement = mem::transmute(self);
this.get_face()
} else {
None
};
if let Some(font_family) = font_family {
hints.push(from_declaration(
PropertyDeclaration::FontFamily(
DeclaredValue::Value(
font_family::computed_value::T(vec![
font_family::computed_value::FontFamily::FamilyName(
font_family)])))));
}
let cellspacing = if self.is_htmltableelement() {
let this: &HTMLTableElement = mem::transmute(self);
this.get_cellspacing()