aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-12-01 21:40:58 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-12-01 21:40:58 +0530
commit65108348aa543774ade163b25836018fa8f6c00f (patch)
tree0f3034394753fb6332d0772fa12f9a860f063f83
parentb4906aa008325963348b6cc13bbcf8d2a4c9d694 (diff)
parent320263199fbcc3aa60587f11bb757d6237e0e0aa (diff)
downloadservo-65108348aa543774ade163b25836018fa8f6c00f.tar.gz
servo-65108348aa543774ade163b25836018fa8f6c00f.zip
Auto merge of #8714 - frewsxcv:body-fgcolor, r=Ms2ger
Implement attribute 'fgColor' on 'document' The 'text' attribute was implemented on `<body>` in #7841 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8714) <!-- Reviewable:end -->
-rw-r--r--components/script/dom/document.rs10
-rw-r--r--components/script/dom/webidls/Document.webidl2
-rw-r--r--tests/wpt/metadata/html/dom/interfaces.html.ini6
-rw-r--r--tests/wpt/metadata/html/dom/reflection-sections.html.ini129
-rw-r--r--tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html.ini8
-rw-r--r--tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html.ini8
-rw-r--r--tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-04.html.ini6
-rw-r--r--tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html6
-rw-r--r--tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html6
9 files changed, 25 insertions, 156 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 92942012def..a30e923cee8 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2289,6 +2289,16 @@ impl DocumentMethods for Document {
self.set_body_attribute(&atom!("bgcolor"), value)
}
+ // https://html.spec.whatwg.org/multipage/#dom-document-fgcolor
+ fn FgColor(&self) -> DOMString {
+ self.get_body_attribute(&atom!("text"))
+ }
+
+ // https://html.spec.whatwg.org/multipage/#dom-document-fgcolor
+ fn SetFgColor(&self, value: DOMString) {
+ self.set_body_attribute(&atom!("text"), value)
+ }
+
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString, found: &mut bool) -> *mut JSObject {
#[derive(JSTraceable, HeapSizeOf)]
diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl
index 863824338ed..69cb136749f 100644
--- a/components/script/dom/webidls/Document.webidl
+++ b/components/script/dom/webidls/Document.webidl
@@ -141,7 +141,7 @@ Document implements GlobalEventHandlers;
// https://html.spec.whatwg.org/multipage/#Document-partial
partial interface Document {
- // [TreatNullAs=EmptyString] attribute DOMString fgColor;
+ [TreatNullAs=EmptyString] attribute DOMString fgColor;
// https://github.com/servo/servo/issues/8715
// [TreatNullAs=EmptyString] attribute DOMString linkColor;
diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini
index e0429d6c78b..a292516b1e5 100644
--- a/tests/wpt/metadata/html/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/html/dom/interfaces.html.ini
@@ -54,9 +54,6 @@
[Document interface: attribute commands]
expected: FAIL
- [Document interface: attribute fgColor]
- expected: FAIL
-
[Document interface: attribute linkColor]
expected: FAIL
@@ -9045,9 +9042,6 @@
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "commands" with the proper type (70)]
expected: FAIL
- [Document interface: document.implementation.createDocument(null, "", null) must inherit property "fgColor" with the proper type (72)]
- expected: FAIL
-
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "linkColor" with the proper type (73)]
expected: FAIL
diff --git a/tests/wpt/metadata/html/dom/reflection-sections.html.ini b/tests/wpt/metadata/html/dom/reflection-sections.html.ini
index 614ea231332..b3d7609a401 100644
--- a/tests/wpt/metadata/html/dom/reflection-sections.html.ini
+++ b/tests/wpt/metadata/html/dom/reflection-sections.html.ini
@@ -12528,135 +12528,6 @@
[#document.dir (<html dir>): IDL set to "AUTO" followed by IDL get]
expected: FAIL
- [#document.fgColor (<body text>): typeof IDL attribute]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL get with DOM attribute unset]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to "" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to undefined followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to 7 followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to 1.5 followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to true followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to false followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to object "[object Object\]" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to NaN followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to Infinity followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to -Infinity followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to "\\0" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to null followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to object "test-toString" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): setAttribute() to object "test-valueOf" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to "" followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to undefined followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to undefined followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to 7 followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to 7 followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to 1.5 followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to 1.5 followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to true followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to true followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to false followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to false followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to object "[object Object\]" followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to object "[object Object\]" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to NaN followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to NaN followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to Infinity followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to Infinity followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to -Infinity followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to -Infinity followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to "\\0" followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to null followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to null followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to object "test-toString" followed by getAttribute()]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to object "test-toString" followed by IDL get]
- expected: FAIL
-
- [#document.fgColor (<body text>): IDL set to object "test-valueOf" followed by IDL get]
- expected: FAIL
-
[#document.linkColor (<body link>): typeof IDL attribute]
expected: FAIL
diff --git a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html.ini b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html.ini
index 14623905ce0..450b80e5d3a 100644
--- a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html.ini
+++ b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html.ini
@@ -1,17 +1,11 @@
[document-color-02.html]
type: testharness
- [document: fg/bg/link/vlink/alink-color 1]
- expected: FAIL
-
- [document: fg/bg/link/vlink/alink-color 3]
- expected: FAIL
-
[document: fg/bg/link/vlink/alink-color 4]
expected: FAIL
[document: fg/bg/link/vlink/alink-color 5]
expected: FAIL
- [document: fg/bg/link/vlink/alink-color]
+ [document: fg/bg/link/vlink/alink-color 6]
expected: FAIL
diff --git a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html.ini b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html.ini
index fe56f27ac9d..ef5979ada3d 100644
--- a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html.ini
+++ b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html.ini
@@ -1,17 +1,11 @@
[document-color-03.html]
type: testharness
- [document: fg/bg/link/vlink/alink-color 1]
- expected: FAIL
-
- [document: fg/bg/link/vlink/alink-color 3]
- expected: FAIL
-
[document: fg/bg/link/vlink/alink-color 4]
expected: FAIL
[document: fg/bg/link/vlink/alink-color 5]
expected: FAIL
- [document: fg/bg/link/vlink/alink-color]
+ [document: fg/bg/link/vlink/alink-color 6]
expected: FAIL
diff --git a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-04.html.ini b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-04.html.ini
index adf0104f035..828256ebe1a 100644
--- a/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-04.html.ini
+++ b/tests/wpt/metadata/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-04.html.ini
@@ -1,8 +1,5 @@
[document-color-04.html]
type: testharness
- [document: fg/bg/link/vlink/alink-color 1]
- expected: FAIL
-
[document: fg/bg/link/vlink/alink-color 3]
expected: FAIL
@@ -12,6 +9,3 @@
[document: fg/bg/link/vlink/alink-color 5]
expected: FAIL
- [document: fg/bg/link/vlink/alink-color]
- expected: FAIL
-
diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html
index daf74e1344e..ebf15e79cd5 100644
--- a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html
+++ b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-02.html
@@ -15,6 +15,12 @@ test(function() {
assert_equals(document.alinkColor, document.body.aLink);
})
test(function() {
+ document.fgColor = null;
+ assert_equals(document.fgColor, "");
+ assert_equals(document.body.text, "");
+ assert_equals(document.body.getAttribute("text"), "");
+})
+test(function() {
document.fgColor = "blue";
assert_equals(document.fgColor, "blue");
assert_equals(document.body.text, "blue");
diff --git a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html
index e020a3853da..629c24627ce 100644
--- a/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html
+++ b/tests/wpt/web-platform-tests/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis/document-color-03.html
@@ -15,6 +15,12 @@ test(function() {
assert_equals(document.alinkColor, document.body.aLink);
})
test(function() {
+ document.body.text = null;
+ assert_equals(document.fgColor, "");
+ assert_equals(document.body.text, "");
+ assert_equals(document.body.getAttribute("text"), "");
+})
+test(function() {
document.body.text = "blue";
assert_equals(document.fgColor, "blue");
assert_equals(document.body.text, "blue");