Title: [202104] trunk
Revision
202104
Author
an...@apple.com
Date
2016-06-15 13:52:14 -0700 (Wed, 15 Jun 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202103 => 202104)


--- trunk/LayoutTests/ChangeLog	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/LayoutTests/ChangeLog	2016-06-15 20:52:14 UTC (rev 202104)
@@ -1,3 +1,18 @@
+2016-06-15  Antti Koivisto  <an...@apple.com>
+
+        GoogleMaps transit schedule explorer comes up blank initially
+        https://bugs.webkit.org/show_bug.cgi?id=158803
+        rdar://problem/25818080
+
+        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:
+
 2016-06-15  Javier Fernandez  <jfernan...@igalia.com>
 
         [css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and zero available width

Modified: trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt (202103 => 202104)


--- trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt	2016-06-15 20:52:14 UTC (rev 202104)
@@ -159,6 +159,27 @@
 PASS testStyleChangeType("target", "InlineStyleChange") is true
 PASS testStyleChangeType("inert", "NoStyleChange") is true
 PASS hasExpectedStyle is true
+Setting attribute 'myattr3' value ''
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "NoStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Removing attribute 'myattr3'
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "NoStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Inserting stylesheet '[myattr3] target { color:rgb(12, 0, 0); }'
+Setting attribute 'myattr3' value ''
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "InlineStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Removing attribute 'myattr3'
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "InlineStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html (202103 => 202104)


--- trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html	2016-06-15 20:52:14 UTC (rev 202104)
@@ -50,6 +50,10 @@
     color: rgb(11, 0, 0);
 }
 
+[myattr3] notarget {
+    color: rgb(99, 0, 0);
+}
+
 </style>
 </head>
 <body>
@@ -259,6 +263,27 @@
 testStyleInvalidation("InlineStyleChange");
 checkStyle(11);
 
+setAttribute('myattr3', '');
+testStyleInvalidation("NoStyleChange");
+checkStyle(11);
+
+removeAttribute('myattr3');
+testStyleInvalidation("NoStyleChange");
+checkStyle(11);
+
+var dynamicSheet = document.createElement("style");
+dynamicSheet.innerHTML = "[myattr3] target { color:rgb(12, 0, 0); }"
+debug("Inserting stylesheet '" + dynamicSheet.innerHTML + "'");
+document.head.appendChild(dynamicSheet);
+
+setAttribute('myattr3', '');
+testStyleInvalidation("InlineStyleChange");
+checkStyle(12);
+
+removeAttribute('myattr3');
+testStyleInvalidation("InlineStyleChange");
+checkStyle(11);
+
 </script>
 <script src=""
 </html>

Modified: trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants-expected.txt (202103 => 202104)


--- trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants-expected.txt	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants-expected.txt	2016-06-15 20:52:14 UTC (rev 202104)
@@ -62,6 +62,27 @@
 PASS testStyleChangeType("target", "InlineStyleChange") is true
 PASS testStyleChangeType("inert", "NoStyleChange") is true
 PASS hasExpectedStyle is true
+Adding class dynamicStyle
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "NoStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Removing class dynamicStyle
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "NoStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Inserting stylesheet 'root.dynamicStyle target { color:rgb(6, 6, 6); }'
+Adding class dynamicStyle
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "InlineStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
+Removing class dynamicStyle
+PASS testStyleChangeType("root", "NoStyleChange") || testStyleChangeType("root", "InlineStyleChange") is true
+PASS testStyleChangeType("target", "InlineStyleChange") is true
+PASS testStyleChangeType("inert", "NoStyleChange") is true
+PASS hasExpectedStyle is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants.html (202103 => 202104)


--- trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants.html	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/LayoutTests/fast/css/style-invalidation-class-change-descendants.html	2016-06-15 20:52:14 UTC (rev 202104)
@@ -26,6 +26,10 @@
     color: rgb(5, 5, 5);
 }
 
+root.dynamicStyle notTarget {
+    color: rgb(99, 99, 99);
+}
+
 </style>
 </head>
 <body>
@@ -157,6 +161,27 @@
 testStyleInvalidation("InlineStyleChange");
 checkStyle(0);
 
+addClass('dynamicStyle');
+testStyleInvalidation("NoStyleChange");
+checkStyle(0);
+
+removeClass('dynamicStyle');
+testStyleInvalidation("NoStyleChange");
+checkStyle(0)
+
+var dynamicSheet = document.createElement("style");
+dynamicSheet.innerHTML = "root.dynamicStyle target { color:rgb(6, 6, 6); }"
+debug("Inserting stylesheet '" + dynamicSheet.innerHTML + "'");
+document.head.appendChild(dynamicSheet);
+
+addClass('dynamicStyle');
+testStyleInvalidation("InlineStyleChange");
+checkStyle(6);
+
+removeClass('dynamicStyle');
+testStyleInvalidation("InlineStyleChange");
+checkStyle(0)
+
 </script>
 <script src=""
 </html>

Modified: trunk/Source/WebCore/ChangeLog (202103 => 202104)


--- trunk/Source/WebCore/ChangeLog	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/Source/WebCore/ChangeLog	2016-06-15 20:52:14 UTC (rev 202104)
@@ -1,3 +1,28 @@
+2016-06-15  Antti Koivisto  <an...@apple.com>
+
+        GoogleMaps transit schedule explorer comes up blank initially
+        https://bugs.webkit.org/show_bug.cgi?id=158803
+        rdar://problem/25818080
+
+        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).
+
 2016-06-15  Javier Fernandez  <jfernan...@igalia.com>
 
         [css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and zero available width

Modified: trunk/Source/WebCore/css/DocumentRuleSets.cpp (202103 => 202104)


--- trunk/Source/WebCore/css/DocumentRuleSets.cpp	2016-06-15 20:48:45 UTC (rev 202103)
+++ trunk/Source/WebCore/css/DocumentRuleSets.cpp	2016-06-15 20:52:14 UTC (rev 202104)
@@ -114,6 +114,9 @@
 
     m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
     m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
+
+    m_ancestorClassRuleSets.clear();
+    m_ancestorAttributeRuleSetsForHTML.clear();
 }
 
 RuleSet* DocumentRuleSets::ancestorClassRules(AtomicStringImpl* className) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to