File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ use crate::sheet::{RuleWeight, Theme};
1212use crate :: typing:: { Length , LengthType } ;
1313
1414/// The status of media query, i.e. screen size, screen type, etc.
15+ ///
16+ /// This also contains some global environment values, such as `env(...)` values in CSS.
17+ ///
1518#[ derive( Debug , Clone , PartialEq ) ]
1619pub struct MediaQueryStatus < L : LengthNum > {
1720 /// The viewport is a `screen` media type.
@@ -517,6 +520,20 @@ impl MatchedRuleList {
517520 }
518521 }
519522
523+ /// Iterate properties with weights.
524+ pub fn for_each_property ( & self , mut f : impl FnMut ( & Property , u64 ) ) {
525+ for matched_rule in self . rules . iter ( ) {
526+ let weight = matched_rule. weight ;
527+ for pm in matched_rule. rule . properties . iter ( ) {
528+ if pm. is_disabled ( ) { continue }
529+ let w = if pm. is_important ( ) { weight. important ( ) } else { weight. normal ( ) } ;
530+ for p in pm. iter ( ) {
531+ f ( p, w) ;
532+ }
533+ }
534+ }
535+ }
536+
520537 /// Find the style scope of the rule which contains the applied `animation-name` property.
521538 ///
522539 /// This call is designed for the search of keyframes with style scopes.
You can’t perform that action at this time.
0 commit comments