mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
style: Replicate the list of stylesheets on the layout thread.
This is a patch that unifies a bit how Gecko and Stylo stylesheets work, in order to be able to eventually move the stylesheets into the stylist, and be able to incrementally update the invalidation map.
This commit is contained in:
parent
b8159e659e
commit
d1725b1f19
14 changed files with 413 additions and 198 deletions
|
@ -99,10 +99,10 @@ impl HTMLMetaElement {
|
|||
let content = content.value();
|
||||
if !content.is_empty() {
|
||||
if let Some(translated_rule) = ViewportRule::from_meta(&**content) {
|
||||
let document = self.upcast::<Node>().owner_doc();
|
||||
let document = document_from_node(self);
|
||||
let shared_lock = document.style_shared_lock();
|
||||
let rule = CssRule::Viewport(Arc::new(shared_lock.wrap(translated_rule)));
|
||||
*self.stylesheet.borrow_mut() = Some(Arc::new(Stylesheet {
|
||||
let sheet = Arc::new(Stylesheet {
|
||||
contents: StylesheetContents {
|
||||
rules: CssRules::new(vec![rule], shared_lock),
|
||||
origin: Origin::Author,
|
||||
|
@ -118,9 +118,9 @@ impl HTMLMetaElement {
|
|||
media: Arc::new(shared_lock.wrap(MediaList::empty())),
|
||||
shared_lock: shared_lock.clone(),
|
||||
disabled: AtomicBool::new(false),
|
||||
}));
|
||||
let doc = document_from_node(self);
|
||||
doc.invalidate_stylesheets();
|
||||
});
|
||||
*self.stylesheet.borrow_mut() = Some(sheet.clone());
|
||||
document.add_stylesheet(self.upcast(), sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,6 +199,10 @@ impl VirtualMethods for HTMLMetaElement {
|
|||
|
||||
if context.tree_in_doc {
|
||||
self.process_referrer_attribute();
|
||||
|
||||
if let Some(ref s) = *self.stylesheet.borrow() {
|
||||
document_from_node(self).remove_stylesheet(self.upcast(), s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue