Fixes background-color calculation for iframes. Fixes #1248

This commit is contained in:
Glenn Watson 2015-02-16 08:16:18 +10:00
parent 3e7dc57693
commit 7aacf90161
7 changed files with 29 additions and 4 deletions

View file

@ -666,7 +666,17 @@ impl LayoutTask {
// FIXME(pcwalton): This is really ugly and can't handle overflow: scroll. Refactor
// it with extreme prejudice.
let mut color = color::white();
// The default computed value for background-color is transparent (see
// http://dev.w3.org/csswg/css-backgrounds/#background-color). However, we
// need to propagate the background color from the root HTML/Body
// element (http://dev.w3.org/csswg/css-backgrounds/#special-backgrounds) if
// it is non-transparent. The phrase in the spec "If the canvas background
// is not opaque, what shows through is UA-dependent." is handled by rust-layers
// clearing the frame buffer to white. This ensures that setting a background
// color on an iframe element, while the iframe content itself has a default
// transparent background color is handled correctly.
let mut color = color::transparent_black();
for child in node.traverse_preorder() {
if child.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement))) ||
child.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement))) {

View file

@ -458,7 +458,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "layers"
version = "0.1.0"
source = "git+https://github.com/servo/rust-layers#1ef45363e38cb4257d99a4de6a43bf99c1a6f807"
source = "git+https://github.com/servo/rust-layers#7f0ab52e147b778c79b9378fe3ddd4d13055df84"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",