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 -->
This commit is contained in:
bors-servo 2015-12-01 21:40:58 +05:30
commit 65108348aa
9 changed files with 25 additions and 156 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,6 +14,12 @@ test(function() {
assert_equals(document.vlinkColor, document.body.vLink);
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");

View file

@ -14,6 +14,12 @@ test(function() {
assert_equals(document.vlinkColor, document.body.vLink);
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");