mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Auto merge of #9036 - KiChjang:document-charset, r=Ms2ger
Implement Document charset Rebase of #7966. Fixes #7718. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9036) <!-- Reviewable:end -->
This commit is contained in:
commit
df087cc6cf
9 changed files with 36 additions and 270 deletions
|
@ -379,7 +379,35 @@ impl Document {
|
|||
}
|
||||
|
||||
pub fn set_encoding_name(&self, name: DOMString) {
|
||||
*self.encoding_name.borrow_mut() = name;
|
||||
*self.encoding_name.borrow_mut() = DOMString::from(
|
||||
match name.as_ref() {
|
||||
"utf-8" => "UTF-8",
|
||||
"ibm866" => "IBM866",
|
||||
"iso-8859-2" => "ISO-8859-2",
|
||||
"iso-8859-3" => "ISO-8859-3",
|
||||
"iso-8859-4" => "ISO-8859-4",
|
||||
"iso-8859-5" => "ISO-8859-5",
|
||||
"iso-8859-6" => "ISO-8859-6",
|
||||
"iso-8859-7" => "ISO-8859-7",
|
||||
"iso-8859-8" => "ISO-8859-8",
|
||||
"iso-8859-8-i" => "ISO-8859-8-I",
|
||||
"iso-8859-10" => "ISO-8859-10",
|
||||
"iso-8859-13" => "ISO-8859-13",
|
||||
"iso-8859-14" => "ISO-8859-14",
|
||||
"iso-8859-15" => "ISO-8859-15",
|
||||
"iso-8859-16" => "ISO-8859-16",
|
||||
"koi8-r" => "KOI8-R",
|
||||
"koi8-u" => "KOI8-U",
|
||||
"gbk" => "GBK",
|
||||
"big5" => "Big5",
|
||||
"euc-jp" => "EUC-JP",
|
||||
"iso-2022-jp" => "ISO-2022-JP",
|
||||
"shift_jis" => "Shift_JIS",
|
||||
"euc-kr" => "EUC-KR",
|
||||
"utf-16be" => "UTF-16BE",
|
||||
"utf-16le" => "UTF-16LE",
|
||||
_ => &*name
|
||||
});
|
||||
}
|
||||
|
||||
pub fn content_changed(&self, node: &Node, damage: NodeDamage) {
|
||||
|
@ -1719,9 +1747,14 @@ impl DocumentMethods for Document {
|
|||
self.encoding_name.borrow().clone()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-charset
|
||||
fn Charset(&self) -> DOMString {
|
||||
self.CharacterSet()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-inputencoding
|
||||
fn InputEncoding(&self) -> DOMString {
|
||||
self.encoding_name.borrow().clone()
|
||||
self.CharacterSet()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-content_type
|
||||
|
|
|
@ -20,6 +20,7 @@ interface Document : Node {
|
|||
readonly attribute DOMString documentURI;
|
||||
readonly attribute DOMString compatMode;
|
||||
readonly attribute DOMString characterSet;
|
||||
readonly attribute DOMString charset; // legacy alias of .characterSet
|
||||
readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
|
||||
[Constant]
|
||||
readonly attribute DOMString contentType;
|
||||
|
|
|
@ -207,12 +207,6 @@
|
|||
[DOMSettableTokenList interface: attribute value]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute charset]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: xmlDoc must inherit property "charset" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: xmlDoc must inherit property "query" with the proper type (35)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,239 +0,0 @@
|
|||
[DOMImplementation-createDocument.html]
|
||||
type: testharness
|
||||
[createDocument test 0: characterSet aliases for null,undefined,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 1: characterSet aliases for null,"foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 3: characterSet aliases for null,"f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 4: characterSet aliases for null,"foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 22: characterSet aliases for null,"xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 24: characterSet aliases for null,"xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 32: characterSet aliases for undefined,undefined,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 33: characterSet aliases for undefined,"foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 35: characterSet aliases for undefined,"f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 36: characterSet aliases for undefined,"foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 40: characterSet aliases for undefined,"xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 42: characterSet aliases for undefined,"xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 46: characterSet aliases for "http://example.com/","foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 48: characterSet aliases for "http://example.com/","f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 49: characterSet aliases for "http://example.com/","foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 51: characterSet aliases for "http://example.com/","f:oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 53: characterSet aliases for "http://example.com/","_:_",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 54: characterSet aliases for "http://example.com/","_:h0",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 55: characterSet aliases for "http://example.com/","_:test",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 56: characterSet aliases for "http://example.com/","l_:_",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 57: characterSet aliases for "http://example.com/","ns:_0",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 58: characterSet aliases for "http://example.com/","ns:a0",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 59: characterSet aliases for "http://example.com/","ns0:test",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 60: characterSet aliases for "http://example.com/","a.b:c",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 61: characterSet aliases for "http://example.com/","a-b:c",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 62: characterSet aliases for "http://example.com/","a-b:c",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 63: characterSet aliases for "http://example.com/","xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 65: characterSet aliases for "http://example.com/","XMLNS",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 66: characterSet aliases for "http://example.com/","xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 68: characterSet aliases for "http://example.com/","XML:foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 70: characterSet aliases for "http://example.com/","XMLNS:foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 71: characterSet aliases for "http://example.com/","xmlfoo:bar",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 100: characterSet aliases for "/","foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 102: characterSet aliases for "/","f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 103: characterSet aliases for "/","foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 105: characterSet aliases for "/","f:oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 107: characterSet aliases for "/","xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 109: characterSet aliases for "/","xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 112: characterSet aliases for "/","xmlfoo:bar",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 113: characterSet aliases for "http://www.w3.org/XML/1998/namespace","foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 115: characterSet aliases for "http://www.w3.org/XML/1998/namespace","f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 116: characterSet aliases for "http://www.w3.org/XML/1998/namespace","foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 118: characterSet aliases for "http://www.w3.org/XML/1998/namespace","f:oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 120: characterSet aliases for "http://www.w3.org/XML/1998/namespace","xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 122: characterSet aliases for "http://www.w3.org/XML/1998/namespace","xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 123: characterSet aliases for "http://www.w3.org/XML/1998/namespace","xml:foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 125: characterSet aliases for "http://www.w3.org/XML/1998/namespace","xmlfoo:bar",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 136: characterSet aliases for "http://www.w3.org/2000/xmlns/","xmlns",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 139: characterSet aliases for "http://www.w3.org/2000/xmlns/","xmlns:foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 142: characterSet aliases for "foo:","foo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 144: characterSet aliases for "foo:","f1oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 145: characterSet aliases for "foo:","foo1",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 147: characterSet aliases for "foo:","f:oo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 149: characterSet aliases for "foo:","xml",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 151: characterSet aliases for "foo:","xmlfoo",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 154: characterSet aliases for "foo:","xmlfoo:bar",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 156: characterSet aliases for null,null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 157: characterSet aliases for null,"",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 158: characterSet aliases for undefined,null,undefined]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 159: characterSet aliases for undefined,undefined,undefined]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 160: characterSet aliases for undefined,"",undefined]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 161: characterSet aliases for "http://example.com/",null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 162: characterSet aliases for "http://example.com/","",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 163: characterSet aliases for "/",null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 164: characterSet aliases for "/","",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 165: characterSet aliases for "http://www.w3.org/XML/1998/namespace",null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 166: characterSet aliases for "http://www.w3.org/XML/1998/namespace","",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 167: characterSet aliases for "http://www.w3.org/2000/xmlns/",null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 168: characterSet aliases for "http://www.w3.org/2000/xmlns/","",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 169: characterSet aliases for "foo:",null,null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 170: characterSet aliases for "foo:","",null]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 171: characterSet aliases for null,null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 172: characterSet aliases for null,null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 173: characterSet aliases for null,null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 174: characterSet aliases for null,null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 175: characterSet aliases for null,null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 176: characterSet aliases for null,"foo",DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 177: characterSet aliases for "foo",null,DocumentType node]
|
||||
expected: FAIL
|
||||
|
||||
[createDocument test 178: characterSet aliases for "foo","bar",DocumentType node]
|
||||
expected: FAIL
|
||||
|
|
@ -3,6 +3,3 @@
|
|||
[createHTMLDocument(): URL parsing]
|
||||
expected: FAIL
|
||||
|
||||
[createHTMLDocument(): characterSet aliases]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,6 +3,3 @@
|
|||
[new Document(): URL parsing]
|
||||
expected: FAIL
|
||||
|
||||
[new Document(): characterSet aliases]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[Node-properties.html]
|
||||
type: testharness
|
||||
[document.charset]
|
||||
expected: FAIL
|
||||
|
||||
[foreignDoc.charset]
|
||||
expected: FAIL
|
||||
|
||||
[xmlDoc.charset]
|
||||
expected: FAIL
|
||||
|
|
@ -3,6 +3,3 @@
|
|||
[Location value]
|
||||
expected: FAIL
|
||||
|
||||
[charset]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -8922,9 +8922,6 @@
|
|||
[Document interface: iframe.contentDocument must inherit property "onwaiting" with the proper type (156)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "charset" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "styleSheets" with the proper type (28)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue