Currently flags like Document::usesSiblingRules() are set directly by the CSS parser. This is wrong as we may parse stylesheets that are not actually used for document rendering. This is especially bad when the page uses querySelectorAll(). As a result we may end up in various performance penalty boxes triggered by complex selectors for no good reason.
Created attachment 84410 [details] move figuring out the selector flags to CSSStyleSelector - Use the selector traversal in style selector constructor to figure out which flags actually are needed for the currently active style sheets. - Remove the flag related code from the CSS parser/grammar. - Remove the usesDescendantRules flag completely. We have descendant rules in the default style sheet, so every document uses them.
Comment on attachment 84410 [details] move figuring out the selector flags to CSSStyleSelector r=me
http://trac.webkit.org/changeset/80150