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 -->
This commit is contained in:
bors-servo 2017-10-08 07:47:50 -05:00 committed by GitHub
commit 712d32e899
4 changed files with 47 additions and 0 deletions

View file

@ -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);

View file

@ -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"

View file

@ -0,0 +1,4 @@
<!doctype html>
<body bgcolor="green">
Passes if the background is green.
</body>

View file

@ -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>