Title: [164001] trunk/Source/WebCore
Revision
164001
Author
[email protected]
Date
2014-02-12 17:27:28 -0800 (Wed, 12 Feb 2014)

Log Message

REGRESSION: Crashing/Broken Tests Due To Unexpected 8-bit Character Data
https://bugs.webkit.org/show_bug.cgi?id=128698

Reviewed by Tim Horton.

* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::advance): Make 16-bit copy when needed.
(WebCore::UniscribeController::shapeAndPlaceItem): Handle 8-bit case when checking
for word boundaries.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164000 => 164001)


--- trunk/Source/WebCore/ChangeLog	2014-02-13 01:06:58 UTC (rev 164000)
+++ trunk/Source/WebCore/ChangeLog	2014-02-13 01:27:28 UTC (rev 164001)
@@ -1,3 +1,15 @@
+2014-02-12  Brent Fulgham  <[email protected]>
+
+        REGRESSION: Crashing/Broken Tests Due To Unexpected 8-bit Character Data
+        https://bugs.webkit.org/show_bug.cgi?id=128698
+
+        Reviewed by Tim Horton.
+
+        * platform/graphics/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::advance): Make 16-bit copy when needed.
+        (WebCore::UniscribeController::shapeAndPlaceItem): Handle 8-bit case when checking
+        for word boundaries.
+
 2014-02-12  Benjamin Poulain  <[email protected]>
 
         Document::childrenChanged does not necessarily have a page

Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (164000 => 164001)


--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2014-02-13 01:06:58 UTC (rev 164000)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2014-02-13 01:27:28 UTC (rev 164001)
@@ -108,8 +108,17 @@
     if (length <= 0)
         return;
 
+    String bufferFor16BitData;
+
     // Itemize the string.
-    const UChar* cp = m_run.data16(m_currentCharacter);
+    const UChar* cp = nullptr;
+    if (m_run.is8Bit()) {
+        // Uniscribe only deals with 16-bit characters. Must generate them now.
+        bufferFor16BitData = String::make16BitFrom8BitSource(m_run.data8(m_currentCharacter), length);
+        cp = bufferFor16BitData.characters16();
+    } else
+        cp = m_run.data16(m_currentCharacter);
+
     unsigned baseCharacter = m_currentCharacter;
 
     // We break up itemization of the string by fontData and (if needed) the use of small caps.
@@ -330,8 +339,16 @@
                 }
 
                 // Account for word-spacing.
-                if (characterIndex > 0 && !Font::treatAsSpace(*m_run.data16(characterIndex - 1)) && m_font.wordSpacing())
-                    advance += m_font.wordSpacing();
+                if (characterIndex > 0 && m_font.wordSpacing()) {
+                    UChar candidateSpace;
+                    if (m_run.is8Bit())
+                        candidateSpace = *(m_run.data8(characterIndex - 1));
+                    else
+                        candidateSpace = *(m_run.data16(characterIndex - 1));
+
+                    if (!Font::treatAsSpace(candidateSpace))
+                        advance += m_font.wordSpacing();
+                }
             }
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to