aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/shared_lock.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/shared_lock.rs')
-rw-r--r--components/style/shared_lock.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs
index d4d66b8fc5d..c92ab9efccf 100644
--- a/components/style/shared_lock.rs
+++ b/components/style/shared_lock.rs
@@ -177,3 +177,23 @@ pub trait ToCssWithGuard {
s
}
}
+
+/// Guards for a document
+#[derive(Clone)]
+pub struct ReadGuards<'a> {
+ /// For author-origin stylesheets
+ pub author: &'a SharedRwLockReadGuard<'a>,
+
+ /// For user-agent-origin and user-origin stylesheets
+ pub ua_or_user: &'a SharedRwLockReadGuard<'a>,
+}
+
+impl<'a> ReadGuards<'a> {
+ /// Same guard for all origins
+ pub fn same(guard: &'a SharedRwLockReadGuard<'a>) -> Self {
+ ReadGuards {
+ author: guard,
+ ua_or_user: guard,
+ }
+ }
+}