Format remaining files

This commit is contained in:
Pyfisch 2018-11-06 13:01:35 +01:00
parent bf47f90da6
commit cb07debcb6
252 changed files with 5944 additions and 3744 deletions

View file

@ -257,7 +257,8 @@ impl Tokenizer {
to_tokenizer_sender,
html_tokenizer_receiver,
);
}).expect("HTML Parser thread spawning failed");
})
.expect("HTML Parser thread spawning failed");
tokenizer
}
@ -273,7 +274,8 @@ impl Tokenizer {
self.html_tokenizer_sender
.send(ToHtmlTokenizerMsg::Feed {
input: send_tendrils,
}).unwrap();
})
.unwrap();
loop {
match self
@ -715,7 +717,8 @@ impl TreeSink for Sink {
.map(|attr| Attribute {
name: attr.name,
value: String::from(attr.value),
}).collect();
})
.collect();
self.send_op(ParseOperation::CreateElement {
node: node.id,
@ -835,7 +838,8 @@ impl TreeSink for Sink {
.map(|attr| Attribute {
name: attr.name,
value: String::from(attr.value),
}).collect();
})
.collect();
self.send_op(ParseOperation::AddAttrsIfMissing {
target: target.id,
attrs,

View file

@ -127,7 +127,8 @@ fn start_element<S: Serializer>(node: &Element, serializer: &mut S) -> io::Resul
let qname = QualName::new(None, attr.namespace().clone(), attr.local_name().clone());
let value = attr.value().clone();
(qname, value)
}).collect::<Vec<_>>();
})
.collect::<Vec<_>>();
let attr_refs = attrs.iter().map(|&(ref qname, ref value)| {
let ar: AttrRef = (&qname, &**value);
ar

View file

@ -722,8 +722,9 @@ impl FetchResponseListener for ParserContext {
let doc_body = DomRoot::upcast::<Node>(doc.GetBody().unwrap());
let img = HTMLImageElement::new(local_name!("img"), None, doc);
img.SetSrc(DOMString::from(self.url.to_string()));
doc_body.AppendChild(&DomRoot::upcast::<Node>(img)).expect("Appending failed");
doc_body
.AppendChild(&DomRoot::upcast::<Node>(img))
.expect("Appending failed");
},
Some(ref mime) if mime.type_() == mime::TEXT && mime.subtype() == mime::PLAIN => {
// https://html.spec.whatwg.org/multipage/#read-text
@ -750,17 +751,20 @@ impl FetchResponseListener for ParserContext {
}
},
// Handle text/xml, application/xml
Some(ref mime) if (mime.type_() == mime::TEXT && mime.subtype() == mime::XML) ||
(mime.type_() == mime::APPLICATION && mime.subtype() == mime::XML) => {},
Some(ref mime) if mime.type_() == mime::APPLICATION &&
mime.subtype().as_str() == "xhtml" &&
mime.suffix() == Some(mime::XML)
=> {}, // Handle xhtml (application/xhtml+xml)
Some(ref mime)
if (mime.type_() == mime::TEXT && mime.subtype() == mime::XML) ||
(mime.type_() == mime::APPLICATION && mime.subtype() == mime::XML) => {},
Some(ref mime)
if mime.type_() == mime::APPLICATION &&
mime.subtype().as_str() == "xhtml" &&
mime.suffix() == Some(mime::XML) => {}, // Handle xhtml (application/xhtml+xml)
Some(ref mime) => {
// Show warning page for unknown mime types.
let page = format!("<html><body><p>Unknown content type ({}/{}).</p></body></html>",
mime.type_().as_str(),
mime.subtype().as_str());
let page = format!(
"<html><body><p>Unknown content type ({}/{}).</p></body></html>",
mime.type_().as_str(),
mime.subtype().as_str()
);
self.is_synthesized_document = true;
parser.push_string_input_chunk(page);
parser.parse_sync();