Skip to content

Commit c13be5c

Browse files
heycamemilio
authored andcommitted
style: List the matched rules with trace-level logging is enabled.
1 parent 8b7a414 commit c13be5c

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

components/style/matching.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use context::{CurrentElementInfo, SelectorFlagsMap, SharedStyleContext, StyleCon
1616
use data::{ComputedStyle, ElementData, ElementStyles, RestyleData};
1717
use dom::{AnimationRules, SendElement, TElement, TNode};
1818
use font_metrics::FontMetricsProvider;
19+
use log::LogLevel::Trace;
1920
use properties::{CascadeFlags, ComputedValues, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, cascade};
2021
use properties::longhands::display::computed_value as display;
2122
use restyle_hints::{RESTYLE_CSS_ANIMATIONS, RESTYLE_CSS_TRANSITIONS, RestyleHint};
@@ -1163,10 +1164,22 @@ pub trait MatchMethods : TElement {
11631164
&mut applicable_declarations,
11641165
&context.shared.guards);
11651166

1166-
let important_rules_changed = self.has_animations() &&
1167-
data.has_styles() &&
1168-
data.important_rules_are_different(&primary_rule_node,
1169-
&context.shared.guards);
1167+
if log_enabled!(Trace) {
1168+
trace!("Matched rules:");
1169+
for rn in primary_rule_node.self_and_ancestors() {
1170+
if let Some(source) = rn.style_source() {
1171+
trace!(" > {:?}", source);
1172+
}
1173+
}
1174+
}
1175+
1176+
let important_rules_changed =
1177+
self.has_animations() &&
1178+
data.has_styles() &&
1179+
data.important_rules_are_different(
1180+
&primary_rule_node,
1181+
&context.shared.guards
1182+
);
11701183

11711184
RulesMatchedResult {
11721185
rule_nodes_changed: data.set_primary_rules(primary_rule_node),

0 commit comments

Comments
 (0)