mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Add docs about the lack of device in the stylesheet set.
Also add a few comments and similar about pending invalidation work, and avoid passing a device in script, since the work it performs scanning the stylesheet is just thrown away in the `flush_without_invalidations` call.
This commit is contained in:
parent
cbf388a5fd
commit
0701c0c953
2 changed files with 10 additions and 5 deletions
|
@ -2338,6 +2338,11 @@ impl Document {
|
||||||
pub fn flush_stylesheets_for_reflow(&self) -> bool {
|
pub fn flush_stylesheets_for_reflow(&self) -> bool {
|
||||||
// NOTE(emilio): The invalidation machinery is used on the replicated
|
// NOTE(emilio): The invalidation machinery is used on the replicated
|
||||||
// list on the layout thread.
|
// list on the layout thread.
|
||||||
|
//
|
||||||
|
// FIXME(emilio): This really should differentiate between CSSOM changes
|
||||||
|
// and normal stylesheets additions / removals, because in the last case
|
||||||
|
// the layout thread already has that information and we could avoid
|
||||||
|
// dirtying the whole thing.
|
||||||
let mut stylesheets = self.stylesheets.borrow_mut();
|
let mut stylesheets = self.stylesheets.borrow_mut();
|
||||||
let have_changed = stylesheets.has_changed();
|
let have_changed = stylesheets.has_changed();
|
||||||
stylesheets.flush_without_invalidation();
|
stylesheets.flush_without_invalidation();
|
||||||
|
@ -2370,11 +2375,10 @@ impl Document {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let guard = s.shared_lock.read();
|
let guard = s.shared_lock.read();
|
||||||
let device = self.device();
|
|
||||||
|
|
||||||
// FIXME(emilio): Would be nice to remove the clone, etc.
|
// FIXME(emilio): Would be nice to remove the clone, etc.
|
||||||
self.stylesheets.borrow_mut().remove_stylesheet(
|
self.stylesheets.borrow_mut().remove_stylesheet(
|
||||||
device.as_ref(),
|
None,
|
||||||
StyleSheetInDocument {
|
StyleSheetInDocument {
|
||||||
sheet: s.clone(),
|
sheet: s.clone(),
|
||||||
owner: JS::from_ref(owner),
|
owner: JS::from_ref(owner),
|
||||||
|
@ -2414,13 +2418,12 @@ impl Document {
|
||||||
let lock = self.style_shared_lock();
|
let lock = self.style_shared_lock();
|
||||||
let guard = lock.read();
|
let guard = lock.read();
|
||||||
|
|
||||||
let device = self.device();
|
|
||||||
match insertion_point {
|
match insertion_point {
|
||||||
Some(ip) => {
|
Some(ip) => {
|
||||||
stylesheets.insert_stylesheet_before(device.as_ref(), sheet, ip, &guard);
|
stylesheets.insert_stylesheet_before(None, sheet, ip, &guard);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
stylesheets.append_stylesheet(device.as_ref(), sheet, &guard);
|
stylesheets.append_stylesheet(None, sheet, &guard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Appends a new stylesheet to the current set.
|
/// Appends a new stylesheet to the current set.
|
||||||
|
///
|
||||||
|
/// No device implies not computing invalidations.
|
||||||
pub fn append_stylesheet(
|
pub fn append_stylesheet(
|
||||||
&mut self,
|
&mut self,
|
||||||
device: Option<&Device>,
|
device: Option<&Device>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue