mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Cache effective media query results.
This patch also makes RulesIterator not iterate over rules for which we don't process nested rules. There's nothing depending on this behavior right now afaik, and this will make us duplicate less code in following patches. Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1357461 MozReview-Commit-ID: CaMFQtAVnJF
This commit is contained in:
parent
b5232c940d
commit
5c66d3c77a
6 changed files with 242 additions and 87 deletions
|
@ -747,6 +747,24 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(raw_data: RawServoStyleSetBorr
|
|||
data.clear_stylist();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
) -> bool {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
||||
// NOTE(emilio): We don't actually need to flush the stylist here and ensure
|
||||
// it's up to date.
|
||||
//
|
||||
// In case it isn't we would trigger a rebuild + restyle as needed too.
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
data.stylist.media_features_change_changed_style(
|
||||
data.stylesheets.iter(),
|
||||
&guard,
|
||||
)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_PrependStyleSheet(raw_data: RawServoStyleSetBorrowed,
|
||||
raw_sheet: RawServoStyleSheetBorrowed,
|
||||
|
@ -1408,6 +1426,7 @@ pub extern "C" fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextOwned)
|
|||
pub extern "C" fn Servo_StyleSet_RebuildData(raw_data: RawServoStyleSetBorrowed) {
|
||||
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();
|
||||
data.reset_device(&guard);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue