mirror of
https://github.com/servo/servo.git
synced 2025-09-07 13:38:20 +01:00
Flush stylesheets when doing non-traversal-driven style operations.
Without this, the stylist can be stale when we query it.
This commit is contained in:
parent
d934379f22
commit
933cef4adc
2 changed files with 18 additions and 6 deletions
|
@ -77,6 +77,17 @@ impl PerDocumentStyleData {
|
|||
pub fn borrow_mut_from_raw<'a>(data: *mut RawServoStyleSet) -> &'a mut Self {
|
||||
unsafe { &mut *(data as *mut PerDocumentStyleData) }
|
||||
}
|
||||
|
||||
pub fn flush_stylesheets(&mut self) {
|
||||
// The stylist wants to be flushed if either the stylesheets change or the
|
||||
// device dimensions change. When we add support for media queries, we'll
|
||||
// need to detect the latter case and trigger a flush as well.
|
||||
if self.stylesheets_changed {
|
||||
let _ = Arc::get_mut(&mut self.stylist).unwrap()
|
||||
.update(&self.stylesheets, true);
|
||||
self.stylesheets_changed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for PerDocumentStyleData {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue