Pass the document instead of the documentElement to reflow.

This commit is contained in:
Bobby Holley 2015-10-12 17:43:49 -07:00
parent 85596b5510
commit 441c84d75d
5 changed files with 51 additions and 26 deletions

View file

@ -1175,15 +1175,14 @@ pub enum DocumentSource {
NotFromParser,
}
#[allow(unsafe_code)]
pub trait LayoutDocumentHelpers {
#[allow(unsafe_code)]
unsafe fn is_html_document_for_layout(&self) -> bool;
}
#[allow(unsafe_code)]
impl LayoutDocumentHelpers for LayoutJS<Document> {
#[allow(unrooted_must_root)]
#[inline]
#[allow(unsafe_code)]
unsafe fn is_html_document_for_layout(&self) -> bool {
(*self.unsafe_get()).is_html_document
}

View file

@ -885,14 +885,6 @@ impl Window {
///
/// TODO(pcwalton): Only wait for style recalc, since we have off-main-thread layout.
pub fn force_reflow(&self, goal: ReflowGoal, query_type: ReflowQueryType, reason: ReflowReason) {
let document = self.Document();
let root = document.r().GetDocumentElement();
let root = match root.r() {
Some(root) => root,
None => return,
};
let root = root.upcast::<Node>();
let window_size = match self.window_size.get() {
Some(window_size) => window_size,
None => return,
@ -923,7 +915,7 @@ impl Window {
goal: goal,
page_clip_rect: self.page_clip_rect.get(),
},
document_root: root.to_trusted_node_address(),
document: self.Document().r().upcast::<Node>().to_trusted_node_address(),
window_size: window_size,
script_chan: self.control_chan.clone(),
script_join_chan: join_chan,