mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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,
|
pub fn parse_html(page: &Page,
|
||||||
document: &mut JSRef<Document>,
|
document: &JSRef<Document>,
|
||||||
url: Url,
|
url: Url,
|
||||||
resource_task: ResourceTask)
|
resource_task: ResourceTask)
|
||||||
-> HtmlParserResult {
|
-> HtmlParserResult {
|
||||||
|
@ -485,15 +485,15 @@ pub fn parse_html(page: &Page,
|
||||||
set_quirks_mode: |mode| {
|
set_quirks_mode: |mode| {
|
||||||
debug!("set quirks mode");
|
debug!("set quirks mode");
|
||||||
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
||||||
let mut tmp_borrow = doc_cell.borrow_mut();
|
let tmp_borrow = doc_cell.borrow_mut();
|
||||||
let tmp = &mut *tmp_borrow;
|
let tmp = &*tmp_borrow;
|
||||||
tmp.set_quirks_mode(mode);
|
tmp.set_quirks_mode(mode);
|
||||||
},
|
},
|
||||||
encoding_change: |encname| {
|
encoding_change: |encname| {
|
||||||
debug!("encoding change");
|
debug!("encoding change");
|
||||||
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
// NOTE: tmp vars are workaround for lifetime issues. Both required.
|
||||||
let mut tmp_borrow = doc_cell.borrow_mut();
|
let tmp_borrow = doc_cell.borrow_mut();
|
||||||
let tmp = &mut *tmp_borrow;
|
let tmp = &*tmp_borrow;
|
||||||
tmp.set_encoding_name(encname);
|
tmp.set_encoding_name(encname);
|
||||||
},
|
},
|
||||||
complete_script: |script| {
|
complete_script: |script| {
|
||||||
|
|
|
@ -947,7 +947,7 @@ impl ScriptTask {
|
||||||
self.chan.clone(),
|
self.chan.clone(),
|
||||||
self.compositor.dup(),
|
self.compositor.dup(),
|
||||||
self.image_cache_task.clone()).root();
|
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);
|
window.deref().init_browser_context(&*document);
|
||||||
|
|
||||||
with_compartment((**cx).ptr, window.reflector().get_jsobject(), || {
|
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.
|
// Note: We can parse the next document in parallel with any previous documents.
|
||||||
let html_parsing_result = hubbub_html_parser::parse_html(&*page,
|
let html_parsing_result = hubbub_html_parser::parse_html(&*page,
|
||||||
&mut *document,
|
&*document,
|
||||||
url.clone(),
|
url.clone(),
|
||||||
self.resource_task.clone());
|
self.resource_task.clone());
|
||||||
|
|
||||||
|
@ -998,7 +998,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kick off the initial reflow of the page.
|
// 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());
|
let fragment = url.fragment.as_ref().map(|ref fragment| fragment.to_string());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue