mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Pass immutable document to parse_html.
This commit is contained in:
parent
687722da2d
commit
ed333ad8c3
2 changed files with 8 additions and 8 deletions
|
@ -291,7 +291,7 @@ pub fn build_element_from_tag(tag: DOMString, ns: Namespace, document: &JSRef<Do
|
|||
}
|
||||
|
||||
pub fn parse_html(page: &Page,
|
||||
document: &mut JSRef<Document>,
|
||||
document: &JSRef<Document>,
|
||||
url: Url,
|
||||
resource_task: ResourceTask)
|
||||
-> HtmlParserResult {
|
||||
|
@ -485,15 +485,15 @@ pub fn parse_html(page: &Page,
|
|||
set_quirks_mode: |mode| {
|
||||
debug!("set quirks mode");
|
||||
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
||||
let mut tmp_borrow = doc_cell.borrow_mut();
|
||||
let tmp = &mut *tmp_borrow;
|
||||
let tmp_borrow = doc_cell.borrow_mut();
|
||||
let tmp = &*tmp_borrow;
|
||||
tmp.set_quirks_mode(mode);
|
||||
},
|
||||
encoding_change: |encname| {
|
||||
debug!("encoding change");
|
||||
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
||||
let mut tmp_borrow = doc_cell.borrow_mut();
|
||||
let tmp = &mut *tmp_borrow;
|
||||
let tmp_borrow = doc_cell.borrow_mut();
|
||||
let tmp = &*tmp_borrow;
|
||||
tmp.set_encoding_name(encname);
|
||||
},
|
||||
complete_script: |script| {
|
||||
|
|
|
@ -947,7 +947,7 @@ impl ScriptTask {
|
|||
self.chan.clone(),
|
||||
self.compositor.dup(),
|
||||
self.image_cache_task.clone()).root();
|
||||
let mut document = Document::new(&*window, Some(url.clone()), HTMLDocument, None).root();
|
||||
let document = Document::new(&*window, Some(url.clone()), HTMLDocument, None).root();
|
||||
window.deref().init_browser_context(&*document);
|
||||
|
||||
with_compartment((**cx).ptr, window.reflector().get_jsobject(), || {
|
||||
|
@ -960,7 +960,7 @@ impl ScriptTask {
|
|||
//
|
||||
// Note: We can parse the next document in parallel with any previous documents.
|
||||
let html_parsing_result = hubbub_html_parser::parse_html(&*page,
|
||||
&mut *document,
|
||||
&*document,
|
||||
url.clone(),
|
||||
self.resource_task.clone());
|
||||
|
||||
|
@ -998,7 +998,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
// Kick off the initial reflow of the page.
|
||||
document.content_changed();
|
||||
document.deref().content_changed();
|
||||
|
||||
let fragment = url.fragment.as_ref().map(|ref fragment| fragment.to_string());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue