servo: Merge #19429 - Don't try to share style on quirks mode whenever two elements have different id (from upsuper:sharing-quirks-id); r=emilio a=gchang
authorXidorn Quan <me@upsuper.org>
Thu, 30 Nov 2017 08:23:07 -0600
changeset 445131 306f3de7c409ab29dd5c3c14b32a643b5e567b3a
parent 445130 810f9fabc68483d081ad8fbaa7a648e2f49fbb7a
child 445132 9b41fc04fab1a5f5670a324fd48ec03ccc0c6e24
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, gchang
bugs1420946
milestone58.0
servo: Merge #19429 - Don't try to share style on quirks mode whenever two elements have different id (from upsuper:sharing-quirks-id); r=emilio a=gchang This fixes [bug 1420946](https://bugzilla.mozilla.org/show_bug.cgi?id=1420946). Source-Repo: https://github.com/servo/servo Source-Revision: fce44a2e139478a5fc3524c2fd72fbeea6e3eec1
servo/components/style/stylist.rs
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -21,17 +21,17 @@ use malloc_size_of::{MallocShallowSizeOf
 use malloc_size_of::MallocUnconditionalShallowSizeOf;
 use media_queries::Device;
 use properties::{self, CascadeFlags, ComputedValues};
 use properties::{AnimationRules, PropertyDeclarationBlock};
 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;
 use selectors::parser::{AncestorHashes, Combinator, Component, Selector};
 use selectors::parser::{SelectorIter, SelectorMethods};
 use selectors::sink::Push;
 use selectors::visitor::SelectorVisitor;
 use servo_arc::{Arc, ArcBorrow};
@@ -1408,16 +1408,23 @@ impl Stylist {
     pub fn may_have_rules_for_id<E>(
         &self,
         id: &Atom,
         element: E,
     ) -> bool
     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) {
                 return true;
             }
         }
 
         let mut xbl_rules_may_contain = false;