aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/layout_task.rs12
-rw-r--r--components/servo/Cargo.lock2
-rw-r--r--ports/cef/Cargo.lock2
-rw-r--r--ports/gonk/Cargo.lock2
-rw-r--r--tests/ref/basic.list1
-rw-r--r--tests/ref/iframe/bg_color.html8
-rw-r--r--tests/ref/iframe/bg_color_ref.html6
7 files changed, 29 insertions, 4 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))) {
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 06dddf9a0c9..fde35423a83 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -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)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 690e6ea86d5..b16590eac5e 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -460,7 +460,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)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index f4e9dfda1ee..ada1b63f89f 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -378,7 +378,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)",
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index 88931af9b49..77d75374691 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -125,6 +125,7 @@ fragment=top != ../html/acid2.html acid2_ref.html
== background_image_position_a.html background_image_position_ref.html
== multiple_css_class_a.html multiple_css_class_b.html
+== iframe/bg_color.html iframe/bg_color_ref.html
== iframe/simple.html iframe/simple_ref.html
== iframe/simple_inline_default.html iframe/simple_inline_default_ref.html
== iframe/simple_inline_width.html iframe/simple_inline_width_ref.html
diff --git a/tests/ref/iframe/bg_color.html b/tests/ref/iframe/bg_color.html
new file mode 100644
index 00000000000..a139865a2b6
--- /dev/null
+++ b/tests/ref/iframe/bg_color.html
@@ -0,0 +1,8 @@
+<html>
+ <body style="background-color: blue; margin: 0;">
+ <div style="margin: 20px;">
+ <iframe src="about:blank" style="border: 0; background-color: green;">
+ </iframe>
+ </div>
+ </body>
+</html>
diff --git a/tests/ref/iframe/bg_color_ref.html b/tests/ref/iframe/bg_color_ref.html
new file mode 100644
index 00000000000..085a248a8cf
--- /dev/null
+++ b/tests/ref/iframe/bg_color_ref.html
@@ -0,0 +1,6 @@
+<html>
+ <body style="background-color: blue; margin: 0;">
+ <div style="width: 300px; height: 150px; margin: 20px; background-color: green;">
+ </div>
+ </body>
+</html>