Title: [111937] releases/WebKitGTK/webkit-1.8

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-03-24 00:25:20 UTC (rev 111937)
@@ -1,3 +1,15 @@
+2012-03-23  Antti Koivisto  <[email protected]>
+
+        REGRESSION (r104060): Web font is not loaded if specified by link element dynamically inserted
+        https://bugs.webkit.org/show_bug.cgi?id=79186
+
+        Reviewed by Andreas Kling.
+
+        * fast/css/font-face-insert-link-expected.txt: Added.
+        * fast/css/font-face-insert-link.html: Added.
+        * fast/css/resources/ahem.css: Added.
+        (@font-face):
+
 2012-03-23  Nikolas Zimmermann  <[email protected]>
 
         REGRESSION(58212): html foreignObjects with positions other than static not hidden correctly when parent has display:none

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link-expected.txt (0 => 111937)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link-expected.txt	2012-03-24 00:25:20 UTC (rev 111937)
@@ -0,0 +1,5 @@
+PASS window.getComputedStyle(a).width == window.getComputedStyle(b).width is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+TextText
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link.html (0 => 111937)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link.html	2012-03-24 00:25:20 UTC (rev 111937)
@@ -0,0 +1,39 @@
+<head>
+<script src=""
+<style>
+.test {
+  font-family: 'myahem';
+}
+#a, #b, #container { position:absolute; }
+#b { top: 20px }
+</style>
+</head>
+
+<div id=container>
+<div id=a>Text</div>
+<div id=b class="test">Text</div>
+</div>
+
+<script>
+jsTestIsAsync = true;
+
+window.setTimeout(
+  function() {
+    var link = document.createElement("link");
+    link.setAttribute("href", "resources/ahem.css");
+    link.setAttribute("rel", "stylesheet");
+    link.setAttribute("type", "text/css");
+    document.head.appendChild(link);
+    window.setTimeout(
+      function() {
+        var a = document.getElementById('a');
+        var b = document.getElementById('b');
+        shouldBeFalse('window.getComputedStyle(a).width == window.getComputedStyle(b).width');
+        finishJSTest();
+      },
+     500
+    );
+  },
+  1);
+</script>
+<script src=""
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/font-face-insert-link.html
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/resources/ahem.css (0 => 111937)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/resources/ahem.css	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/resources/ahem.css	2012-03-24 00:25:20 UTC (rev 111937)
@@ -0,0 +1,4 @@
+@font-face {
+    font-family: 'myahem';
+    src: url(../../../resources/Ahem.ttf);
+}
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/css/resources/ahem.css
___________________________________________________________________

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-03-24 00:25:20 UTC (rev 111937)
@@ -1,3 +1,38 @@
+2012-03-23  Antti Koivisto  <[email protected]>
+
+        REGRESSION (r104060): Web font is not loaded if specified by link element dynamically inserted
+        https://bugs.webkit.org/show_bug.cgi?id=79186
+
+        Reviewed by Andreas Kling.
+
+        Test: fast/css/font-face-insert-link.html
+        
+        If a dynamically inserted stylesheet contains @font-face rules, we may fail to update the rendering.
+        
+        Before r104060 the style selector was destroyed on every style change, and the font selector along with it.
+        This is no longer the case and we can't rely on comparing font selector pointers when comparing Fonts
+        for equality. This patch adds version number to the font selector and checks it in Font::operator==.
+        The version number is incremented when new font-face rules are added to the font selector.
+        
+        FontFallbackList is an object shared between Fonts so the extra field shouldn't matter much in terms
+        of memory.
+
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::CSSFontSelector):
+        (WebCore::CSSFontSelector::addFontFaceRule):
+        * css/CSSFontSelector.h:
+        (CSSFontSelector):
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::operator==):
+        * platform/graphics/FontFallbackList.cpp:
+        (WebCore::FontFallbackList::FontFallbackList):
+        (WebCore::FontFallbackList::invalidate):
+        * platform/graphics/FontFallbackList.h:
+        (FontFallbackList):
+        (WebCore::FontFallbackList::fontSelectorVersion):
+        * platform/graphics/FontSelector.h:
+        (FontSelector):
+
 2012-03-23  Nikolas Zimmermann  <[email protected]>
 
         REGRESSION(58212): html foreignObjects with positions other than static not hidden correctly when parent has display:none

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.cpp (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.cpp	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.cpp	2012-03-24 00:25:20 UTC (rev 111937)
@@ -63,6 +63,7 @@
 CSSFontSelector::CSSFontSelector(Document* document)
     : m_document(document)
     , m_beginLoadingTimer(this, &CSSFontSelector::beginLoadTimerFired)
+    , m_version(0)
 {
     // FIXME: An old comment used to say there was no need to hold a reference to m_document
     // because "we are guaranteed to be destroyed before the document". But there does not
@@ -309,6 +310,8 @@
         }
 
         familyFontFaces->append(fontFace);
+        
+        ++m_version;
     }
 }
 

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.h (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.h	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/css/CSSFontSelector.h	2012-03-24 00:25:20 UTC (rev 111937)
@@ -51,6 +51,8 @@
         return adoptRef(new CSSFontSelector(document));
     }
     virtual ~CSSFontSelector();
+    
+    virtual unsigned version() const OVERRIDE { return m_version; }
 
     virtual FontData* getFontData(const FontDescription& fontDescription, const AtomicString& familyName);
 
@@ -85,6 +87,8 @@
 
     Vector<CachedResourceHandle<CachedFont> > m_fontsToBeginLoading;
     Timer<CSSFontSelector> m_beginLoadingTimer;
+    
+    unsigned m_version;
 };
 
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/Font.cpp (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/Font.cpp	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/Font.cpp	2012-03-24 00:25:20 UTC (rev 111937)
@@ -120,11 +120,12 @@
     
     FontSelector* first = m_fontList ? m_fontList->fontSelector() : 0;
     FontSelector* second = other.m_fontList ? other.m_fontList->fontSelector() : 0;
-    
+
     return first == second
            && m_fontDescription == other.m_fontDescription
            && m_letterSpacing == other.m_letterSpacing
            && m_wordSpacing == other.m_wordSpacing
+           && (m_fontList ? m_fontList->fontSelectorVersion() : 0) == (other.m_fontList ? other.m_fontList->fontSelectorVersion() : 0)
            && (m_fontList ? m_fontList->generation() : 0) == (other.m_fontList ? other.m_fontList->generation() : 0);
 }
 

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.cpp (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.cpp	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.cpp	2012-03-24 00:25:20 UTC (rev 111937)
@@ -39,6 +39,7 @@
     : m_pageZero(0)
     , m_cachedPrimarySimpleFontData(0)
     , m_fontSelector(0)
+    , m_fontSelectorVersion(0)
     , m_familyIndex(0)
     , m_generation(fontCache()->generation())
     , m_pitch(UnknownPitch)
@@ -57,6 +58,7 @@
     m_pitch = UnknownPitch;
     m_loadingCustomFonts = false;
     m_fontSelector = fontSelector;
+    m_fontSelectorVersion = m_fontSelector ? m_fontSelector->version() : 0;
     m_generation = fontCache()->generation();
 }
 

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.h (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.h	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontFallbackList.h	2012-03-24 00:25:20 UTC (rev 111937)
@@ -51,6 +51,8 @@
     bool loadingCustomFonts() const { return m_loadingCustomFonts; }
 
     FontSelector* fontSelector() const { return m_fontSelector.get(); }
+    // FIXME: It should be possible to combine fontSelectorVersion and generation.
+    unsigned fontSelectorVersion() const { return m_fontSelectorVersion; }
     unsigned generation() const { return m_generation; }
 
     struct GlyphPagesHashTraits : HashTraits<int> {
@@ -87,6 +89,7 @@
     mutable GlyphPageTreeNode* m_pageZero;
     mutable const SimpleFontData* m_cachedPrimarySimpleFontData;
     RefPtr<FontSelector> m_fontSelector;
+    unsigned m_fontSelectorVersion;
     mutable int m_familyIndex;
     unsigned short m_generation;
     mutable unsigned m_pitch : 3; // Pitch

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontSelector.h (111936 => 111937)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontSelector.h	2012-03-24 00:24:10 UTC (rev 111936)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/FontSelector.h	2012-03-24 00:25:20 UTC (rev 111937)
@@ -44,6 +44,8 @@
 
     virtual void registerForInvalidationCallbacks(FontSelectorClient*) = 0;
     virtual void unregisterForInvalidationCallbacks(FontSelectorClient*) = 0;
+    
+    virtual unsigned version() const = 0;
 };
 
 class FontSelectorClient {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to