mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
CSSOM: Add Arc<RwLock<_>> around Stylesheet.media
This commit is contained in:
parent
cc06363ce7
commit
8eeaef5b1c
1 changed files with 4 additions and 4 deletions
|
@ -57,7 +57,7 @@ pub struct Stylesheet {
|
||||||
/// cascading order)
|
/// cascading order)
|
||||||
pub rules: CssRules,
|
pub rules: CssRules,
|
||||||
/// List of media associated with the Stylesheet.
|
/// List of media associated with the Stylesheet.
|
||||||
pub media: MediaList,
|
pub media: Arc<RwLock<MediaList>>,
|
||||||
pub origin: Origin,
|
pub origin: Origin,
|
||||||
pub dirty_on_viewport_size_change: bool,
|
pub dirty_on_viewport_size_change: bool,
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ impl Stylesheet {
|
||||||
Stylesheet {
|
Stylesheet {
|
||||||
origin: origin,
|
origin: origin,
|
||||||
rules: rules.into(),
|
rules: rules.into(),
|
||||||
media: Default::default(),
|
media: Arc::new(RwLock::new(Default::default())),
|
||||||
dirty_on_viewport_size_change:
|
dirty_on_viewport_size_change:
|
||||||
input.seen_viewport_percentages(),
|
input.seen_viewport_percentages(),
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ impl Stylesheet {
|
||||||
|
|
||||||
/// Set the MediaList associated with the style-sheet.
|
/// Set the MediaList associated with the style-sheet.
|
||||||
pub fn set_media(&mut self, media: MediaList) {
|
pub fn set_media(&mut self, media: MediaList) {
|
||||||
self.media = media;
|
*self.media.write() = media;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether the style-sheet applies for the current device depending
|
/// Returns whether the style-sheet applies for the current device depending
|
||||||
|
@ -244,7 +244,7 @@ impl Stylesheet {
|
||||||
///
|
///
|
||||||
/// Always true if no associated MediaList exists.
|
/// Always true if no associated MediaList exists.
|
||||||
pub fn is_effective_for_device(&self, device: &Device) -> bool {
|
pub fn is_effective_for_device(&self, device: &Device) -> bool {
|
||||||
self.media.evaluate(device)
|
self.media.read().evaluate(device)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the effective rules within the style-sheet, as
|
/// Return an iterator over the effective rules within the style-sheet, as
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue