Title: [210170] releases/WebKitGTK/webkit-2.14
Revision
210170
Author
[email protected]
Date
2016-12-27 08:38:19 -0800 (Tue, 27 Dec 2016)

Log Message

Merge r208675 - [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0
https://bugs.webkit.org/show_bug.cgi?id=164500

Patch by Fujii Hironori <[email protected]> on 2016-11-13
Reviewed by Myles C. Maxfield.

Source/WebCore:

Test: fast/text/international/harfbuzz-runs-with-no-glyph.html

HarfBuzzShaper assumes numGlyphs of HarfBuzzRun is greater than
zero. But this is not necessarily true. If a font does not have a
glyph of SPACE (U+0020), HarfBuzz removes ignorable glyphs. In
this case, HarfBuzzRun can have no glyphs.

* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Resize
m_offsets to one if m_numGlyphs is zero.
* platform/graphics/harfbuzz/HarfBuzzShaper.h:
(WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Use Vector::data()
instread of operator[0].
(WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto.
(WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): Ditto.
(WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): Ditto.

LayoutTests:

* fast/text/international/harfbuzz-runs-with-no-glyph-expected.txt: Added.
* fast/text/international/harfbuzz-runs-with-no-glyph.html: Added.
* fast/text/international/resources/ignorables.woff: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (210169 => 210170)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-12-27 16:36:58 UTC (rev 210169)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2016-12-27 16:38:19 UTC (rev 210170)
@@ -1,3 +1,14 @@
+2016-11-13  Fujii Hironori  <[email protected]>
+
+        [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0
+        https://bugs.webkit.org/show_bug.cgi?id=164500
+
+        Reviewed by Myles C. Maxfield.
+
+        * fast/text/international/harfbuzz-runs-with-no-glyph-expected.txt: Added.
+        * fast/text/international/harfbuzz-runs-with-no-glyph.html: Added.
+        * fast/text/international/resources/ignorables.woff: Added.
+
 2016-10-27  Myles C. Maxfield  <[email protected]>
 
         [macOS] [WebGL2] Temporarily upgrade WebGL 2's internal OpenGL context from version 2.1 to 3.2

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph-expected.txt (0 => 210170)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph-expected.txt	2016-12-27 16:38:19 UTC (rev 210170)
@@ -0,0 +1 @@
+‏ا‎

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph.html (0 => 210170)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/harfbuzz-runs-with-no-glyph.html	2016-12-27 16:38:19 UTC (rev 210170)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<style>
+@font-face {
+    font-family: test-font;
+    src: url(resources/ignorables.woff);
+}
+body {
+    font-family: test-font;
+}
+</style>
+<body>
+<p>&#x200f;&#x0627;&#x200e;</p>
+<script>
+if (window.testRunner) {
+    // Force layout.
+    testRunner.display();
+    testRunner.dumpAsText();
+}
+</script>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/resources/ignorables.woff (0 => 210170)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/resources/ignorables.woff	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/text/international/resources/ignorables.woff	2016-12-27 16:38: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o\xC1\xC5\xFC\x82P+IK\xA7\xF4X\xE8\xE8XPx\x9Ce\x90\xB1n\xC20\x86\xFF@\xA0tA}\x84a u@e\xA8*!\x90X17\x8A\xAC	\x9A$\xD4\xE7\xE9\xDA.}\x84\x8E}\xA8\xFE\xA6Cɾ\xEF\xCE\xE7\xFF\xFC@\xEFp\xF9F0\x9E\x84\xF8\xF0\xDC\xC0+\xBE<7!A\xD7s\x880x\xF0\xDC\xC2]\xF0\xEC\xB9\xCD\xFA+;\x83\xF0\x96ٮ\xBE\xE58@o\x9E\x9C\xFB鹉'|{\xD1	\xEE=\xB78\xEB\xD1s\x9B\xF5LQ\xE0\x803J\xE4Ȱ\x85\x85\xA0\xC7j\x9Fq\x85\x98+vv	\x8C\x9A\xFD	RR\x8E3\xC1\xEC\xB7ny\x923\xDB33\xB5\x9E\xBB\x93"\xA6\xC5\xE1\\xE6\xD9\xD6Joڗ\xA1\x8AG\xB2*\xCCY\xC6\xEA2Im~\xD22sl\x93\xDC쵱<IyoM\xA9\x8ARX\xEB\x8A\xFB\x92i\x86#\xFFC\xC2yX\xEA\xEC\xB8K\xF3\xFA\x95\xB6\x8E%;t\xED!\xA2\xC1\x84\xEB*s\xC9\xC6\xD0]\xCC\xFD\xEA\xF3\xC2\xD8yQfZ\x86\x91\x92\x
 89\xB8q\xE3A\xDCk\xFF\xBDdS;\xAE\xE8\xD7M\xEA8\xA5\xA8\x8En*6\xBA\xAC\xF2ˆRq\xA4\x94\x92\xBF
