Title: [255490] trunk/Source/WebCore
Revision
255490
Author
[email protected]
Date
2020-01-31 03:15:50 -0800 (Fri, 31 Jan 2020)

Log Message

Regression(r255359): imported/mozilla/svg/svg-integration/clipPath-html-06.xhtml is failing consistently on windows
https://bugs.webkit.org/show_bug.cgi?id=206991
<rdar://problem/59030252>

Reviewed by Antoine Quint.

The previous approach may have still allowed RenderStyles computed with non-current FontCascade in
matched properties caches (because some non-font properties were resolved based on obsolete font information).

This patch takes a more robust approach by simply preventing caching of styles with non-current font.

* dom/Document.h:
(WebCore::Document::fontSelector const):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::isCurrent const):
* platform/graphics/FontCascade.h:
* style/MatchedDeclarationsCache.cpp:
(WebCore::Style::MatchedDeclarationsCache::isCacheable):
* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::updateFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (255489 => 255490)


--- trunk/Source/WebCore/ChangeLog	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/ChangeLog	2020-01-31 11:15:50 UTC (rev 255490)
@@ -1,3 +1,26 @@
+2020-01-31  Antti Koivisto  <[email protected]>
+
+        Regression(r255359): imported/mozilla/svg/svg-integration/clipPath-html-06.xhtml is failing consistently on windows
+        https://bugs.webkit.org/show_bug.cgi?id=206991
+        <rdar://problem/59030252>
+
+        Reviewed by Antoine Quint.
+
+        The previous approach may have still allowed RenderStyles computed with non-current FontCascade in
+        matched properties caches (because some non-font properties were resolved based on obsolete font information).
+
+        This patch takes a more robust approach by simply preventing caching of styles with non-current font.
+
+        * dom/Document.h:
+        (WebCore::Document::fontSelector const):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::isCurrent const):
+        * platform/graphics/FontCascade.h:
+        * style/MatchedDeclarationsCache.cpp:
+        (WebCore::Style::MatchedDeclarationsCache::isCacheable):
+        * style/StyleBuilderState.cpp:
+        (WebCore::Style::BuilderState::updateFont):
+
 2020-01-30  Antoine Quint  <[email protected]>
 
         [Web Animations] DocumentTimeline shouldn't suspend itself if hiddenPageCSSAnimationSuspensionEnabled is disabled

Modified: trunk/Source/WebCore/dom/Document.h (255489 => 255490)


--- trunk/Source/WebCore/dom/Document.h	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/dom/Document.h	2020-01-31 11:15:50 UTC (rev 255490)
@@ -541,6 +541,7 @@
     Style::Resolver& userAgentShadowTreeStyleResolver();
 
     CSSFontSelector& fontSelector() { return m_fontSelector; }
+    const CSSFontSelector& fontSelector() const { return m_fontSelector; }
 
     WEBCORE_EXPORT bool haveStylesheetsLoaded() const;
     bool isIgnoringPendingStylesheets() const { return m_ignorePendingStylesheets; }

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (255489 => 255490)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-01-31 11:15:50 UTC (rev 255490)
@@ -265,6 +265,18 @@
     return glyphs;
 }
 
+bool FontCascade::isCurrent(const FontSelector& fontSelector) const
+{
+    if (!m_fonts)
+        return false;
+    if (m_fonts->generation() != FontCache::singleton().generation())
+        return false;
+    if (m_fonts->fontSelectorVersion() != fontSelector.version())
+        return false;
+
+    return true;
+}
+
 void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const
 {
     m_fonts = retrieveOrAddCachedFonts(m_fontDescription, WTFMove(fontSelector));

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (255489 => 255490)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-01-31 11:15:50 UTC (rev 255490)
@@ -104,6 +104,7 @@
     int pixelSize() const { return fontDescription().computedPixelSize(); }
     float size() const { return fontDescription().computedSize(); }
 
+    bool isCurrent(const FontSelector&) const;
     WEBCORE_EXPORT void update(RefPtr<FontSelector>&& = nullptr) const;
 
     enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };

Modified: trunk/Source/WebCore/style/MatchedDeclarationsCache.cpp (255489 => 255490)


--- trunk/Source/WebCore/style/MatchedDeclarationsCache.cpp	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/style/MatchedDeclarationsCache.cpp	2020-01-31 11:15:50 UTC (rev 255490)
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "MatchedDeclarationsCache.h"
 
+#include "CSSFontSelector.h"
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
@@ -61,6 +62,14 @@
     if (style.hasExplicitlyInheritedProperties())
         return false;
 
+    // Getting computed style after a font environment change but before full style resolution may involve styles with non-current fonts.
+    // Avoid caching them.
+    auto& fontSelector = element.document().fontSelector();
+    if (!style.fontCascade().isCurrent(fontSelector))
+        return false;
+    if (!parentStyle.fontCascade().isCurrent(fontSelector))
+        return false;
+
     return true;
 }
 

Modified: trunk/Source/WebCore/style/StyleBuilderState.cpp (255489 => 255490)


--- trunk/Source/WebCore/style/StyleBuilderState.cpp	2020-01-31 10:20:12 UTC (rev 255489)
+++ trunk/Source/WebCore/style/StyleBuilderState.cpp	2020-01-31 11:15:50 UTC (rev 255490)
@@ -346,10 +346,6 @@
         auto* fonts = m_style.fontCascade().fonts();
         if (!fonts)
             return true;
-        if (fonts->generation() != FontCache::singleton().generation())
-            return true;
-        if (fonts->fontSelectorVersion() != fontSelector.version())
-            return true;
         return false;
     };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to