aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/rule_tree/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/rule_tree/mod.rs')
-rw-r--r--components/style/rule_tree/mod.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs
index a2caba6f9f7..f165e1f455f 100644
--- a/components/style/rule_tree/mod.rs
+++ b/components/style/rule_tree/mod.rs
@@ -11,7 +11,7 @@ use crate::applicable_declarations::ApplicableDeclarationList;
use crate::gecko::selector_parser::PseudoElement;
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
-use crate::stylesheets::StyleRule;
+use crate::stylesheets::{Origin, StyleRule};
use crate::thread_state;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@@ -659,6 +659,25 @@ impl CascadeLevel {
}
}
+ /// Returns the cascade origin of the rule.
+ #[inline]
+ pub fn origin(&self) -> Origin {
+ match *self {
+ CascadeLevel::UAImportant | CascadeLevel::UANormal => Origin::UserAgent,
+ CascadeLevel::UserImportant | CascadeLevel::UserNormal => Origin::User,
+ CascadeLevel::PresHints |
+ CascadeLevel::InnerShadowNormal |
+ CascadeLevel::SameTreeAuthorNormal |
+ CascadeLevel::StyleAttributeNormal |
+ CascadeLevel::SMILOverride |
+ CascadeLevel::Animations |
+ CascadeLevel::SameTreeAuthorImportant |
+ CascadeLevel::StyleAttributeImportant |
+ CascadeLevel::InnerShadowImportant |
+ CascadeLevel::Transitions => Origin::Author,
+ }
+ }
+
/// Returns whether this cascade level represents an animation rules.
#[inline]
pub fn is_animation(&self) -> bool {