Chromium Code Reviews
DescriptionAllow using SelectorQuery fast paths in quirks mode and disconnected subtrees.
Previously there was a single global switch in the form of
SelectorQuery::CanUseFastQuery which controlled if we use any fast path
at all in querySelector. It was trying to enforce the rules for the
original id fast path though, and meant we were disabling all the other
fast paths (class, tagName) in quirks documents even though there's no
need to do that. It also meant we wouldn't use the id fast path inside
disconnected ShadowRoots.
This patch removes CanUseFastQuery() and replaces it with specific
checks for the id fast path, and stores the now static checks for the
other fast paths in a member variable use_slow_scan_.
This means shadowRoot or element.querySelector("#a") for an element in
a ShadowRoot is now O(1) even when the ShadowRoot is not connected to
the document. It also means we'll use the class and id fast paths in
quirks mode and also disconnected subtrees.
BUG=703900
Review-Url: https://codereview.chromium.org/2875673006
Cr-Commit-Position: refs/heads/master@{#471384}
Committed: https://chromium.googlesource.com/chromium/src/+/ad2bef1e6dd219c8b8e1fbe58b86a896550634c9
Patch Set 1 #
Messages
Total messages: 12 (8 generated)
|
|||||||||||||||||||||||||||||||||||||