Bug 1357583: style: Hook up the invalidator in the StyleSheetSet. r=heycam

MozReview-Commit-ID: IhgKAovTJMX
This commit is contained in:
Emilio Cobos Álvarez 2017-05-24 02:31:59 +02:00
parent 658075af32
commit 39e836966e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 117 additions and 22 deletions

View file

@ -6,8 +6,10 @@
use Atom;
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use dom::TElement;
use fnv::FnvHashMap;
use gecko::rules::{CounterStyleRule, FontFaceRule};
use gecko::wrapper::GeckoElement;
use gecko_bindings::bindings::RawServoStyleSet;
use gecko_bindings::structs::RawGeckoPresContextOwned;
use gecko_bindings::structs::nsIDocument;
@ -74,11 +76,15 @@ impl PerDocumentStyleDataImpl {
pub fn reset_device(&mut self, guard: &SharedRwLockReadGuard) {
Arc::get_mut(self.stylist.device_mut()).unwrap().reset();
self.stylesheets.force_dirty();
self.flush_stylesheets(guard);
self.flush_stylesheets::<GeckoElement>(guard, None);
}
/// Recreate the style data if the stylesheets have changed.
pub fn flush_stylesheets(&mut self, guard: &SharedRwLockReadGuard) {
pub fn flush_stylesheets<E>(&mut self,
guard: &SharedRwLockReadGuard,
document_element: Option<E>)
where E: TElement,
{
if !self.stylesheets.has_changed() {
return;
}
@ -90,7 +96,8 @@ impl PerDocumentStyleDataImpl {
let author_style_disabled = self.stylesheets.author_style_disabled();
self.stylist.clear();
self.stylist.rebuild(self.stylesheets.flush(),
let iter = self.stylesheets.flush(document_element);
self.stylist.rebuild(iter,
&StylesheetGuards::same(guard),
/* ua_sheets = */ None,
/* stylesheets_changed = */ true,