Title: [187525] trunk
Revision
187525
Author
[email protected]
Date
2015-07-28 16:12:46 -0700 (Tue, 28 Jul 2015)

Log Message

[iOS] Crash when encountering characters whose natural font is one we can't look up
https://bugs.webkit.org/show_bug.cgi?id=147377
<rdar://problem/22022011>

Reviewed by Simon Fraser.

Source/WebCore:

These characters hit the complex text code path, where CoreText picks fonts
to use for each character. We then try to map these CoreText fonts back to
our own Font objects, and we assume (on iOS) that our own font search will
always return something.

On OS X, we do not have such an assumption, and we handle the case where it
does not hold. This method works on iOS as well, so the solution is to just
perform it on both OSes.

Test: fast/text/crash-complex-unknown-font.html

* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

LayoutTests:

* fast/text/crash-complex-unknown-font-expected.html: Added.
* fast/text/crash-complex-unknown-font.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187524 => 187525)


--- trunk/LayoutTests/ChangeLog	2015-07-28 22:39:12 UTC (rev 187524)
+++ trunk/LayoutTests/ChangeLog	2015-07-28 23:12:46 UTC (rev 187525)
@@ -1,3 +1,14 @@
+2015-07-28  Myles C. Maxfield  <[email protected]>
+
+        [iOS] Crash when encountering characters whose natural font is one we can't look up
+        https://bugs.webkit.org/show_bug.cgi?id=147377
+        <rdar://problem/22022011>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/crash-complex-unknown-font-expected.html: Added.
+        * fast/text/crash-complex-unknown-font.html: Added.
+
 2015-07-28  Chris Dumez  <[email protected]>
 
         Tests introduced in r187489 are flaky

Added: trunk/LayoutTests/fast/text/crash-complex-unknown-font-expected.html (0 => 187525)


--- trunk/LayoutTests/fast/text/crash-complex-unknown-font-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/crash-complex-unknown-font-expected.html	2015-07-28 23:12:46 UTC (rev 187525)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+Test successful (no crash)
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/crash-complex-unknown-font.html (0 => 187525)


--- trunk/LayoutTests/fast/text/crash-complex-unknown-font.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/crash-complex-unknown-font.html	2015-07-28 23:12:46 UTC (rev 187525)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+window.setTimeout(function() {
+    document.getElementById("replaceme").textContent = "Test successful (no crash)";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 0);
+</script>
+</head>
+<body>
+<div id="replaceme">&#x2038;&#x094d;&#x091f;</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (187524 => 187525)


--- trunk/Source/WebCore/ChangeLog	2015-07-28 22:39:12 UTC (rev 187524)
+++ trunk/Source/WebCore/ChangeLog	2015-07-28 23:12:46 UTC (rev 187525)
@@ -1,3 +1,25 @@
+2015-07-28  Myles C. Maxfield  <[email protected]>
+
+        [iOS] Crash when encountering characters whose natural font is one we can't look up
+        https://bugs.webkit.org/show_bug.cgi?id=147377
+        <rdar://problem/22022011>
+
+        Reviewed by Simon Fraser.
+
+        These characters hit the complex text code path, where CoreText picks fonts
+        to use for each character. We then try to map these CoreText fonts back to
+        our own Font objects, and we assume (on iOS) that our own font search will
+        always return something.
+
+        On OS X, we do not have such an assumption, and we handle the case where it
+        does not hold. This method works on iOS as well, so the solution is to just
+        perform it on both OSes.
+
+        Test: fast/text/crash-complex-unknown-font.html
+
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+
 2015-07-28  Said Abou-Hallawa  <[email protected]>
 
         [iOS] REGRESSION(r168075): Fullscreen web video doesn't pause on screen lock

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


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-07-28 22:39:12 UTC (rev 187524)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2015-07-28 23:12:46 UTC (rev 187525)
@@ -282,17 +282,12 @@
                     }
                     auto& fontCache = FontCache::singleton();
                     runFont = fontCache.fontForFamily(m_font.fontDescription(), fontName.get(), false).get();
-#if !PLATFORM(IOS)
-                    // 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.
+                    // Core Text may have used a font that our font lookup path cannot find. In that case, fall back on
+                    // using the font as returned.
                     if (!runFont) {
                         FontPlatformData runFontPlatformData(runCTFont, CTFontGetSize(runCTFont));
                         runFont = fontCache.fontForPlatformData(runFontPlatformData).ptr();
                     }
-#else
-                    // FIXME: Just assert for now, until we can devise a better fix that works with iOS.
-                    ASSERT(runFont);
-#endif
                 }
                 if (m_fallbackFonts && runFont != &m_font.primaryFont())
                     m_fallbackFonts->add(runFont);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to