From 3b4deb4388d6da5ade541a39bfea431bba0d82b3 Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Thu, 5 Oct 2017 10:41:49 +0200 Subject: [PATCH] Add support for dynamic bgcolor change --- components/script/dom/htmlbodyelement.rs | 8 ++++++ tests/wpt/mozilla/meta/MANIFEST.json | 25 +++++++++++++++++++ .../css/body_bgcolor_attribute_change.html | 13 ++++++++++ .../body_bgcolor_attribute_change_ref.html | 6 +++++ 4 files changed, 52 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html create mode 100644 tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html 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::() 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 @@ + + + + + + + Click me, I should become green. + + + 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 @@ + + + + Click me, I should become green. + +