mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Bug 1357583: style: Hook up the invalidator in the StyleSheetSet. r=heycam
MozReview-Commit-ID: IhgKAovTJMX
This commit is contained in:
parent
658075af32
commit
39e836966e
5 changed files with 117 additions and 22 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue