mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -36,18 +36,14 @@ impl StyleSheetList {
|
|||
impl StyleSheetListMethods for StyleSheetList {
|
||||
// https://drafts.csswg.org/cssom/#dom-stylesheetlist-length
|
||||
fn Length(&self) -> u32 {
|
||||
self.document.with_style_sheets_in_document(|s| s.len() as u32)
|
||||
self.document.stylesheet_count() as u32
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-stylesheetlist-item
|
||||
fn Item(&self, index: u32) -> Option<Root<StyleSheet>> {
|
||||
// XXXManishearth this doesn't handle the origin clean flag
|
||||
// and is a cors vulnerability
|
||||
self.document.with_style_sheets_in_document(|sheets| {
|
||||
sheets.get(index as usize)
|
||||
.and_then(|sheet| sheet.node.get_cssom_stylesheet())
|
||||
.map(Root::upcast)
|
||||
})
|
||||
// XXXManishearth this doesn't handle the origin clean flag and is a
|
||||
// cors vulnerability
|
||||
self.document.stylesheet_at(index as usize).map(Root::upcast)
|
||||
}
|
||||
|
||||
// check-tidy: no specs after this line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue