Title: [253633] trunk
Revision
253633
Author
[email protected]
Date
2019-12-17 11:19:48 -0800 (Tue, 17 Dec 2019)

Log Message

REGRESSION: ASSERTION FAILED: FontCache::singleton().generation() == m_generation
https://bugs.webkit.org/show_bug.cgi?id=204933
<rdar://problem/57458432>

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/shadow-dom/font-cache-invalidation.html

When font cache version number is bumped we need to invalidate matches declarations caches because
they may now contain stale font references. The code to do this failed to look into shadow trees.

* dom/Document.cpp:
(WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
* style/StyleScope.cpp:
(WebCore::Style::Scope::invalidateMatchedDeclarationsCache):

Also invalidate the shadow trees.

* style/StyleScope.h:

LayoutTests:

* fast/shadow-dom/font-cache-invalidation-expected.txt: Added.
* fast/shadow-dom/font-cache-invalidation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (253632 => 253633)


--- trunk/LayoutTests/ChangeLog	2019-12-17 18:58:42 UTC (rev 253632)
+++ trunk/LayoutTests/ChangeLog	2019-12-17 19:19:48 UTC (rev 253633)
@@ -1,3 +1,14 @@
+2019-12-17  Antti Koivisto  <[email protected]>
+
+        REGRESSION: ASSERTION FAILED: FontCache::singleton().generation() == m_generation
+        https://bugs.webkit.org/show_bug.cgi?id=204933
+        <rdar://problem/57458432>
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/shadow-dom/font-cache-invalidation-expected.txt: Added.
+        * fast/shadow-dom/font-cache-invalidation.html: Added.
+
 2019-12-17  Chris Dumez  <[email protected]>
 
         Re-sync web-platform-tests/resources from upstream

Added: trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation-expected.txt (0 => 253633)


--- trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation-expected.txt	2019-12-17 19:19:48 UTC (rev 253633)
@@ -0,0 +1 @@
+This test passes if it doesn't hit assert. 

Added: trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation.html (0 => 253633)


--- trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/font-cache-invalidation.html	2019-12-17 19:19:48 UTC (rev 253633)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+This test passes if it doesn't hit assert.
+<input type="color" id=colorinput>
+<script>
+colorinput.offsetWidth;
+</script>
+<style>
+#colorinput { width: 200px; }
+</style>
+<script>
+if (window.internals)
+    internals.invalidateFontCache();
+
+colorinput.offsetWidth;
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (253632 => 253633)


--- trunk/Source/WebCore/ChangeLog	2019-12-17 18:58:42 UTC (rev 253632)
+++ trunk/Source/WebCore/ChangeLog	2019-12-17 19:19:48 UTC (rev 253633)
@@ -1,3 +1,25 @@
+2019-12-17  Antti Koivisto  <[email protected]>
+
+        REGRESSION: ASSERTION FAILED: FontCache::singleton().generation() == m_generation
+        https://bugs.webkit.org/show_bug.cgi?id=204933
+        <rdar://problem/57458432>
+
+        Reviewed by Zalan Bujtas.
+
+        Test: fast/shadow-dom/font-cache-invalidation.html
+
+        When font cache version number is bumped we need to invalidate matches declarations caches because
+        they may now contain stale font references. The code to do this failed to look into shadow trees.
+
+        * dom/Document.cpp:
+        (WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::invalidateMatchedDeclarationsCache):
+
+        Also invalidate the shadow trees.
+
+        * style/StyleScope.h:
+
 2019-12-17  Zalan Bujtas  <[email protected]>
 
         [LFC][Painting] Add basic support for z-index based painting

Modified: trunk/Source/WebCore/dom/Document.cpp (253632 => 253633)


--- trunk/Source/WebCore/dom/Document.cpp	2019-12-17 18:58:42 UTC (rev 253632)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-12-17 19:19:48 UTC (rev 253633)
@@ -2309,8 +2309,8 @@
 
 void Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc()
 {
-    if (auto* resolver = styleScope().resolverIfExists())
-        resolver->invalidateMatchedDeclarationsCache();
+    styleScope().invalidateMatchedDeclarationsCache();
+
     if (backForwardCacheState() != NotInBackForwardCache || !renderView())
         return;
     scheduleFullStyleRebuild();

Modified: trunk/Source/WebCore/style/StyleScope.cpp (253632 => 253633)


--- trunk/Source/WebCore/style/StyleScope.cpp	2019-12-17 18:58:42 UTC (rev 253632)
+++ trunk/Source/WebCore/style/StyleScope.cpp	2019-12-17 19:19:48 UTC (rev 253633)
@@ -691,6 +691,18 @@
     scheduleUpdate(UpdateType::ContentsOrInterpretation);
 }
 
+void Scope::invalidateMatchedDeclarationsCache()
+{
+    if (!m_shadowRoot) {
+        for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
+            descendantShadowRoot->styleScope().invalidateMatchedDeclarationsCache();
+    }
+
+    if (auto* resolver = resolverIfExists())
+        resolver->invalidateMatchedDeclarationsCache();
+}
+
+
 void Scope::pendingUpdateTimerFired()
 {
     flushPendingUpdate();

Modified: trunk/Source/WebCore/style/StyleScope.h (253632 => 253633)


--- trunk/Source/WebCore/style/StyleScope.h	2019-12-17 18:58:42 UTC (rev 253632)
+++ trunk/Source/WebCore/style/StyleScope.h	2019-12-17 19:19:48 UTC (rev 253633)
@@ -108,6 +108,8 @@
     // The change is assumed to potentially affect all author and user stylesheets including shadow roots.
     WEBCORE_EXPORT void didChangeStyleSheetEnvironment();
 
+    void invalidateMatchedDeclarationsCache();
+
     bool hasPendingUpdate() const { return m_pendingUpdate || m_hasDescendantWithPendingUpdate; }
     void flushPendingUpdate();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to