Title: [169872] trunk
Revision
169872
Author
mmaxfi...@apple.com
Date
2014-06-11 19:24:25 -0700 (Wed, 11 Jun 2014)

Log Message

SVGGlyphToPathTranslator ASSERTs when encountering a missing glyph in an SVG font
https://bugs.webkit.org/show_bug.cgi?id=133528

Reviewed by Simon Fraser.

Source/WebCore:
Turns out this assertion is benign. We can take an early out of advance() (which
is then handled properly by Font::dashesForIntersectionsWithRect()

Test: svg/custom/skip-underline-missing-glyph.html

* platform/graphics/mac/FontMac.mm:
(WebCore::Font::dashesForIntersectionsWithRect): Rather than skip partial results,
don't skip anything at all to be consistent.
* rendering/svg/SVGTextRunRenderingContext.cpp:
(WebCore::SVGGlyphToPathTranslator::advance): Take an early out to avoid an ASSERT.

LayoutTests:
Make sure that no ASSERT occurs in this situation. In addition, make sure that the
whole element doesn't get skip:ink gaps. This will need to be updated when we
support SVG + non-SVG mixed runs.

* svg/custom/skip-underline-missing-glyph-expected.html: Added
* svg/custom/skip-underline-missing-glyph.html: Added

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169871 => 169872)


--- trunk/LayoutTests/ChangeLog	2014-06-12 02:11:02 UTC (rev 169871)
+++ trunk/LayoutTests/ChangeLog	2014-06-12 02:24:25 UTC (rev 169872)
@@ -1,3 +1,17 @@
+2014-06-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        SVGGlyphToPathTranslator ASSERTs when encountering a missing glyph in an SVG font
+        https://bugs.webkit.org/show_bug.cgi?id=133528
+
+        Reviewed by Simon Fraser.
+
+        Make sure that no ASSERT occurs in this situation. In addition, make sure that the
+        whole element doesn't get skip:ink gaps. This will need to be updated when we
+        support SVG + non-SVG mixed runs.
+
+        * svg/custom/skip-underline-missing-glyph-expected.html: Added
+        * svg/custom/skip-underline-missing-glyph.html: Added
+
 2014-06-11  Alexey Proskuryakov  <a...@apple.com>
 
         editing/selection/selection-in-iframe-removed-crash.html or selection-invalid-offset.html crashes intermittently

Added: trunk/LayoutTests/svg/custom/skip-underline-missing-glyph-expected.html (0 => 169872)


--- trunk/LayoutTests/svg/custom/skip-underline-missing-glyph-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/skip-underline-missing-glyph-expected.html	2014-06-12 02:24:25 UTC (rev 169872)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+    font-family: freesans;
+    src: url(../../svg/custom/resources/SVGFreeSans.svg) format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that there is no ASSERT hit when we are attempting to draw
+a skip:ink text decoration on SVG text where the SVG font does not have all the
+glyphs that we need.
+
+This test also tests that, in this situation, no gaps are drawn at all. This
+test will need to be altered when we finally support mixed SVG and non-SVG
+fonts along with skip:ink decorations.
+<div style="text-decoration: underline; -webkit-text-decoration-skip: none; font: 48px freesans;">abycとefygh</div>
+</body>
+</html>

Added: trunk/LayoutTests/svg/custom/skip-underline-missing-glyph.html (0 => 169872)


--- trunk/LayoutTests/svg/custom/skip-underline-missing-glyph.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/skip-underline-missing-glyph.html	2014-06-12 02:24:25 UTC (rev 169872)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+@font-face {
+    font-family: freesans;
+    src: url(../../svg/custom/resources/SVGFreeSans.svg) format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that there is no ASSERT hit when we are attempting to draw
+a skip:ink text decoration on SVG text where the SVG font does not have all the
+glyphs that we need.
+
+This test also tests that, in this situation, no gaps are drawn at all. This
+test will need to be altered when we finally support mixed SVG and non-SVG
+fonts along with skip:ink decorations.
+<div style="text-decoration: underline; -webkit-text-decoration-skip: ink; font: 48px freesans;">abycとefygh</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (169871 => 169872)


--- trunk/Source/WebCore/ChangeLog	2014-06-12 02:11:02 UTC (rev 169871)
+++ trunk/Source/WebCore/ChangeLog	2014-06-12 02:24:25 UTC (rev 169872)
@@ -1,3 +1,21 @@
+2014-06-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        SVGGlyphToPathTranslator ASSERTs when encountering a missing glyph in an SVG font
+        https://bugs.webkit.org/show_bug.cgi?id=133528
+
+        Reviewed by Simon Fraser.
+
+        Turns out this assertion is benign. We can take an early out of advance() (which
+        is then handled properly by Font::dashesForIntersectionsWithRect()
+
+        Test: svg/custom/skip-underline-missing-glyph.html
+
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::dashesForIntersectionsWithRect): Rather than skip partial results,
+        don't skip anything at all to be consistent.
+        * rendering/svg/SVGTextRunRenderingContext.cpp:
+        (WebCore::SVGGlyphToPathTranslator::advance): Take an early out to avoid an ASSERT.
+
 2014-06-11  Simon Fraser  <simon.fra...@apple.com>
 
         [iOS WK2] Give WebKitTestRunner a viewport configuration with initial scale=1 for testing

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (169871 => 169872)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-06-12 02:11:02 UTC (rev 169871)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-06-12 02:24:25 UTC (rev 169872)
@@ -528,7 +528,7 @@
     if (!glyphBuffer.size())
         return DashArray();
     
-    // FIXME: Handle SVG + non-SVG interleaved runs
+    // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778
     const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
     std::unique_ptr<GlyphToPathTranslator> translator;
     bool isSVG = false;
@@ -543,8 +543,11 @@
     for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) {
         GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
         const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);
-        if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData))
-            break; // The advances will get all messed up if we do anything other than bail here.
+        if (!localFontData || (!isSVG && localFontData->isSVGFont()) || (isSVG && localFontData != fontData)) {
+            // The advances will get all messed up if we do anything other than bail here.
+            result.clear();
+            break;
+        }
         switch (translator->underlineType()) {
         case GlyphToPathTranslator::GlyphUnderlineType::SkipDescenders: {
             Path path = translator->path();

Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (169871 => 169872)


--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2014-06-12 02:11:02 UTC (rev 169871)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2014-06-12 02:24:25 UTC (rev 169872)
@@ -202,7 +202,7 @@
         }
 
         ++m_index;
-        if (m_index >= m_stoppingPoint)
+        if (m_index >= m_stoppingPoint || !m_glyphBuffer.fontDataAt(m_index)->isSVGFont())
             break;
         m_glyph = m_glyphBuffer.glyphAt(m_index);
         if (!m_glyph)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to