Title: [110642] trunk
Revision
110642
Author
[email protected]
Date
2012-03-13 16:57:32 -0700 (Tue, 13 Mar 2012)

Log Message

<rdar://problem/11025217> [Mac] Assertion failure in collectComplexTextRunsForCharactersCoreText
https://bugs.webkit.org/show_bug.cgi?id=77044

Reviewed by Sam Weinig.

Source/WebCore: 

Test: platform/mac/fast/text/core-text-fallback-to-unknown-font.html

Handle the case of Core Text choosing a fallback font that NSFontManager cannot find by name.

* platform/graphics/FontCache.h:
(FontCache): Made ComplexTextController a friend class.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Removed the
failing assertion, which was not true, and added code to handle the case where a font
cannot be found by name by using the font as returned from Core Text.

LayoutTests: 

* platform/mac/fast/text/core-text-fallback-to-unknown-font-expected.txt: Added.
* platform/mac/fast/text/core-text-fallback-to-unknown-font.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110641 => 110642)


--- trunk/LayoutTests/ChangeLog	2012-03-13 23:56:45 UTC (rev 110641)
+++ trunk/LayoutTests/ChangeLog	2012-03-13 23:57:32 UTC (rev 110642)
@@ -1,3 +1,13 @@
+2012-03-13  Dan Bernstein  <[email protected]>
+
+        <rdar://problem/11025217> [Mac] Assertion failure in collectComplexTextRunsForCharactersCoreText
+        https://bugs.webkit.org/show_bug.cgi?id=77044
+
+        Reviewed by Sam Weinig.
+
+        * platform/mac/fast/text/core-text-fallback-to-unknown-font-expected.txt: Added.
+        * platform/mac/fast/text/core-text-fallback-to-unknown-font.html: Added.
+
 2012-03-13  Erik Arvidsson  <[email protected]>
 
         [V8] Use v8::V8::AddImplicitReferences instead of SetHiddenValue

Added: trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font-expected.txt (0 => 110642)


--- trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font-expected.txt	2012-03-13 23:57:32 UTC (rev 110642)
@@ -0,0 +1,3 @@
+This test passes if it does not cause an assertion failure or a crash.
+
+◌̣

Added: trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font.html (0 => 110642)


--- trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/core-text-fallback-to-unknown-font.html	2012-03-13 23:57:32 UTC (rev 110642)
@@ -0,0 +1,8 @@
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+</script>
+<p>
+    This test passes if it does not cause an assertion failure or a crash.
+</p>
+<span style="font-weight: bold; font-family: helvetica">&#x25cc;&#x0323;</span>

Modified: trunk/Source/WebCore/ChangeLog (110641 => 110642)


--- trunk/Source/WebCore/ChangeLog	2012-03-13 23:56:45 UTC (rev 110641)
+++ trunk/Source/WebCore/ChangeLog	2012-03-13 23:57:32 UTC (rev 110642)
@@ -1,3 +1,21 @@
+2012-03-13  Dan Bernstein  <[email protected]>
+
+        <rdar://problem/11025217> [Mac] Assertion failure in collectComplexTextRunsForCharactersCoreText
+        https://bugs.webkit.org/show_bug.cgi?id=77044
+
+        Reviewed by Sam Weinig.
+
+        Test: platform/mac/fast/text/core-text-fallback-to-unknown-font.html
+
+        Handle the case of Core Text choosing a fallback font that NSFontManager cannot find by name.
+
+        * platform/graphics/FontCache.h:
+        (FontCache): Made ComplexTextController a friend class.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Removed the
+        failing assertion, which was not true, and added code to handle the case where a font
+        cannot be found by name by using the font as returned from Core Text.
+
 2012-03-13  Erik Arvidsson  <[email protected]>
 
         [V8] Use v8::V8::AddImplicitReferences instead of SetHiddenValue

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (110641 => 110642)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2012-03-13 23:56:45 UTC (rev 110641)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2012-03-13 23:57:32 UTC (rev 110642)
@@ -130,6 +130,9 @@
     // Don't purge if this count is > 0;
     int m_purgePreventCount;
 
+#if USE(CORE_TEXT)
+    friend class ComplexTextController;
+#endif
     friend class SimpleFontData; // For getCachedFontData(const FontPlatformData*)
     friend class FontFallbackList;
 };

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (110641 => 110642)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2012-03-13 23:56:45 UTC (rev 110641)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2012-03-13 23:57:32 UTC (rev 110642)
@@ -271,8 +271,13 @@
                         continue;
                     }
                     runFontData = fontCache()->getCachedFontData(m_font.fontDescription(), fontName.get(), false, FontCache::DoNotRetain);
+                    // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
+                    // using the font as returned, even though it may not have the best NSFontRenderingMode.
+                    if (!runFontData) {
+                        FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont));
+                        runFontData = fontCache()->getCachedFontData(&runFontPlatformData, FontCache::DoNotRetain);
+                    }
                 }
-                ASSERT(runFontData);
                 if (m_fallbackFonts && runFontData != m_font.primaryFont())
                     m_fallbackFonts->add(runFontData);
             }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to