Title: [197435] trunk
Revision
197435
Author
[email protected]
Date
2016-03-01 18:50:25 -0800 (Tue, 01 Mar 2016)

Log Message

Small-caps non-BMP characters are garbled in the complex text codepath
https://bugs.webkit.org/show_bug.cgi?id=154875

Reviewed by Michael Saboff.

Source/WebCore:

We were assuming that all characters able to be capitalized are in BMP. This is not true.

Test: fast/text/complex-small-caps-non-bmp-capitalize.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::capitalized):
(WebCore::ComplexTextController::collectComplexTextRuns):

LayoutTests:

* fast/text/complex-small-caps-non-bmp-capitalize-expected.html: Added.
* fast/text/complex-small-caps-non-bmp-capitalize.html: Added.
* fast/text/regress-154875-expected.txt: Deleted
* fast/text/regress-154875.html: Deleted

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197434 => 197435)


--- trunk/LayoutTests/ChangeLog	2016-03-02 02:34:50 UTC (rev 197434)
+++ trunk/LayoutTests/ChangeLog	2016-03-02 02:50:25 UTC (rev 197435)
@@ -1,3 +1,15 @@
+2016-03-01  Myles C. Maxfield  <[email protected]>
+
+        Small-caps non-BMP characters are garbled in the complex text codepath
+        https://bugs.webkit.org/show_bug.cgi?id=154875
+
+        Reviewed by Michael Saboff.
+
+        * fast/text/complex-small-caps-non-bmp-capitalize-expected.html: Added.
+        * fast/text/complex-small-caps-non-bmp-capitalize.html: Added.
+        * fast/text/regress-154875-expected.txt: Deleted
+        * fast/text/regress-154875.html: Deleted
+
 2016-03-01  Michael Saboff  <[email protected]>
 
         [ES6] Add support for Unicode regular expressions

Added: trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize-expected.html (0 => 197435)


--- trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize-expected.html	2016-03-02 02:50:25 UTC (rev 197435)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+</head>
+<body>
+<p>This test makes sure that the complex text codepath can handle small caps with non-BMP characters which can be uppercased.</p>
+<div style="font-size: 70px;">
+<div style="position: absolute; left: 16px; top: 16px;"><span style="font-size: 100px;">&#x642;</span>&#x10400;</div>
+<div style="position: absolute; left: 116px; top: 16px;">&#x10400;<span style="font-size: 100px;">&#x642;</span></div>
+<div style="position: absolute; left: 216px; top: 16px;"><span style="font-size: 100px;">&#x642;</span>&#x10400;&#x300;</div>
+<div style="position: absolute; left: 316px; top: 16px;">&#x10400;&#x300;<span style="font-size: 100px;">&#x642;</span></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize.html (0 => 197435)


--- trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/complex-small-caps-non-bmp-capitalize.html	2016-03-02 02:50:25 UTC (rev 197435)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<head>
+</head>
+<body>
+<p>This test makes sure that the complex text codepath can handle small caps with non-BMP characters which can be uppercased.</p>
+<div style="font-size: 100px; font-variant: small-caps">
+<div style="position: absolute; left: 16px; top: 16px;">&#x642;&#x10428;</div>
+<div style="position: absolute; left: 116px; top: 16px;">&#x10428;&#x642;</div>
+<div style="position: absolute; left: 216px; top: 16px;">&#x642;&#x10428;&#x300;</div>
+<div style="position: absolute; left: 316px; top: 16px;">&#x10428;&#x300;&#x642;</div>
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Deleted: trunk/LayoutTests/fast/text/regress-154875-expected.txt (197434 => 197435)


