aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/rule_tree/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-03-13 10:26:37 -0400
committerGitHub <noreply@github.com>2019-03-13 10:26:37 -0400
commitd5fb0666d1102dd197e6ca478b3cf730397a7d38 (patch)
treeba85ff8131ef6889c3ae67e629d534d1f931e86f /components/style/rule_tree/mod.rs
parentc12e341c0ce9fcd8c3f71905b9b379af802bff04 (diff)
parentb42342a27381d644f5817eb4530252c4c142d4e9 (diff)
downloadservo-d5fb0666d1102dd197e6ca478b3cf730397a7d38.tar.gz
servo-d5fb0666d1102dd197e6ca478b3cf730397a7d38.zip
Auto merge of #23017 - emilio:gecko-sync, r=emilio
style: Sync changes from mozilla-central. See each individual commit for details. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23017) <!-- Reviewable:end -->
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 {