mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative representations in the future. To reduce churn, this commit leaves the String field public, though. Also, this will allow us to use the default String type to represent the IDL USVString type, which explicitly forbids unpaired surrogates, ans as such is a better match to the Rust String type.
This commit is contained in:
parent
e6aa976462
commit
6b75078503
83 changed files with 393 additions and 297 deletions
|
@ -109,7 +109,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
{
|
||||
// Step 3.
|
||||
let doc_node = doc.upcast::<Node>();
|
||||
let doc_type = DocumentType::new("html".to_owned(), None, None, doc.r());
|
||||
let doc_type = DocumentType::new(DOMString("html".to_owned()), None, None, doc.r());
|
||||
doc_node.AppendChild(doc_type.upcast()).unwrap();
|
||||
}
|
||||
|
||||
|
@ -117,13 +117,13 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
// Step 4.
|
||||
let doc_node = doc.upcast::<Node>();
|
||||
let doc_html = Root::upcast::<Node>(
|
||||
HTMLHtmlElement::new("html".to_owned(), None, doc.r()));
|
||||
HTMLHtmlElement::new(DOMString("html".to_owned()), None, doc.r()));
|
||||
doc_node.AppendChild(&doc_html).expect("Appending failed");
|
||||
|
||||
{
|
||||
// Step 5.
|
||||
let doc_head = Root::upcast::<Node>(
|
||||
HTMLHeadElement::new("head".to_owned(), None, doc.r()));
|
||||
HTMLHeadElement::new(DOMString("head".to_owned()), None, doc.r()));
|
||||
doc_html.AppendChild(&doc_head).unwrap();
|
||||
|
||||
// Step 6.
|
||||
|
@ -132,7 +132,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
Some(title_str) => {
|
||||
// Step 6.1.
|
||||
let doc_title = Root::upcast::<Node>(
|
||||
HTMLTitleElement::new("title".to_owned(), None, doc.r()));
|
||||
HTMLTitleElement::new(DOMString("title".to_owned()), None, doc.r()));
|
||||
doc_head.AppendChild(&doc_title).unwrap();
|
||||
|
||||
// Step 6.2.
|
||||
|
@ -143,7 +143,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
}
|
||||
|
||||
// Step 7.
|
||||
let doc_body = HTMLBodyElement::new("body".to_owned(), None, doc.r());
|
||||
let doc_body = HTMLBodyElement::new(DOMString("body".to_owned()), None, doc.r());
|
||||
doc_html.AppendChild(doc_body.upcast()).unwrap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue