aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-02-16 14:06:52 -0700
committerbors-servo <metajack+bors@gmail.com>2015-02-16 14:06:52 -0700
commit6d2e840bf49f7d9d8022ab2566cfb641dd578a44 (patch)
tree9d31312314e12c0bca86166ec1924348abbb3570 /components/layout/layout_task.rs
parentc7d3ea1c6588512c62ce6688ad0e544dacccfb8f (diff)
parent7aacf90161b182d5aacef89ac6f49aa88bc7fe4d (diff)
downloadservo-6d2e840bf49f7d9d8022ab2566cfb641dd578a44.tar.gz
servo-6d2e840bf49f7d9d8022ab2566cfb641dd578a44.zip
auto merge of #4934 : glennw/servo/fix-1248, r=pcwalton
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r--components/layout/layout_task.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index fb6f14fe57b..3d2bc463cdc 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -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))) {