From 3b4deb4388d6da5ade541a39bfea431bba0d82b3 Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Thu, 5 Oct 2017 10:41:49 +0200 Subject: [PATCH 1/4] 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. + + From 1977352bff101881bc3a9e5fd6f3cc3e79b4f954 Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Thu, 5 Oct 2017 20:48:55 +0200 Subject: [PATCH 2/4] Simplify and move ref test --- tests/wpt/metadata/MANIFEST.json | 25 +++++++++++++++++++ tests/wpt/mozilla/meta/MANIFEST.json | 25 ------------------- .../css/body_bgcolor_attribute_change.html | 13 ---------- .../body_bgcolor_attribute_change_ref.html | 6 ----- .../body-bgcolor-attribute-change-ref.html | 4 +++ .../body-bgcolor-attribute-change.html | 9 +++++++ 6 files changed, 38 insertions(+), 44 deletions(-) delete mode 100644 tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html delete mode 100644 tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html create mode 100644 tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html create mode 100644 tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 3725edf9ece..fb968cde001 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -98313,6 +98313,18 @@ {} ] ], + "css/css-backgrounds-3/body-bgcolor-attribute-change.html": [ + [ + "/css/css-backgrounds-3/body-bgcolor-attribute-change.html", + [ + [ + "/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-backgrounds-3/border-bottom-left-radius-001.xht": [ [ "/css/css-backgrounds-3/border-bottom-left-radius-001.xht", @@ -224647,6 +224659,11 @@ {} ] ], + "css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html": [ + [ + {} + ] + ], "css/css-backgrounds-3/border-radius-001-ref.xht": [ [ {} @@ -492855,6 +492872,14 @@ "fe327831e6eeea20a7d7da4b295d272e20ed0821", "visual" ], + "css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html": [ + "cf3216e8cfecff2c7d22aae9470f9be79c69c1e9", + "support" + ], + "css/css-backgrounds-3/body-bgcolor-attribute-change.html": [ + "cdf516f9a9b61ca4b93e3ac9d6127d342d534c12", + "reftest" + ], "css/css-backgrounds-3/border-bottom-left-radius-001.xht": [ "44d36841a6b0aa58daab9c66cb5cf3b62eeb26d7", "reftest" diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 5f67fc43925..79db318a4cf 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -755,18 +755,6 @@ {} ] ], - "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", @@ -8198,11 +8186,6 @@ {} ] ], - "css/body_bgcolor_attribute_change_ref.html": [ - [ - {} - ] - ], "css/border-image-linear-gradient-ref.html": [ [ {} @@ -23084,14 +23067,6 @@ "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 deleted file mode 100644 index 2e1692a6e3b..00000000000 --- a/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - 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 deleted file mode 100644 index 6337a5a43ee..00000000000 --- a/tests/wpt/mozilla/tests/css/body_bgcolor_attribute_change_ref.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - Click me, I should become green. - - diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html new file mode 100644 index 00000000000..32532da411b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html @@ -0,0 +1,4 @@ + + + Click me, I should become green. + diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html new file mode 100644 index 00000000000..289cac29899 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html @@ -0,0 +1,9 @@ + + + + Click me, I should become green. + + From aff8b0a4e94c3e6878a925c2f2fc675e6783de41 Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Sat, 7 Oct 2017 11:34:00 +0200 Subject: [PATCH 3/4] add help link and regen manifest --- tests/wpt/metadata/MANIFEST.json | 2 +- .../css/css-backgrounds-3/body-bgcolor-attribute-change.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index fb968cde001..2d2c816f5e2 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -492877,7 +492877,7 @@ "support" ], "css/css-backgrounds-3/body-bgcolor-attribute-change.html": [ - "cdf516f9a9b61ca4b93e3ac9d6127d342d534c12", + "fa783798937b4acfde13cd5c266094f08194d1bb", "reftest" ], "css/css-backgrounds-3/border-bottom-left-radius-001.xht": [ diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html index 289cac29899..e36f62e9794 100644 --- a/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html +++ b/tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html @@ -1,5 +1,6 @@ - + + Click me, I should become green. From c886e3ee7560527a0674dcc1d9b146ddf11febcd Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Sun, 8 Oct 2017 11:29:49 +0200 Subject: [PATCH 4/4] Update manifest and move files --- tests/wpt/metadata/MANIFEST.json | 50 +++++++++---------- .../body-bgcolor-attribute-change-ref.html | 2 +- .../body-bgcolor-attribute-change.html | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) rename tests/wpt/web-platform-tests/{css/css-backgrounds-3 => html/rendering/the-css-user-agent-style-sheet-and-presentational-hints}/body-bgcolor-attribute-change-ref.html (55%) rename tests/wpt/web-platform-tests/{css/css-backgrounds-3 => html/rendering/the-css-user-agent-style-sheet-and-presentational-hints}/body-bgcolor-attribute-change.html (89%) diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 2d2c816f5e2..ff6334f4d99 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -98313,18 +98313,6 @@ {} ] ], - "css/css-backgrounds-3/body-bgcolor-attribute-change.html": [ - [ - "/css/css-backgrounds-3/body-bgcolor-attribute-change.html", - [ - [ - "/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html", - "==" - ] - ], - {} - ] - ], "css/css-backgrounds-3/border-bottom-left-radius-001.xht": [ [ "/css/css-backgrounds-3/border-bottom-left-radius-001.xht", @@ -168245,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", @@ -224659,11 +224659,6 @@ {} ] ], - "css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html": [ - [ - {} - ] - ], "css/css-backgrounds-3/border-radius-001-ref.xht": [ [ {} @@ -293059,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": [ [ {} @@ -492872,14 +492872,6 @@ "fe327831e6eeea20a7d7da4b295d272e20ed0821", "visual" ], - "css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html": [ - "cf3216e8cfecff2c7d22aae9470f9be79c69c1e9", - "support" - ], - "css/css-backgrounds-3/body-bgcolor-attribute-change.html": [ - "fa783798937b4acfde13cd5c266094f08194d1bb", - "reftest" - ], "css/css-backgrounds-3/border-bottom-left-radius-001.xht": [ "44d36841a6b0aa58daab9c66cb5cf3b62eeb26d7", "reftest" @@ -584768,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/css/css-backgrounds-3/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 similarity index 55% rename from tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change-ref.html rename to tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change-ref.html index 32532da411b..43f0c6dd200 100644 --- a/tests/wpt/web-platform-tests/css/css-backgrounds-3/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 @@ -1,4 +1,4 @@ - Click me, I should become green. + Passes if the background is green. diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds-3/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 similarity index 89% rename from tests/wpt/web-platform-tests/css/css-backgrounds-3/body-bgcolor-attribute-change.html rename to tests/wpt/web-platform-tests/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html index e36f62e9794..d0b2396a404 100644 --- a/tests/wpt/web-platform-tests/css/css-backgrounds-3/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 @@ -2,7 +2,7 @@ - Click me, I should become green. + Passes if the background is green.