2006-10-09 Nikolas Zimmermann <zimmermann@kde.org>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Oct 2006 22:36:46 +0000 (22:36 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Oct 2006 22:36:46 +0000 (22:36 +0000)
        Reviewed by Beth.

        Fix LayoutTests/fast/css/case-transform.html with Qt - the last crashing layout test.

        * platform/qt/GlyphMapQt.cpp: Handle UTF-16 characters properly
        (WebCore::GlyphMap::fillPage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16944 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/GlyphMapQt.cpp

index 15379666cd4cc34f6ef0c4285b2e3e9f97cef7ef..ba0abbba88d69fdf81a47de503e1385320007f69 100644 (file)
@@ -1,3 +1,12 @@
+2006-10-09  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Beth.
+
+        Fix LayoutTests/fast/css/case-transform.html with Qt - the last crashing layout test.
+
+        * platform/qt/GlyphMapQt.cpp: Handle UTF-16 characters properly
+        (WebCore::GlyphMap::fillPage):
+
 2006-10-09  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Unreviewed build fix.
index 85420925ed731ade600dea552c63ae16bfd6aa0b..9523f1f7d06a1eea1c0d9f54922a05ca2c137e4f 100644 (file)
 #include "GlyphMap.h"
 
 #include "FontData.h"
+#include <unicode/utf16.h>
+#include <wtf/Assertions.h>
 
 namespace WebCore {
 
 bool GlyphMap::fillPage(GlyphPage* page, UChar* buffer, unsigned bufferLength, const FontData* fontData)
 {
-    for (unsigned i = 0; i < bufferLength; i++)
-        page->setGlyphDataForIndex(i, buffer[i], fontData);
+    bool isUtf16 = bufferLength != GlyphPage::size;
+
+    for (unsigned i = 0; i < GlyphPage::size; i++) {
+        UChar32 character;
+
+        if(isUtf16) {
+            UChar lead = buffer[i * 2];
+            UChar trail = buffer[i * 2 + 1];
+            character = U16_GET_SUPPLEMENTARY(lead, trail);
+        } else {
+            character = buffer[i];
+        }
+
+        page->setGlyphDataForIndex(i, character, fontData);
+    }
 
     return true;
 }