diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-08 07:47:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-08 07:47:50 -0500 |
commit | 712d32e899fd7209f11a422573e18c724ecc65d8 (patch) | |
tree | eff3fa67b5d305ebe09a67882e27de0daa55a0c6 | |
parent | 47efcd5e52afd62dcd84ba350948039f67613e20 (diff) | |
parent | c886e3ee7560527a0674dcc1d9b146ddf11febcd (diff) | |
download | servo-712d32e899fd7209f11a422573e18c724ecc65d8.tar.gz servo-712d32e899fd7209f11a422573e18c724ecc65d8.zip |
Auto merge of #18758 - stuartnelson3:stn/dynamic-body-bgcolor, r=emilio
Add support for dynamic bgcolor change
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18758)
<!-- Reviewable:end -->
4 files changed, 47 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/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 3725edf9ece..ff6334f4d99 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -168233,6 +168233,18 @@ {} ] ], + "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html": [ + [ + "/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html", + [ + [ + "/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html", + "==" + ] + ], + {} + ] + ], "html/semantics/document-metadata/the-link-element/stylesheet-change-href.html": [ [ "/html/semantics/document-metadata/the-link-element/stylesheet-change-href.html", @@ -293042,6 +293054,11 @@ {} ] ], + "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html": [ + [ + {} + ] + ], "html/rendering/unstyled-xml-documents/.gitkeep": [ [ {} @@ -584743,6 +584760,14 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], + "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html": [ + "8040cdc2d5096bbb27ebed7539706574faa8515f", + "support" + ], + "html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html": [ + "3cd7418ba8ea44bc2a643e63d38574c39041de24", + "reftest" + ], "html/rendering/unstyled-xml-documents/.gitkeep": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" diff --git a/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html b/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html new file mode 100644 index 00000000000..43f0c6dd200 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html @@ -0,0 +1,4 @@ +<!doctype html> +<body bgcolor="green"> + Passes if the background is green. +</body> diff --git a/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html b/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html new file mode 100644 index 00000000000..d0b2396a404 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html @@ -0,0 +1,10 @@ +<!doctype html> +<link rel="help" href="https://html.spec.whatwg.org/multipage/obsolete.html#attr-body-bgcolor"> +<link rel="match" href="body-bgcolor-attribute-change-ref.html"> +<body bgcolor="yellow"> + Passes if the background is green. +</body> +<script> + document.body.offsetTop; + document.body.setAttribute("bgcolor", "green"); +</script> |