Auto merge of #26484 - servo:layout-2020-style-prep, r=SimonSapin

Implement concept of dirty root
This commit is contained in:
bors-servo 2020-05-19 11:40:58 -04:00 committed by GitHub
commit 79b6758cb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 294 additions and 97 deletions

View file

@ -45,11 +45,12 @@ impl<T> DomRefCell<T> {
&mut *self.value.as_ptr()
}
/// Version of the above that we use during restyle while the script thread
/// is blocked.
pub fn borrow_mut_for_layout(&self) -> RefMut<T> {
/// Mutably borrow a cell for layout. Ideally this would use
/// `RefCell::try_borrow_mut_unguarded` but that doesn't exist yet.
#[allow(unsafe_code)]
pub unsafe fn borrow_mut_for_layout(&self) -> &mut T {
debug_assert!(thread_state::get().is_layout());
self.value.borrow_mut()
&mut *self.value.as_ptr()
}
}