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};
12
12
use crate :: typing:: { Length , LengthType } ;
13
13
14
14
/// 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
+ ///
15
18
#[ derive( Debug , Clone , PartialEq ) ]
16
19
pub struct MediaQueryStatus < L : LengthNum > {
17
20
/// The viewport is a `screen` media type.
@@ -517,6 +520,20 @@ impl MatchedRuleList {
517
520
}
518
521
}
519
522
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
+
520
537
/// Find the style scope of the rule which contains the applied `animation-name` property.
521
538
///
522
539
/// This call is designed for the search of keyframes with style scopes.
You can’t perform that action at this time.
0 commit comments