Auto merge of #19564 - emilio:push-applicable-simple, r=mbrubeck

style: Slightly simplify push_applicable_declarations.

<!-- 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/19564)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-12-15 11:28:16 -06:00 committed by GitHub
commit 90290cfafe

View file

@ -1226,7 +1226,10 @@ impl Stylist {
debug!("Determining if style is shareable: pseudo: {}", debug!("Determining if style is shareable: pseudo: {}",
pseudo_element.is_some()); pseudo_element.is_some());
let only_default_rules = rule_inclusion == RuleInclusion::DefaultOnly; let only_default_rules =
rule_inclusion == RuleInclusion::DefaultOnly;
let matches_user_and_author_rules =
rule_hash_target.matches_user_and_author_rules();
// Step 1: Normal user-agent rules. // Step 1: Normal user-agent rules.
if let Some(map) = self.cascade_data.user_agent.cascade_data.borrow_for_pseudo(pseudo_element) { if let Some(map) = self.cascade_data.user_agent.cascade_data.borrow_for_pseudo(pseudo_element) {
@ -1265,7 +1268,7 @@ impl Stylist {
// rule_hash_target.matches_user_and_author_rules()) // rule_hash_target.matches_user_and_author_rules())
// //
// Which may be more what you would probably expect. // Which may be more what you would probably expect.
if rule_hash_target.matches_user_and_author_rules() { if matches_user_and_author_rules {
// Step 3a: User normal rules. // Step 3a: User normal rules.
if let Some(map) = self.cascade_data.user.borrow_for_pseudo(pseudo_element) { if let Some(map) = self.cascade_data.user.borrow_for_pseudo(pseudo_element) {
map.get_all_matching_rules( map.get_all_matching_rules(
@ -1309,10 +1312,9 @@ impl Stylist {
} }
}); });
if rule_hash_target.matches_user_and_author_rules() && !only_default_rules { if matches_user_and_author_rules && !only_default_rules &&
// Gecko skips author normal rules if cutting off inheritance. !cut_off_inheritance
// See nsStyleSet::FileRules(). {
if !cut_off_inheritance {
// Step 3c: Author normal rules. // Step 3c: Author normal rules.
if let Some(map) = self.cascade_data.author.borrow_for_pseudo(pseudo_element) { if let Some(map) = self.cascade_data.author.borrow_for_pseudo(pseudo_element) {
map.get_all_matching_rules( map.get_all_matching_rules(
@ -1325,9 +1327,6 @@ impl Stylist {
CascadeLevel::AuthorNormal CascadeLevel::AuthorNormal
); );
} }
} else {
debug!("skipping author normal rules due to cut off inheritance");
}
} else { } else {
debug!("skipping author normal rules"); debug!("skipping author normal rules");
} }