diff options
author | Stuart Nelson <stuartnelson3@gmail.com> | 2017-10-05 10:41:49 +0200 |
---|---|---|
committer | Stuart Nelson <stuartnelson3@gmail.com> | 2017-10-05 20:51:02 +0200 |
commit | 3b4deb4388d6da5ade541a39bfea431bba0d82b3 (patch) | |
tree | 1a4544e08e2cefcb9936c269b2ec674bd85d69fe | |
parent | f2879a568d34ecc8d42de55569813d8a851e904f (diff) | |
download | servo-3b4deb4388d6da5ade541a39bfea431bba0d82b3.tar.gz servo-3b4deb4388d6da5ade541a39bfea431bba0d82b3.zip |
Add support for dynamic bgcolor change
4 files changed, 52 insertions, 0 deletions
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 4ade5560700..53fb0637b0d 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -125,6 +125,14 @@ impl VirtualMethods for HTMLBodyElement { Some(self.upcast::<HTMLElement>() as &VirtualMethods) } + fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool { + if attr.local_name() == &local_name!("bgcolor") { + return true; + } + + self.super_type().unwrap().attribute_affects_presentational_hints(attr) + } + fn bind_to_tree(&self, tree_in_doc: bool) { if let Some(ref s) = self.super_type() { s.bind_to_tree(tree_in_doc); diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 79db318a4cf..5f67fc43925 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -755,6 +755,18 @@ {} ] ], + "css/body_bgcolor_attribute_change.html": [ + [ + "/_mozilla/css/body_bgcolor_attribute_change.html", + [ + [ + "/_mozilla/css/body_bgcolor_attribute_change_ref.html", + "==" + ] + ], + {} + ] + ], "css/border-image-linear-gradient.html": [ [ "/_mozilla/css/border-image-linear-gradient.html", @@ -8186,6 +8198,11 @@ {} ] ], + "css/body_bgcolor_attribute_change_ref.html": [ + [ + {} + ] + ], "css/border-image-linear-gradient-ref.html": [ [ {} @@ -23067,6 +23084,14 @@ "d0bf8fafec5ff2c0cfde8f0d47083ca23b745588", "support" ], + "css/body_bgcolor_attribute_change.html": [ + "87ac2d974938dccdec21b522af13ecd2ae9b1ab1", + "reftest" + ], + "css/body_bgcolor_attribute_change_ref.html": [ + "aa8be9d8b11635dc87f287530ef76ccf529a7ed9", + "support" + ], "css/border-image-linear-gradient-ref.html": [ "3c1b61477c8a3cb7befc3ab81b80a128b142e3f1", "support" diff --git a/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html b/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html new file mode 100644 index 00000000000..2e1692a6e3b --- /dev/null +++ b/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html @@ -0,0 +1,13 @@ +<!doctype html> +<html> + <head> + <link rel="match" href="body_bgcolor_attribute_change_ref.html"> + </head> + <body bgcolor="yellow" onclick="this.setAttribute('bgcolor', 'green');"> + Click me, I should become green. + </body> + <script> + document.body.offsetTop; + document.querySelector("body").setAttribute("bgcolor", "green"); + </script> +</html> diff --git a/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html b/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html new file mode 100644 index 00000000000..6337a5a43ee --- /dev/null +++ b/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html @@ -0,0 +1,6 @@ +<!doctype html> +<html> + <body bgcolor="green" onclick="this.setAttribute('bgcolor', 'green');"> + Click me, I should become green. + </body> +</html> |