Title: [255656] branches/safari-610.1.1-branch/Source/WebCore
Revision
255656
Author
[email protected]
Date
2020-02-03 19:10:22 -0800 (Mon, 03 Feb 2020)

Log Message

Cherry-pick r255490. rdar://problem/58570085

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

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.1-branch/Source/WebCore/ChangeLog (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/ChangeLog	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/ChangeLog	2020-02-04 03:10:22 UTC (rev 255656)
@@ -1,5 +1,56 @@
 2020-02-03  Alan Coon  <[email protected]>
 
+        Cherry-pick r255490. rdar://problem/58570085
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-02-03  Alan Coon  <[email protected]>
+
         Cherry-pick r255489. rdar://problem/58815952
 
     [Web Animations] DocumentTimeline shouldn't suspend itself if hiddenPageCSSAnimationSuspensionEnabled is disabled

Modified: branches/safari-610.1.1-branch/Source/WebCore/dom/Document.h (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/dom/Document.h	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/dom/Document.h	2020-02-04 03:10:22 UTC (rev 255656)
@@ -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: branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.cpp (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2020-02-04 03:10:22 UTC (rev 255656)
@@ -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: branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.h (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.h	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/platform/graphics/FontCascade.h	2020-02-04 03:10:22 UTC (rev 255656)
@@ -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: branches/safari-610.1.1-branch/Source/WebCore/style/MatchedDeclarationsCache.cpp (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/style/MatchedDeclarationsCache.cpp	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/style/MatchedDeclarationsCache.cpp	2020-02-04 03:10:22 UTC (rev 255656)
@@ -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: branches/safari-610.1.1-branch/Source/WebCore/style/StyleBuilderState.cpp (255655 => 255656)


--- branches/safari-610.1.1-branch/Source/WebCore/style/StyleBuilderState.cpp	2020-02-04 03:10:19 UTC (rev 255655)
+++ branches/safari-610.1.1-branch/Source/WebCore/style/StyleBuilderState.cpp	2020-02-04 03:10:22 UTC (rev 255656)
@@ -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