style: List the matched rules with trace-level logging is enabled.

This commit is contained in:
Cameron McCormack 2017-05-19 17:39:15 +08:00 committed by Emilio Cobos Álvarez
parent 8b7a414b1c
commit c13be5cd13
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -16,6 +16,7 @@ use context::{CurrentElementInfo, SelectorFlagsMap, SharedStyleContext, StyleCon
use data::{ComputedStyle, ElementData, ElementStyles, RestyleData};
use dom::{AnimationRules, SendElement, TElement, TNode};
use font_metrics::FontMetricsProvider;
use log::LogLevel::Trace;
use properties::{CascadeFlags, ComputedValues, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, cascade};
use properties::longhands::display::computed_value as display;
use restyle_hints::{RESTYLE_CSS_ANIMATIONS, RESTYLE_CSS_TRANSITIONS, RestyleHint};
@ -1163,10 +1164,22 @@ pub trait MatchMethods : TElement {
&mut applicable_declarations,
&context.shared.guards);
let important_rules_changed = self.has_animations() &&
data.has_styles() &&
data.important_rules_are_different(&primary_rule_node,
&context.shared.guards);
if log_enabled!(Trace) {
trace!("Matched rules:");
for rn in primary_rule_node.self_and_ancestors() {
if let Some(source) = rn.style_source() {
trace!(" > {:?}", source);
}
}
}
let important_rules_changed =
self.has_animations() &&
data.has_styles() &&
data.important_rules_are_different(
&primary_rule_node,
&context.shared.guards
);
RulesMatchedResult {
rule_nodes_changed: data.set_primary_rules(primary_rule_node),