Changeset 202104 in webkit


Ignore:
Timestamp:
Jun 15, 2016 1:52:14 PM (8 years ago)
Author:
Antti Koivisto
Message:

GoogleMaps transit schedule explorer comes up blank initially
https://bugs.webkit.org/show_bug.cgi?id=158803
rdar://problem/25818080

Source/WebCore:

Reviewed by Andreas Kling.

In case we had something like

.foo bar { ... }

and later a new stylesheet was added dynamically that contained

.foo baz { ... }

we would fail to add the new rules to the descendant invalidation rule sets for ".foo". This could
cause some style invalidations to be missed.

  • css/DocumentRuleSets.cpp:

(WebCore::DocumentRuleSets::collectFeatures):

Reset the ancestorClassRules and ancestorAttributeRulesForHTML rule set caches when new style sheets
are added (==collectFeatures is called).

LayoutTests:

Reviewed by Andreas Kling

Expand the tests to cover this case.

  • fast/css/style-invalidation-attribute-change-descendants-expected.txt:
  • fast/css/style-invalidation-attribute-change-descendants.html:
  • fast/css/style-invalidation-class-change-descendants-expected.txt:
  • fast/css/style-invalidation-class-change-descendants.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202103 r202104  
     12016-06-15  Antti Koivisto  <antti@apple.com>
     2
     3        GoogleMaps transit schedule explorer comes up blank initially
     4        https://bugs.webkit.org/show_bug.cgi?id=158803
     5        rdar://problem/25818080
     6
     7        Reviewed by Andreas Kling
     8
     9        Expand the tests to cover this case.
     10
     11        * fast/css/style-invalidation-attribute-change-descendants-expected.txt:
     12        * fast/css/style-invalidation-attribute-change-descendants.html:
     13        * fast/css/style-invalidation-class-change-descendants-expected.txt:
     14        * fast/css/style-invalidation-class-change-descendants.html:
     15
    1162016-06-15  Javier Fernandez  <jfernandez@igalia.com>
    217
  • trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt

    r199099 r202104  
    160160PASS testStyleChangeType("inert", "NoStyleChange") is true
    161161PASS hasExpectedStyle is true
     162Setting attribute 'myattr3' value ''
     163PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     164PASS testStyleChangeType("target", "NoStyleChange") is true
     165PASS testStyleChangeType("inert", "NoStyleChange") is true
     166PASS hasExpectedStyle is true
     167Removing attribute 'myattr3'
     168PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     169PASS testStyleChangeType("target", "NoStyleChange") is true
     170PASS testStyleChangeType("inert", "NoStyleChange") is true
     171PASS hasExpectedStyle is true
     172Inserting stylesheet '[myattr3] target { color:rgb(12, 0, 0); }'
     173Setting attribute 'myattr3' value ''
     174PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     175PASS testStyleChangeType("target", "InlineStyleChange") is true
     176PASS testStyleChangeType("inert", "NoStyleChange") is true
     177PASS hasExpectedStyle is true
     178Removing attribute 'myattr3'
     179PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     180PASS testStyleChangeType("target", "InlineStyleChange") is true
     181PASS testStyleChangeType("inert", "NoStyleChange") is true
     182PASS hasExpectedStyle is true
    162183PASS successfullyParsed is true
    163184
  • trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html

    r199099 r202104  
    4949[myattr=value11] target {
    5050    color: rgb(11, 0, 0);
     51}
     52
     53[myattr3] notarget {
     54    color: rgb(99, 0, 0);
    5155}
    5256
     
    260264checkStyle(11);
    261265
     266setAttribute('myattr3', '');
     267testStyleInvalidation("NoStyleChange");
     268checkStyle(11);
     269
     270removeAttribute('myattr3');
     271testStyleInvalidation("NoStyleChange");
     272checkStyle(11);
     273
     274var dynamicSheet = document.createElement("style");
     275dynamicSheet.innerHTML = "[myattr3] target { color:rgb(12, 0, 0); }"
     276debug("Inserting stylesheet '" + dynamicSheet.innerHTML + "'");
     277document.head.appendChild(dynamicSheet);
     278
     279setAttribute('myattr3', '');
     280testStyleInvalidation("InlineStyleChange");
     281checkStyle(12);
     282
     283removeAttribute('myattr3');
     284testStyleInvalidation("InlineStyleChange");
     285checkStyle(11);
     286
    262287</script>
    263288<script src="../../resources/js-test-post.js"></script>
  • trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants-expected.txt

    r198216 r202104  
    6363PASS testStyleChangeType("inert", "NoStyleChange") is true
    6464PASS hasExpectedStyle is true
     65Adding class dynamicStyle
     66PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     67PASS testStyleChangeType("target", "NoStyleChange") is true
     68PASS testStyleChangeType("inert", "NoStyleChange") is true
     69PASS hasExpectedStyle is true
     70Removing class dynamicStyle
     71PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     72PASS testStyleChangeType("target", "NoStyleChange") is true
     73PASS testStyleChangeType("inert", "NoStyleChange") is true
     74PASS hasExpectedStyle is true
     75Inserting stylesheet 'root.dynamicStyle target { color:rgb(6, 6, 6); }'
     76Adding class dynamicStyle
     77PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     78PASS testStyleChangeType("target", "InlineStyleChange") is true
     79PASS testStyleChangeType("inert", "NoStyleChange") is true
     80PASS hasExpectedStyle is true
     81Removing class dynamicStyle
     82PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
     83PASS testStyleChangeType("target", "InlineStyleChange") is true
     84PASS testStyleChangeType("inert", "NoStyleChange") is true
     85PASS hasExpectedStyle is true
    6586PASS successfullyParsed is true
    6687
  • trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants.html

    r198216 r202104  
    2525root:not(.style5) target {
    2626    color: rgb(5, 5, 5);
     27}
     28
     29root.dynamicStyle notTarget {
     30    color: rgb(99, 99, 99);
    2731}
    2832
     
    158162checkStyle(0);
    159163
     164addClass('dynamicStyle');
     165testStyleInvalidation("NoStyleChange");
     166checkStyle(0);
     167
     168removeClass('dynamicStyle');
     169testStyleInvalidation("NoStyleChange");
     170checkStyle(0)
     171
     172var dynamicSheet = document.createElement("style");
     173dynamicSheet.innerHTML = "root.dynamicStyle target { color:rgb(6, 6, 6); }"
     174debug("Inserting stylesheet '" + dynamicSheet.innerHTML + "'");
     175document.head.appendChild(dynamicSheet);
     176
     177addClass('dynamicStyle');
     178testStyleInvalidation("InlineStyleChange");
     179checkStyle(6);
     180
     181removeClass('dynamicStyle');
     182testStyleInvalidation("InlineStyleChange");
     183checkStyle(0)
     184
    160185</script>
    161186<script src="../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r202103 r202104  
     12016-06-15  Antti Koivisto  <antti@apple.com>
     2
     3        GoogleMaps transit schedule explorer comes up blank initially
     4        https://bugs.webkit.org/show_bug.cgi?id=158803
     5        rdar://problem/25818080
     6
     7        Reviewed by Andreas Kling.
     8
     9        In case we had something like
     10
     11        .foo bar { ... }
     12
     13        and later a new stylesheet was added dynamically that contained
     14
     15        .foo baz { ... }
     16
     17        we would fail to add the new rules to the descendant invalidation rule sets for ".foo". This could
     18        cause some style invalidations to be missed.
     19
     20        * css/DocumentRuleSets.cpp:
     21        (WebCore::DocumentRuleSets::collectFeatures):
     22
     23        Reset the ancestorClassRules and ancestorAttributeRulesForHTML rule set caches when new style sheets
     24        are added (==collectFeatures is called).
     25
    1262016-06-15  Javier Fernandez  <jfernandez@igalia.com>
    227
  • trunk/Source/WebCore/css/DocumentRuleSets.cpp

    r201441 r202104  
    115115    m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
    116116    m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
     117
     118    m_ancestorClassRuleSets.clear();
     119    m_ancestorAttributeRuleSetsForHTML.clear();
    117120}
    118121
Note: See TracChangeset for help on using the changeset viewer.