• rune@opera.com's avatar
    Implement proposed shadow tree cascade order. · 600e1412
    rune@opera.com authored
    This CL implements the shadow tree cascade order proposed in [1].
    
    Previously, in Blink, specificity would win over scope origin, even if the
    scopes had an inner/outer scope relationship, and the order-of-appearance
    was governed by the CascadeOrder type. Also, !important rules did not
    apply in the reverse scope order, as the current spec says for inner/outer
    scopes, and the proposal in [1] says apply between all shadow scopes.
    
    What has been done is:
    
    1. CascadeOrder is not used, as it represents order-of-appearance
       (Removal of CascadeOrder is not done here to make the CL smaller. Will
       be removed in a follow-up CL).
    
    2. When collecting rules, sort after each scope instead of just after UA
       and Author since we had:
    
       UA important
       Author important
       Author
       UA
    
       and now we have (with A(n) appearing before A(n+1) in the tree-of-trees
       order):
    
       UA important
       Author scope A(n) important
       ...
       Author scope A(1) important
       Author scope A(1)
       ...
       Author scope A(n)
       UA
    
       The applyProperties code is hot, and I have made performance runs for
       the micro-benchmarks in Layout and CSS without consistent regressions.
    
    3. Since the cascading order between scopes are just the inner/outer
       relationship in the composed tree (direction decided by !important),
       which is the same as the tree-of-trees order of the shadow trees,
       we can just traverse the DocumentOrderedList of scopes in the reverse
       order instead of doing calculation tricks for CascadeOrder values.
    
       Because of this, TreeBoundaryCrossingRules is now reduced to a
       DocumentOrderedList of scoping nodes, so the TreeBoundaryCrossingRules
       class is removed.
    
    [1] https://lists.w3.org/Archives/Public/www-style/2015Jun/0303.html
    
    BUG=452542, 455148, 487125
    
    NOTRY=true
    
    Review URL: https://codereview.chromium.org/1298173004
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@200994 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    600e1412
style-with-shadow-pseudo-element-expected.txt 2.24 KB