mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
stylo: Fix StyleSheetInner/Stylesheet mapping
The key of this patch is the split between Stylesheet and StylesheetContents. Gecko will use StylesheetContents, which maps to a ServoStyleSheetInner.
This commit is contained in:
parent
fd65ac8924
commit
1263075776
38 changed files with 3818 additions and 2931 deletions
|
@ -27,6 +27,13 @@ use stylesheets::{NestedRuleIterationCondition, Stylesheet};
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct MediaListKey(usize);
|
||||
|
||||
impl MediaListKey {
|
||||
/// Create a MediaListKey from a raw usize.
|
||||
pub fn from_raw(k: usize) -> Self {
|
||||
MediaListKey(k)
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait to get a given `MediaListKey` for a given item that can hold a
|
||||
/// `MediaList`.
|
||||
pub trait ToMediaListKey : Sized {
|
||||
|
|
|
@ -15,7 +15,7 @@ use selector_parser::SelectorImpl;
|
|||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::parser::{Component, Selector};
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use stylesheets::{CssRule, Stylesheet};
|
||||
use stylesheets::{CssRule, StylesheetInDocument};
|
||||
use stylist::Stylist;
|
||||
|
||||
/// An invalidation scope represents a kind of subtree that may need to be
|
||||
|
@ -80,11 +80,14 @@ impl StylesheetInvalidationSet {
|
|||
/// Analyze the given stylesheet, and collect invalidations from their
|
||||
/// rules, in order to avoid doing a full restyle when we style the document
|
||||
/// next time.
|
||||
pub fn collect_invalidations_for(
|
||||
pub fn collect_invalidations_for<S>(
|
||||
&mut self,
|
||||
stylist: &Stylist,
|
||||
stylesheet: &Stylesheet,
|
||||
guard: &SharedRwLockReadGuard)
|
||||
stylesheet: &S,
|
||||
guard: &SharedRwLockReadGuard
|
||||
)
|
||||
where
|
||||
S: StylesheetInDocument,
|
||||
{
|
||||
debug!("StylesheetInvalidationSet::collect_invalidations_for");
|
||||
if self.fully_invalid {
|
||||
|
@ -92,7 +95,7 @@ impl StylesheetInvalidationSet {
|
|||
return;
|
||||
}
|
||||
|
||||
if stylesheet.disabled() ||
|
||||
if !stylesheet.enabled() ||
|
||||
!stylesheet.is_effective_for_device(stylist.device(), guard) {
|
||||
debug!(" > Stylesheet was not effective");
|
||||
return; // Nothing to do here.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue