mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Share CascadeData instances across ShadowRoots
This should be both a memory and speed win for pages using a lot of Shadow DOM. In order to make the cache properly work we need to start keying media query results on the actual StyleSheetContents, as that's what we share on Gecko, but that should all be fine. Differential Revision: https://phabricator.services.mozilla.com/D107266
This commit is contained in:
parent
11153c63fa
commit
060d74ba3b
11 changed files with 175 additions and 178 deletions
|
@ -8,7 +8,7 @@ use crate::context::QuirksMode;
|
|||
use crate::media_queries::Device;
|
||||
use crate::shared_lock::SharedRwLockReadGuard;
|
||||
use crate::stylesheets::{DocumentRule, ImportRule, MediaRule};
|
||||
use crate::stylesheets::{NestedRuleIterationCondition, Stylesheet, SupportsRule};
|
||||
use crate::stylesheets::{NestedRuleIterationCondition, StylesheetContents, SupportsRule};
|
||||
use fxhash::FxHashSet;
|
||||
|
||||
/// A key for a given media query result.
|
||||
|
@ -43,13 +43,13 @@ pub trait ToMediaListKey: Sized {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToMediaListKey for Stylesheet {}
|
||||
impl ToMediaListKey for StylesheetContents {}
|
||||
impl ToMediaListKey for ImportRule {}
|
||||
impl ToMediaListKey for MediaRule {}
|
||||
|
||||
/// A struct that holds the result of a media query evaluation pass for the
|
||||
/// media queries that evaluated successfully.
|
||||
#[derive(Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
pub struct EffectiveMediaQueryResults {
|
||||
/// The set of media lists that matched last time.
|
||||
set: FxHashSet<MediaListKey>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue