mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
stylo: Cleanup a bit of the Stylist clear setup.
This moves us to clear on rebuild, which allows us to remove yet another place where we track stylist dirtiness. Bug: 1390255 Reviewed-by: heycam MozReview-Commit-ID: nihQbUAbh8 Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
b040d79333
commit
4c80cccbd2
9 changed files with 65 additions and 195 deletions
|
@ -8,7 +8,7 @@ use dom::TElement;
|
|||
use invalidation::stylesheets::StylesheetInvalidationSet;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use std::slice;
|
||||
use stylesheets::{Origin, PerOrigin, StylesheetInDocument};
|
||||
use stylesheets::{OriginSet, PerOrigin, StylesheetInDocument};
|
||||
use stylist::Stylist;
|
||||
|
||||
/// Entry for a StylesheetSet. We don't bother creating a constructor, because
|
||||
|
@ -169,21 +169,23 @@ where
|
|||
pub fn flush<E>(
|
||||
&mut self,
|
||||
document_element: Option<E>,
|
||||
) -> StylesheetIterator<S>
|
||||
) -> (StylesheetIterator<S>, OriginSet)
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
debug!("StylesheetSet::flush");
|
||||
debug_assert!(self.has_changed());
|
||||
|
||||
for (data, _) in self.invalidation_data.iter_mut_origins() {
|
||||
let mut origins = OriginSet::empty();
|
||||
for (data, origin) in self.invalidation_data.iter_mut_origins() {
|
||||
if data.dirty {
|
||||
data.invalidations.flush(document_element);
|
||||
data.dirty = false;
|
||||
origins |= origin;
|
||||
}
|
||||
}
|
||||
|
||||
self.iter()
|
||||
(self.iter(), origins)
|
||||
}
|
||||
|
||||
/// Returns an iterator over the current list of stylesheets.
|
||||
|
@ -191,24 +193,15 @@ where
|
|||
StylesheetIterator(self.entries.iter())
|
||||
}
|
||||
|
||||
/// Mark the stylesheets as dirty, because something external may have
|
||||
/// invalidated it.
|
||||
///
|
||||
/// FIXME(emilio): Make this more granular.
|
||||
pub fn force_dirty(&mut self) {
|
||||
for (data, _) in self.invalidation_data.iter_mut_origins() {
|
||||
/// Mark the stylesheets for the specified origin as dirty, because
|
||||
/// something external may have invalidated it.
|
||||
pub fn force_dirty(&mut self, origins: OriginSet) {
|
||||
for origin in origins.iter() {
|
||||
let data = self.invalidation_data.borrow_mut_for_origin(&origin);
|
||||
data.invalidations.invalidate_fully();
|
||||
data.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark the stylesheets for the specified origin as dirty, because
|
||||
/// something external may have invalidated it.
|
||||
pub fn force_dirty_origin(&mut self, origin: &Origin) {
|
||||
let data = self.invalidation_data.borrow_mut_for_origin(origin);
|
||||
data.invalidations.invalidate_fully();
|
||||
data.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
struct InvalidationData {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue