mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
Further changes required by Servo
This commit is contained in:
parent
6728158188
commit
68cbe6833d
4 changed files with 44 additions and 42 deletions
|
@ -209,6 +209,26 @@ pub struct Stylesheet {
|
|||
}
|
||||
|
||||
macro_rules! rule_filter {
|
||||
($( $method: ident($variant:ident => $rule_type: ident), )+) => {
|
||||
$(
|
||||
#[allow(missing_docs)]
|
||||
fn $method<F>(&self, device: &Device, guard: &SharedRwLockReadGuard, mut f: F)
|
||||
where F: FnMut(&crate::stylesheets::$rule_type),
|
||||
{
|
||||
use crate::stylesheets::CssRule;
|
||||
|
||||
for rule in self.effective_rules(device, guard) {
|
||||
if let CssRule::$variant(ref lock) = *rule {
|
||||
let rule = lock.read_with(guard);
|
||||
f(&rule)
|
||||
}
|
||||
}
|
||||
}
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! rule_filter_for_non_locked {
|
||||
($( $method: ident($variant:ident => $rule_type: ident), )+) => {
|
||||
$(
|
||||
#[allow(missing_docs)]
|
||||
|
@ -283,6 +303,9 @@ pub trait StylesheetInDocument: ::std::fmt::Debug {
|
|||
|
||||
rule_filter! {
|
||||
effective_font_face_rules(FontFace => FontFaceRule),
|
||||
}
|
||||
|
||||
rule_filter_for_non_locked! {
|
||||
effective_viewport_rules(Viewport => ViewportRule),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue