Auto merge of #8098 - bholley:dirty_from_layout, r=jdm

Track event state changes on Document and do the dirtying from layout

This is a first step in fixing #6942.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8098)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-10-29 00:24:53 +05:30
commit 285e29c066
8 changed files with 179 additions and 44 deletions

View file

@ -94,6 +94,13 @@ impl<T> DOMRefCell<T> {
_ => None,
}
}
/// Version of the above that we use during restyle while the script task
/// is blocked.
pub fn borrow_mut_for_layout(&self) -> RefMut<T> {
debug_assert!(task_state::get().is_layout());
self.value.borrow_mut()
}
}
impl<T: JSTraceable> JSTraceable for DOMRefCell<T> {

View file

@ -35,6 +35,7 @@ use layout_interface::TrustedNodeAddress;
use script_task::STACK_ROOTS;
use std::cell::UnsafeCell;
use std::default::Default;
use std::hash::{Hash, Hasher};
use std::mem;
use std::ops::Deref;
use std::ptr;
@ -147,12 +148,24 @@ impl<T> PartialEq for JS<T> {
}
}
impl<T> Eq for JS<T> {}
impl<T> PartialEq for LayoutJS<T> {
fn eq(&self, other: &LayoutJS<T>) -> bool {
self.ptr == other.ptr
}
}
impl<T> Eq for LayoutJS<T> {}
impl<T> Hash for JS<T> {
fn hash<H: Hasher>(&self, state: &mut H) { self.ptr.hash(state) }
}
impl<T> Hash for LayoutJS<T> {
fn hash<H: Hasher>(&self, state: &mut H) { self.ptr.hash(state) }
}
impl <T> Clone for JS<T> {
#[inline]
#[allow(unrooted_must_root)]