mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Split collected @font-face / @counter-style rules per origin.
This commit is contained in:
parent
1877cac477
commit
57622004ce
4 changed files with 120 additions and 47 deletions
|
@ -4,10 +4,8 @@
|
|||
|
||||
//! Data needed to style a Gecko document.
|
||||
|
||||
use Atom;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use dom::TElement;
|
||||
use gecko::rules::{CounterStyleRule, FontFaceRule};
|
||||
use gecko_bindings::bindings::{self, RawServoStyleSet};
|
||||
use gecko_bindings::structs::{ServoStyleSheet, StyleSheetInfo, ServoStyleSheetInner};
|
||||
use gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||
|
@ -16,11 +14,10 @@ use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFF
|
|||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use media_queries::{Device, MediaList};
|
||||
use properties::ComputedValues;
|
||||
use selector_map::PrecomputedHashMap;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
||||
use stylesheet_set::StylesheetSet;
|
||||
use stylesheets::{Origin, StylesheetContents, StylesheetInDocument};
|
||||
use stylesheets::{StylesheetContents, StylesheetInDocument};
|
||||
use stylist::{ExtraStyleData, Stylist};
|
||||
|
||||
/// Little wrapper to a Gecko style sheet.
|
||||
|
@ -120,11 +117,8 @@ pub struct PerDocumentStyleDataImpl {
|
|||
/// List of stylesheets, mirrored from Gecko.
|
||||
pub stylesheets: StylesheetSet<GeckoStyleSheet>,
|
||||
|
||||
/// List of effective font face rules.
|
||||
pub font_faces: Vec<(Arc<Locked<FontFaceRule>>, Origin)>,
|
||||
|
||||
/// Map for effective counter style rules.
|
||||
pub counter_styles: PrecomputedHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
|
||||
/// List of effective @font-face and @counter-style rules.
|
||||
pub extra_style_data: ExtraStyleData,
|
||||
}
|
||||
|
||||
/// The data itself is an `AtomicRefCell`, which guarantees the proper semantics
|
||||
|
@ -142,8 +136,7 @@ impl PerDocumentStyleData {
|
|||
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
||||
stylist: Stylist::new(device, quirks_mode.into()),
|
||||
stylesheets: StylesheetSet::new(),
|
||||
font_faces: vec![],
|
||||
counter_styles: PrecomputedHashMap::default(),
|
||||
extra_style_data: Default::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -169,11 +162,6 @@ impl PerDocumentStyleDataImpl {
|
|||
return;
|
||||
}
|
||||
|
||||
let mut extra_data = ExtraStyleData {
|
||||
font_faces: &mut self.font_faces,
|
||||
counter_styles: &mut self.counter_styles,
|
||||
};
|
||||
|
||||
let author_style_disabled = self.stylesheets.author_style_disabled();
|
||||
self.stylist.clear();
|
||||
let iter = self.stylesheets.flush(document_element);
|
||||
|
@ -183,7 +171,7 @@ impl PerDocumentStyleDataImpl {
|
|||
/* ua_sheets = */ None,
|
||||
/* stylesheets_changed = */ true,
|
||||
author_style_disabled,
|
||||
&mut extra_data
|
||||
&mut self.extra_style_data,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue