mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
style: Look at the snapshots when invalidating due to stylesheet changes.
Otherwise removal of stylesheets may get out of sync with other DOM changes, and we may fail to invalidate the style of the affected elements. Bug: 1432850 Reviewed-by: bz MozReview-Commit-ID: DrMTgLzQcnk
This commit is contained in:
parent
c2dfece49f
commit
657d8b8e31
8 changed files with 95 additions and 37 deletions
|
@ -1219,21 +1219,23 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_FlushStyleSheets(
|
||||
pub unsafe extern "C" fn Servo_StyleSet_FlushStyleSheets(
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
doc_element: RawGeckoElementBorrowedOrNull,
|
||||
snapshots: *const ServoElementSnapshotTable,
|
||||
) {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
|
||||
let doc_element = doc_element.map(GeckoElement);
|
||||
let have_invalidations = data.flush_stylesheets(&guard, doc_element);
|
||||
|
||||
let have_invalidations =
|
||||
data.flush_stylesheets(&guard, doc_element, snapshots.as_ref());
|
||||
|
||||
if have_invalidations && doc_element.is_some() {
|
||||
// The invalidation machinery propagates the bits up, but we still
|
||||
// need to tell the gecko restyle root machinery about it.
|
||||
unsafe {
|
||||
bindings::Gecko_NoteDirtySubtreeForInvalidation(doc_element.unwrap().0);
|
||||
}
|
||||
// The invalidation machinery propagates the bits up, but we still need
|
||||
// to tell the Gecko restyle root machinery about it.
|
||||
bindings::Gecko_NoteDirtySubtreeForInvalidation(doc_element.unwrap().0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue