Title: [192303] releases/WebKitGTK/webkit-2.10
Revision
192303
Author
carlo...@webkit.org
Date
2015-11-11 01:04:33 -0800 (Wed, 11 Nov 2015)

Log Message

Merge r189557 - ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
https://bugs.webkit.org/show_bug.cgi?id=146194

Reviewed by Dean Jackson.

Source/WebCore:

We might trigger shaping even if the author hasn't specified kerning or ligatures.

Test: fast/text/softbank-emoji-no-ligatures-nor-kerning.html

* platform/graphics/WidthIterator.cpp:
(WebCore::isSoftBankEmoji):
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):
(WebCore::applyFontTransforms): Deleted.
* platform/graphics/WidthIterator.h:

LayoutTests:

* fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.html: Added
* fast/text/softbank-emoji-no-ligatures-nor-kerning.html: Added

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (192302 => 192303)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-11-11 08:56:37 UTC (rev 192302)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-11-11 09:04:33 UTC (rev 192303)
@@ -1,3 +1,13 @@
+2015-09-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
+        https://bugs.webkit.org/show_bug.cgi?id=146194
+
+        Reviewed by Dean Jackson.
+
+        * fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.html: Added
+        * fast/text/softbank-emoji-no-ligatures-nor-kerning.html: Added
+
 2015-11-09  Jiewen Tan  <jiewen_...@apple.com>
 
         Crash when right clicking in input box with -webkit-user-select: none

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.txt (0 => 192303)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning-expected.txt	2015-11-11 09:04:33 UTC (rev 192303)
@@ -0,0 +1,2 @@
+This test makes sure there is no ASSERT when laying out SoftBank emoji symbols without kerning or ligatures. The test passes if there is no ASSERT.
+

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning.html (0 => 192303)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/text/softbank-emoji-no-ligatures-nor-kerning.html	2015-11-11 09:04:33 UTC (rev 192303)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+This test makes sure there is no ASSERT when laying out SoftBank emoji symbols without kerning or ligatures.
+The test passes if there is no ASSERT.
+<div style="text-rendering: optimizeSpeed;">&#xE001;</div>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (192302 => 192303)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-11-11 08:56:37 UTC (rev 192302)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-11-11 09:04:33 UTC (rev 192303)
@@ -1,3 +1,21 @@
+2015-09-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        ASSERTION FAILED: typesettingFeatures & (Kerning | Ligatures) in WebCore::applyFontTransforms
+        https://bugs.webkit.org/show_bug.cgi?id=146194
+
+        Reviewed by Dean Jackson.
+
+        We might trigger shaping even if the author hasn't specified kerning or ligatures.
+
+        Test: fast/text/softbank-emoji-no-ligatures-nor-kerning.html
+
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::isSoftBankEmoji):
+        (WebCore::WidthIterator::applyFontTransforms):
+        (WebCore::WidthIterator::advanceInternal):
+        (WebCore::applyFontTransforms): Deleted.
+        * platform/graphics/WidthIterator.h:
+
 2015-11-09  Jiewen Tan  <jiewen_...@apple.com>
 
         Crash when right clicking in input box with -webkit-user-select: none

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.cpp (192302 => 192303)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-11-11 08:56:37 UTC (rev 192302)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-11-11 09:04:33 UTC (rev 192303)
@@ -95,12 +95,24 @@
     float advanceAtCharacter;
 };
 
-typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
+static inline bool isSoftBankEmoji(UChar32 codepoint)
+{
+    return codepoint >= 0xE001 && codepoint <= 0xE537;
+}
 
-static inline float applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, WidthIterator& iterator, TypesettingFeatures typesettingFeatures, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
+inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, int lastGlyphCount, UChar32 previousCharacter) const -> TransformsType
 {
-    ASSERT(typesettingFeatures & (Kerning | Ligatures));
+    if (glyphBuffer && glyphBuffer->size() == (lastGlyphCount + 1) && isSoftBankEmoji(previousCharacter))
+        return TransformsType::Forced;
+    if (m_run.length() <= 1 || !(m_typesettingFeatures & (Kerning | Ligatures)))
+        return TransformsType::None;
+    return TransformsType::NotForced;
+}
 
+inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int& lastGlyphCount, const Font* font, TypesettingFeatures typesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace& charactersTreatedAsSpace)
+{
+    ASSERT_UNUSED(previousCharacter, shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter) != WidthIterator::TransformsType::None);
+
     if (!glyphBuffer)
         return 0;
 
@@ -118,16 +130,14 @@
     if (!ltr)
         glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
 
-#if !ENABLE(SVG_FONTS)
-    UNUSED_PARAM(iterator);
-#else
+#if ENABLE(SVG_FONTS)
     // We need to handle transforms on SVG fonts internally, since they are rendered internally.
     if (font->isSVGFont()) {
         // SVG font ligatures are handled during glyph selection, only kerning remaining.
-        if (iterator.run().renderingContext() && (typesettingFeatures & Kerning)) {
+        if (run().renderingContext() && (typesettingFeatures & Kerning)) {
             // FIXME: We could pass the necessary context down to this level so we can lazily create rendering contexts at this point.
             // However, a larger refactoring of SVG fonts might necessary to sidestep this problem completely.
-            iterator.run().renderingContext()->applySVGKerning(font, iterator, glyphBuffer, lastGlyphCount);
+            run().renderingContext()->applySVGKerning(font, *this, glyphBuffer, lastGlyphCount);
         }
     } else
 #endif
@@ -194,20 +204,6 @@
     return std::make_pair(expandLeft, expandRight);
 }
 
-static inline bool isSoftBankEmoji(UChar32 codepoint)
-{
-    return codepoint >= 0xE001 && codepoint <= 0xE537;
-}
-
-inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, int lastGlyphCount, UChar32 previousCharacter) const -> TransformsType
-{
-    if (glyphBuffer && glyphBuffer->size() == lastGlyphCount + 1 && isSoftBankEmoji(previousCharacter))
-        return TransformsType::Forced;
-    if (m_run.length() <= 1 || !(m_typesettingFeatures & (Kerning | Ligatures)))
-        return TransformsType::None;
-    return TransformsType::NotForced;
-}
-
 template <typename TextIterator>
 inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, GlyphBuffer* glyphBuffer)
 {
@@ -269,7 +265,7 @@
         if (font != lastFontData && width) {
             auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
             if (transformsType != TransformsType::None) {
-                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+                m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
                 if (glyphBuffer)
                     glyphBuffer->shrink(lastGlyphCount);
             }
@@ -427,7 +423,7 @@
 
     auto transformsType = shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter);
     if (transformsType != TransformsType::None) {
-        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, *this, m_typesettingFeatures, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
+        m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, previousCharacter, transformsType == TransformsType::Forced, charactersTreatedAsSpace);
         if (glyphBuffer)
             glyphBuffer->shrink(lastGlyphCount);
     }

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.h (192302 => 192303)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.h	2015-11-11 08:56:37 UTC (rev 192302)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/WidthIterator.h	2015-11-11 09:04:33 UTC (rev 192303)
@@ -35,7 +35,10 @@
 class Font;
 class TextRun;
 struct GlyphData;
+struct OriginalAdvancesForCharacterTreatedAsSpace;
 
+typedef Vector<std::pair<int, OriginalAdvancesForCharacterTreatedAsSpace>, 64> CharactersTreatedAsSpace;
+
 struct WidthIterator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -90,6 +93,7 @@
 
     enum class TransformsType { None, Forced, NotForced };
     TransformsType shouldApplyFontTransforms(const GlyphBuffer*, int lastGlyphCount, UChar32 previousCharacter) const;
+    float applyFontTransforms(GlyphBuffer*, bool ltr, int& lastGlyphCount, const Font*, TypesettingFeatures, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&);
 
     TypesettingFeatures m_typesettingFeatures;
     HashSet<const Font*>* m_fallbackFonts;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to