--- trunk/LayoutTests/fast/text/regress-154875-expected.txt	2016-03-02 02:34:50 UTC (rev 197434)
+++ trunk/LayoutTests/fast/text/regress-154875-expected.txt	2016-03-02 02:50:25 UTC (rev 197435)
@@ -1,23 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock (anonymous) at (0,0) size 784x0
-        RenderInline {SPAN} at (0,0) size 0x0
-          RenderText {#text} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x73
-        RenderBlock {P} at (0,0) size 784x18
-          RenderText {#text} at (0,0) size 348x18
-            text run at (0,0) width 180: "Regression test for 154875. "
-            text run at (179,0) width 169: "This test should not crash."
-        RenderBlock {DIV} at (0,34) size 784x21
-          RenderText {#text} at (0,1) size 215x18
-            text run at (0,1) width 168: "This is a Unicode string: \""
-            text run at (167,1) width 15: "\x{600}"
-            text run at (181,1) width 34: " \x{D801}\x{DC29}\x{D801}\x{DC2A}\x{D801}\x{DC2B}\""
-        RenderBlock {DIV} at (0,55) size 784x18
-          RenderText {#text} at (0,0) size 150x18
-            text run at (0,0) width 150: "PASS: Test didn't crash"
-      RenderBlock (anonymous) at (0,73) size 784x0
-        RenderInline {SPAN} at (0,0) size 0x0

Deleted: trunk/LayoutTests/fast/text/regress-154875.html (197434 => 197435)


--- trunk/LayoutTests/fast/text/regress-154875.html	2016-03-02 02:34:50 UTC (rev 197434)
+++ trunk/LayoutTests/fast/text/regress-154875.html	2016-03-02 02:50:25 UTC (rev 197435)
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-</head>
-<body>
-<span id="span">
-<p id="description">Regression test for 154875.  This test should not crash.</p>
-<div id="unicode-text" style="text-transform: small-caps;"></div>
-<div id="console"></div>
-<script>
-    document.getElementById('unicode-text').innerHTML = "This is a Unicode string: \"\u0600 \u{10429}\u{1042a}\u{1042b}\"";
-    document.getElementById('console').innerHTML = "PASS: Test didn't crash";
-</script>
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (197434 => 197435)


--- trunk/Source/WebCore/ChangeLog	2016-03-02 02:34:50 UTC (rev 197434)
+++ trunk/Source/WebCore/ChangeLog	2016-03-02 02:50:25 UTC (rev 197435)
@@ -1,5 +1,20 @@
 2016-03-01  Myles C. Maxfield  <[email protected]>
 
+        Small-caps non-BMP characters are garbled in the complex text codepath
+        https://bugs.webkit.org/show_bug.cgi?id=154875
+
+        Reviewed by Michael Saboff.
+
+        We were assuming that all characters able to be capitalized are in BMP. This is not true.
+
+        Test: fast/text/complex-small-caps-non-bmp-capitalize.html
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::capitalized):
+        (WebCore::ComplexTextController::collectComplexTextRuns):
+
+2016-03-01  Myles C. Maxfield  <[email protected]>
+
         Extend CSSFontSelector's lifetime to be longer than the Document's lifetime
         https://bugs.webkit.org/show_bug.cgi?id=154101
 

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (197434 => 197435)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-03-02 02:34:50 UTC (rev 197434)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2016-03-02 02:50:25 UTC (rev 197435)
@@ -350,8 +350,10 @@
         && !nextFont->variantCapsSupportsCharacterForSynthesis(fontVariantCaps, baseCharacter)) {
         synthesizedFont = &nextFont->noSynthesizableFeaturesFont();
         smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription());
-        m_smallCapsBuffer[0] = capitalizedBase ? capitalizedBase.value() : cp[0];
-        for (unsigned i = 1; cp + i < curr; ++i)
+        UChar32 characterToWrite = capitalizedBase ? capitalizedBase.value() : cp[0];
+        unsigned characterIndex = 0;
+        U16_APPEND_UNSAFE(m_smallCapsBuffer, characterIndex, characterToWrite);
+        for (unsigned i = characterIndex; cp + i < curr; ++i)
             m_smallCapsBuffer[i] = cp[i];
         nextIsSmallCaps = true;
     }
@@ -366,9 +368,10 @@
 
         if (synthesizedFont) {
             if (auto capitalizedBase = capitalized(baseCharacter)) {
-                m_smallCapsBuffer[index] = capitalizedBase.value();
+                unsigned characterIndex = index;
+                U16_APPEND_UNSAFE(m_smallCapsBuffer, characterIndex, capitalizedBase.value());
                 for (unsigned i = 0; i < markCount; ++i)
-                    m_smallCapsBuffer[index + i + 1] = cp[index + i + 1];
+                    m_smallCapsBuffer[i + characterIndex] = cp[i + characterIndex];
                 nextIsSmallCaps = true;
             } else {
                 if (engageAllSmallCapsProcessing) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to