+?\xDE^W\x85x\x9Cc`f\x83\xFF\xCDFX(D\xB8
\ No newline at end of file

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (210169 => 210170)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 16:36:58 UTC (rev 210169)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 16:38:19 UTC (rev 210170)
@@ -1,3 +1,27 @@
+2016-11-13  Fujii Hironori  <[email protected]>
+
+        [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0
+        https://bugs.webkit.org/show_bug.cgi?id=164500
+
+        Reviewed by Myles C. Maxfield.
+
+        Test: fast/text/international/harfbuzz-runs-with-no-glyph.html
+
+        HarfBuzzShaper assumes numGlyphs of HarfBuzzRun is greater than
+        zero. But this is not necessarily true. If a font does not have a
+        glyph of SPACE (U+0020), HarfBuzz removes ignorable glyphs. In
+        this case, HarfBuzzRun can have no glyphs.
+
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Resize
+        m_offsets to one if m_numGlyphs is zero.
+        * platform/graphics/harfbuzz/HarfBuzzShaper.h:
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Use Vector::data()
+        instread of operator[0].
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto.
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): Ditto.
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): Ditto.
+
 2016-12-19  Miguel Gomez  <[email protected]>
 
         [GTK] GLXBadFBConfig error when creating an OpenGL context

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (210169 => 210170)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2016-12-27 16:36:58 UTC (rev 210169)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2016-12-27 16:38:19 UTC (rev 210170)
@@ -83,6 +83,11 @@
 void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfBuzzBuffer)
 {
     m_numGlyphs = hb_buffer_get_length(harfBuzzBuffer);
+    if (!m_numGlyphs) {
+        // HarfBuzzShaper::fillGlyphBuffer gets offsets()[0]
+        m_offsets.resize(1);
+        return;
+    }
     m_glyphs.resize(m_numGlyphs);
     m_advances.resize(m_numGlyphs);
     m_glyphToCharacterIndexes.resize(m_numGlyphs);

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h (210169 => 210170)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h	2016-12-27 16:36:58 UTC (rev 210169)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h	2016-12-27 16:38:19 UTC (rev 210170)
@@ -77,10 +77,10 @@
         unsigned startIndex() const { return m_startIndex; }
         unsigned numCharacters() const { return m_numCharacters; }
         unsigned numGlyphs() const { return m_numGlyphs; }
-        uint16_t* glyphs() { return &m_glyphs[0]; }
-        float* advances() { return &m_advances[0]; }
-        FloatPoint* offsets() { return &m_offsets[0]; }
-        uint16_t* glyphToCharacterIndexes() { return &m_glyphToCharacterIndexes[0]; }
+        uint16_t* glyphs() { return m_glyphs.data(); }
+        float* advances() { return m_advances.data(); }
+        FloatPoint* offsets() { return m_offsets.data(); }
+        uint16_t* glyphToCharacterIndexes() { return m_glyphToCharacterIndexes.data(); }
         float width() { return m_width; }
         bool rtl() { return m_direction == RTL; }
         hb_script_t script() { return m_script; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to