Skip to content

Commit

Permalink
Auto merge of #19429 - upsuper:sharing-quirks-id, r=emilio
Browse files Browse the repository at this point in the history
Don't try to share style on quirks mode whenever two elements have different id

This fixes [bug 1420946](https://bugzilla.mozilla.org/show_bug.cgi?id=1420946).

<!-- 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/19429)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Nov 30, 2017
2 parents 3b78cf1 + af8026a commit fce44a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/style/stylist.rs
Expand Up @@ -26,7 +26,7 @@ use rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
use selector_map::{PrecomputedHashMap, SelectorMap, SelectorMapEntry};
use selector_parser::{SelectorImpl, PerPseudoElementMap, PseudoElement};
use selectors::NthIndexCache;
use selectors::attr::NamespaceConstraint;
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use selectors::bloom::{BloomFilter, NonCountingBloomFilter};
use selectors::matching::{ElementSelectorFlags, matches_selector, MatchingContext, MatchingMode};
use selectors::matching::VisitedHandlingMode;
Expand Down Expand Up @@ -1405,6 +1405,13 @@ impl Stylist {
where
E: TElement,
{
// If id needs to be compared case-insensitively, the logic below
// wouldn't work. Just conservatively assume it may have such rules.
match self.quirks_mode().classes_and_ids_case_sensitivity() {
CaseSensitivity::AsciiCaseInsensitive => return true,
CaseSensitivity::CaseSensitive => {}
}

let hash = id.get_hash();
for (data, _) in self.cascade_data.iter_origins() {
if data.mapped_ids.might_contain_hash(hash) {
Expand Down

0 comments on commit fce44a2

Please sign in to comment.