Bug 72480 - CSSStyleSelector: refactor sorting of matched rules
Summary: CSSStyleSelector: refactor sorting of matched rules
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Roland Steiner
URL:
Keywords:
Depends on:
Blocks: 49142 67720
  Show dependency treegraph
 
Reported: 2011-11-16 00:58 PST by Roland Steiner
Modified: 2011-11-21 17:47 PST (History)
6 users (show)

See Also:


Attachments
Patch (6.91 KB, patch)
2011-11-16 02:04 PST, Roland Steiner
koivisto: review-
koivisto: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Steiner 2011-11-16 00:58:24 PST
In CSSStyleSelector, after rules are matched they are sorted according to specificity. This currently happens in 2 different places and thus should be refactored.

This will also help in the implementation of <style scoped> (see bug 67720).
Comment 1 Roland Steiner 2011-11-16 01:14:33 PST
:P Turns out, that code has changed since I worked on it (in unsavory ways, IMHO), so marking this as invalid.
Comment 2 Roland Steiner 2011-11-16 02:03:15 PST
Upon further thought, a refactoring may still make sense, esp. in view of <style scoped> later on. It just won't be quite as elegant anymore. :p
Comment 3 Roland Steiner 2011-11-16 02:04:26 PST
Created attachment 115349 [details]
Patch
Comment 4 Antti Koivisto 2011-11-16 05:02:40 PST
Comment on attachment 115349 [details]
Patch

This seems like a bad way to factor this. You are adding a function to share code but very little is actually used in the other case.
Comment 5 Roland Steiner 2011-11-16 17:46:20 PST
FWIW, I completely agree! :P Originally the function only took a collectRulesOnly parameter that was set to false for page rules. See the patch for 67720 for the original version. FWIW, no CSS test breaks with this, even with the link style twiddling added, but since matchPageRules bypasses the twiddling it felt dangerous to re-use that branch in the refactoring.
Comment 6 Roland Steiner 2011-11-21 17:47:33 PST
Given the code changes, this refactoring is probably meaningless without the context of the larger patch after all. Marking INVALID.