Auto merge of #5851 - evilpie:background, r=SimonSapin

Implement the HTML background attribute

Fixes #5835

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5851)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-29 14:37:45 -06:00
commit 58fa3b69b7
2 changed files with 34 additions and 2 deletions

View file

@ -67,7 +67,7 @@ use smallvec::VecLike;
use style::legacy::{UnsignedIntegerAttribute, from_declaration};
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration, parse_style_attribute};
use style::properties::DeclaredValue::SpecifiedValue;
use style::properties::longhands::{self, border_spacing, height};
use style::properties::longhands::{self, background_image, border_spacing, height};
use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA};
use util::geometry::Au;
@ -278,6 +278,19 @@ impl RawLayoutElementHelpers for Element {
CSSColor { parsed: Color::RGBA(color), authored: None }))));
}
let background = if self.is_htmlbodyelement() {
let this: &HTMLBodyElement = mem::transmute(self);
this.get_background()
} else {
None
};
if let Some(url) = background {
hints.push(from_declaration(
PropertyDeclaration::BackgroundImage(SpecifiedValue(
background_image::SpecifiedValue(Some(specified::Image::Url(url)))))));
}
let color = if self.is_htmlfontelement() {
let this: &HTMLFontElement = mem::transmute(self);
this.get_color()