[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

jeremy at chromium.org jeremy at chromium.org
Thu Apr 8 00:34:38 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e22fe490fb168e344bc32f41ff16a5fefceaca90
Author: jeremy at chromium.org <jeremy at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Dec 13 13:33:40 2009 +0000

    Reviewed by Eric Seidel.
    
    Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController.
    https://bugs.webkit.org/show_bug.cgi?id=31802
    
    The goal here is to allow for a zero runtime hit for ports that decide to select
    the API at compile time.
    When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled
    at runtime.  Core Text is used for OS Versions >= 10.6.
    
    No test since this is already covered by existing pixel tests.
    
    * platform/graphics/SimpleFontData.h:  Change #ifdef to define getNSFont() on Chrome/Mac .
    * platform/graphics/mac/ComplexTextController.cpp:
    (WebCore::shouldUseATSUIAPI): Cache decision about which API to use.
    (WebCore::ComplexTextController::ComplexTextRun::indexAt):
    (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Stub function to call through
    to ATSUI/Core text variants.
    (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): The actual work for object construction
    is delegate to createTextRunFromFontDataATSUI/createTextRunFromFontDataCoreText.
    * platform/graphics/mac/ComplexTextController.h:
    * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
    (WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): Small style fix.
    (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataATSUI):
    (WebCore::ComplexTextController::collectComplexTextRunsForCharactersATSUI):
    * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
    (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
    (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText):
    (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1246a74..7054897 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-08  Jeremy Moskovich  <jeremy at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController.
+        https://bugs.webkit.org/show_bug.cgi?id=31802
+
+        The goal here is to allow for a zero runtime hit for ports that decide to select
+        the API at compile time.
+        When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled
+        at runtime.  Core Text is used for OS Versions >= 10.6.
+
+        * wtf/Platform.h: #define USE_CORE_TEXT and USE_ATSUI on Chrome/Mac.
+
 2009-12-11  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 72ec4b8..b6d05c9 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -200,6 +200,7 @@
 #define WTF_PLATFORM_CG 1
 #define WTF_PLATFORM_CI 1
 #define WTF_USE_ATSUI 1
+#define WTF_USE_CORE_TEXT 1
 #else
 #define WTF_PLATFORM_SKIA 1
 #endif
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 402a33d..95a6d41 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2009-12-08  Jeremy Moskovich  <jeremy at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController.
+        https://bugs.webkit.org/show_bug.cgi?id=31802
+
+        The goal here is to allow for a zero runtime hit for ports that decide to select
+        the API at compile time.
+        When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled
+        at runtime.  Core Text is used for OS Versions >= 10.6.
+
+        No test since this is already covered by existing pixel tests.
+
+        * platform/graphics/SimpleFontData.h:  Change #ifdef to define getNSFont() on Chrome/Mac .
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::shouldUseATSUIAPI): Cache decision about which API to use.
+        (WebCore::ComplexTextController::ComplexTextRun::indexAt):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Stub function to call through
+        to ATSUI/Core text variants.
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): The actual work for object construction
+        is delegate to createTextRunFromFontDataATSUI/createTextRunFromFontDataCoreText.
+        * platform/graphics/mac/ComplexTextController.h:
+        * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
+        (WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): Small style fix.
+        (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataATSUI):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersATSUI):
+        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+        (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
+
 2009-12-13  Eric Carlson  <eric.carlson at apple.com>
 
         No review, rolling out r52059 until I can generate new Tiger
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index 387a5c7..7d78756 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -115,7 +115,7 @@ public:
     virtual String description() const;
 #endif
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
     NSFont* getNSFont() const { return m_platformData.font(); }
 #endif
 
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp
index 265b2c3..4cfcbd5 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -29,6 +29,13 @@
 #include "Font.h"
 #include "TextBreakIterator.h"
 
+#include <wtf/StdLibExtras.h>
+
+#if defined(BUILDING_ON_LEOPARD)
+// Undefined when compiling agains the 10.5 SDK.
+#define kCTVersionNumber10_6 0x00030000
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -263,6 +270,62 @@ void ComplexTextController::collectComplexTextRuns()
         collectComplexTextRunsForCharacters(&hyphen, 1, m_end - 1, m_font.glyphDataForCharacter(hyphen, false).fontData);
 }
 
+#if USE(CORE_TEXT) && USE(ATSUI)
+static inline bool shouldUseATSUIAPI()
+{
+    enum TypeRenderingAPIToUse { UnInitialized, UseATSUI, UseCoreText };
+    DEFINE_STATIC_LOCAL(TypeRenderingAPIToUse, apiToUse, (UnInitialized));
+
+    if (UNLIKELY(apiToUse == UnInitialized)) {
+        if (&CTGetCoreTextVersion != 0 && CTGetCoreTextVersion() >= kCTVersionNumber10_6)
+            apiToUse = UseCoreText;
+        else
+            apiToUse = UseATSUI;
+    }
+
+    return apiToUse == UseATSUI;
+}
+#endif
+
+CFIndex ComplexTextController::ComplexTextRun::indexAt(size_t i) const
+{
+#if USE(CORE_TEXT) && USE(ATSUI)
+    return shouldUseATSUIAPI() ? m_atsuiIndices[i] : m_coreTextIndices[i];
+#elif USE(ATSUI)
+    return m_atsuiIndices[i];
+#elif USE(CORE_TEXT)
+    return m_coreTextIndices[i];
+#endif
+}
+
+void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
+{
+#if USE(CORE_TEXT) && USE(ATSUI)
+    if (shouldUseATSUIAPI())
+        return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData);
+    return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData);
+#elif USE(ATSUI)
+    return collectComplexTextRunsForCharactersATSUI(cp, length, stringLocation, fontData);
+#elif USE(CORE_TEXT)
+    return collectComplexTextRunsForCharactersCoreText(cp, length, stringLocation, fontData);
+#endif
+}
+
+ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
+    : m_fontData(fontData)
+    , m_characters(characters)
+    , m_stringLocation(stringLocation)
+    , m_stringLength(stringLength)
+{
+#if USE(CORE_TEXT) && USE(ATSUI)
+    shouldUseATSUIAPI() ? createTextRunFromFontDataATSUI(ltr) : createTextRunFromFontDataCoreText(ltr);
+#elif USE(ATSUI)
+    createTextRunFromFontDataATSUI(ltr);
+#elif USE(CORE_TEXT)
+    createTextRunFromFontDataCoreText(ltr);
+#endif
+}
+
 void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer)
 {
     if (static_cast<int>(offset) > m_end)
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h
index 7a915e2..3fec18a 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.h
+++ b/WebCore/platform/graphics/mac/ComplexTextController.h
@@ -39,6 +39,11 @@ class Font;
 class SimpleFontData;
 class TextRun;
 
+// ComplexTextController is responsible for rendering and measuring glyphs for
+// complex scripts on OS X.
+// The underlying API can be selected at compile time based on USE(ATSUI) and
+// USE(CORE_TEXT).  If both are defined then the Core Text APIs are used for
+// OS Versions >= 10.6, ATSUI is used otherwise.
 class ComplexTextController {
 public:
     ComplexTextController(const Font*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0);
@@ -65,7 +70,8 @@ private:
         {
             return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength));
         }
-#elif USE(ATSUI)
+#endif
+#if USE(ATSUI)
         static PassRefPtr<ComplexTextRun> create(ATSUTextLayout atsuTextLayout, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride)
         {
             return adoptRef(new ComplexTextRun(atsuTextLayout, fontData, characters, stringLocation, stringLength, ltr, directionalOverride));
@@ -81,15 +87,18 @@ private:
         const UChar* characters() const { return m_characters; }
         unsigned stringLocation() const { return m_stringLocation; }
         size_t stringLength() const { return m_stringLength; }
-        CFIndex indexAt(size_t i) const { return m_indices[i]; }
+        ALWAYS_INLINE CFIndex indexAt(size_t i) const;
         const CGGlyph* glyphs() const { return m_glyphs; }
         const CGSize* advances() const { return m_advances; }
 
     private:
 #if USE(CORE_TEXT)
         ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength);
-#elif USE(ATSUI)
+        void createTextRunFromFontDataCoreText(bool ltr);
+#endif
+#if USE(ATSUI)
         ComplexTextRun(ATSUTextLayout, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr, bool directionalOverride);
+        void createTextRunFromFontDataATSUI(bool ltr);
 #endif
         ComplexTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
 
@@ -101,7 +110,7 @@ private:
 #endif
 
 #if USE(CORE_TEXT)
-        RetainPtr<CTRunRef> m_CTRun;
+        RetainPtr<CTRunRef> m_coreTextRun;
 #endif
         unsigned m_glyphCount;
         const SimpleFontData* m_fontData;
@@ -109,10 +118,11 @@ private:
         unsigned m_stringLocation;
         size_t m_stringLength;
 #if USE(CORE_TEXT)
-        RetainPtr<CFMutableDataRef> m_indicesData;
-        const CFIndex* m_indices;
-#elif USE(ATSUI)
-        Vector<CFIndex, 64> m_indices;
+        RetainPtr<CFMutableDataRef> m_coreTextIndicesData;
+        const CFIndex* m_coreTextIndices;
+#endif
+#if USE(ATSUI)
+        Vector<CFIndex, 64> m_atsuiIndices;
 #endif
         Vector<CGGlyph, 64> m_glyphsVector;
         const CGGlyph* m_glyphs;
@@ -125,7 +135,12 @@ private:
     };
 
     void collectComplexTextRuns();
+
+    // collectComplexTextRunsForCharacters() is a stub function that calls through to the ATSUI or Core Text variants based
+    // on the API in use.
     void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
+    void collectComplexTextRunsForCharactersATSUI(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
+    void collectComplexTextRunsForCharactersCoreText(const UChar*, unsigned length, unsigned stringLocation, const SimpleFontData*);
     void adjustGlyphsAndAdvances();
 
     const Font& m_font;
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
index 78c588f..00c7134 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
@@ -45,7 +45,7 @@ OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayo
     ComplexTextRun* complexTextRun = reinterpret_cast<ComplexTextRun*>(refCon);
     OSStatus status;
     ItemCount count;
-    ATSLayoutRecord *layoutRecords;
+    ATSLayoutRecord* layoutRecords;
 
     status = ATSUDirectGetLayoutDataArrayPtrFromLineRef(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, true, reinterpret_cast<void**>(&layoutRecords), &count);
     if (status != noErr) {
@@ -66,7 +66,7 @@ OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayo
     complexTextRun->m_glyphCount = count;
     complexTextRun->m_glyphsVector.reserveCapacity(count);
     complexTextRun->m_advancesVector.reserveCapacity(count);
-    complexTextRun->m_indices.reserveCapacity(count);
+    complexTextRun->m_atsuiIndices.reserveCapacity(count);
 
     bool atBeginning = true;
     CGFloat lastX = 0;
@@ -77,7 +77,7 @@ OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayo
             continue;
         }
         complexTextRun->m_glyphsVector.uncheckedAppend(layoutRecords[j].glyphID);
-        complexTextRun->m_indices.uncheckedAppend(layoutRecords[j].originalOffset / 2 + indexOffset);
+        complexTextRun->m_atsuiIndices.uncheckedAppend(layoutRecords[j].originalOffset / 2 + indexOffset);
         CGFloat x = FixedToFloat(layoutRecords[j].realPos);
         if (!atBeginning)
             complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(x - lastX, 0));
@@ -219,33 +219,29 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLay
     status = ATSUDisposeTextLayout(atsuTextLayout);
 }
 
-ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
-    : m_fontData(fontData)
-    , m_characters(characters)
-    , m_stringLocation(stringLocation)
-    , m_stringLength(stringLength)
+void ComplexTextController::ComplexTextRun::createTextRunFromFontDataATSUI(bool ltr)
 {
-    m_indices.reserveCapacity(stringLength);
+    m_atsuiIndices.reserveCapacity(m_stringLength);
     unsigned r = 0;
-    while (r < stringLength) {
-        m_indices.uncheckedAppend(r);
-        if (U_IS_SURROGATE(characters[r])) {
-            ASSERT(r + 1 < stringLength);
-            ASSERT(U_IS_SURROGATE_LEAD(characters[r]));
-            ASSERT(U_IS_TRAIL(characters[r + 1]));
+    while (r < m_stringLength) {
+        m_atsuiIndices.uncheckedAppend(r);
+        if (U_IS_SURROGATE(m_characters[r])) {
+            ASSERT(r + 1 < m_stringLength);
+            ASSERT(U_IS_SURROGATE_LEAD(m_characters[r]));
+            ASSERT(U_IS_TRAIL(m_characters[r + 1]));
             r += 2;
         } else
             r++;
     }
-    m_glyphCount = m_indices.size();
+    m_glyphCount = m_atsuiIndices.size();
     if (!ltr) {
         for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
-            std::swap(m_indices[r], m_indices[end]);
+            std::swap(m_atsuiIndices[r], m_atsuiIndices[end]);
     }
 
     m_glyphsVector.fill(0, m_glyphCount);
     m_glyphs = m_glyphsVector.data();
-    m_advancesVector.fill(CGSizeMake(fontData->widthForGlyph(0), 0), m_glyphCount);
+    m_advancesVector.fill(CGSizeMake(m_fontData->widthForGlyph(0), 0), m_glyphCount);
     m_advances = m_advancesVector.data();
 }
 
@@ -311,7 +307,7 @@ static void initializeATSUStyle(const SimpleFontData* fontData, TextRenderingMod
     fontData->m_ATSUStyleInitialized = true;
 }
 
-void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
+void ComplexTextController::collectComplexTextRunsForCharactersATSUI(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
 {
     if (!fontData) {
         // Create a run of missing glyphs from the primary font.
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index c9daf84..4efe96a 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -29,35 +29,44 @@
 
 #include "Font.h"
 
+#if defined(BUILDING_ON_LEOPARD)
+// The following symbols are SPI in 10.5.
+extern "C" {
+void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]);
+const CGSize* CTRunGetAdvancesPtr(CTRunRef run);
+extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel;
+}
+#endif
+
 namespace WebCore {
 
 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength)
-    : m_CTRun(ctRun)
+    : m_coreTextRun(ctRun)
     , m_fontData(fontData)
     , m_characters(characters)
     , m_stringLocation(stringLocation)
     , m_stringLength(stringLength)
 {
-    m_glyphCount = CTRunGetGlyphCount(m_CTRun.get());
-    m_indices = CTRunGetStringIndicesPtr(m_CTRun.get());
-    if (!m_indices) {
-        m_indicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
-        CFDataIncreaseLength(m_indicesData.get(), m_glyphCount * sizeof(CFIndex));
-        m_indices = reinterpret_cast<const CFIndex*>(CFDataGetMutableBytePtr(m_indicesData.get()));
-        CTRunGetStringIndices(m_CTRun.get(), CFRangeMake(0, 0), const_cast<CFIndex*>(m_indices));
+    m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
+    m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
+    if (!m_coreTextIndices) {
+        m_coreTextIndicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
+        CFDataIncreaseLength(m_coreTextIndicesData.get(), m_glyphCount * sizeof(CFIndex));
+        m_coreTextIndices = reinterpret_cast<const CFIndex*>(CFDataGetMutableBytePtr(m_coreTextIndicesData.get()));
+        CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), const_cast<CFIndex*>(m_coreTextIndices));
     }
 
-    m_glyphs = CTRunGetGlyphsPtr(m_CTRun.get());
+    m_glyphs = CTRunGetGlyphsPtr(m_coreTextRun.get());
     if (!m_glyphs) {
         m_glyphsVector.grow(m_glyphCount);
-        CTRunGetGlyphs(m_CTRun.get(), CFRangeMake(0, 0), m_glyphsVector.data());
+        CTRunGetGlyphs(m_coreTextRun.get(), CFRangeMake(0, 0), m_glyphsVector.data());
         m_glyphs = m_glyphsVector.data();
     }
 
-    m_advances = CTRunGetAdvancesPtr(m_CTRun.get());
+    m_advances = CTRunGetAdvancesPtr(m_coreTextRun.get());
     if (!m_advances) {
         m_advancesVector.grow(m_glyphCount);
-        CTRunGetAdvances(m_CTRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
+        CTRunGetAdvances(m_coreTextRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
         m_advances = m_advancesVector.data();
     }
 
@@ -65,20 +74,16 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
 
 // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
 // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
-ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
-    : m_fontData(fontData)
-    , m_characters(characters)
-    , m_stringLocation(stringLocation)
-    , m_stringLength(stringLength)
+void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bool ltr)
 {
     Vector<CFIndex, 16> indices;
     unsigned r = 0;
-    while (r < stringLength) {
+    while (r < m_stringLength) {
         indices.append(r);
-        if (U_IS_SURROGATE(characters[r])) {
-            ASSERT(r + 1 < stringLength);
-            ASSERT(U_IS_SURROGATE_LEAD(characters[r]));
-            ASSERT(U_IS_TRAIL(characters[r + 1]));
+        if (U_IS_SURROGATE(m_characters[r])) {
+            ASSERT(r + 1 < m_stringLength);
+            ASSERT(U_IS_SURROGATE_LEAD(m_characters[r]));
+            ASSERT(U_IS_TRAIL(m_characters[r + 1]));
             r += 2;
         } else
             r++;
@@ -88,9 +93,9 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* font
         for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
             std::swap(indices[r], indices[end]);
     }
-    m_indicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
-    CFDataAppendBytes(m_indicesData.get(), reinterpret_cast<const UInt8*>(indices.data()), m_glyphCount * sizeof(CFIndex));
-    m_indices = reinterpret_cast<const CFIndex*>(CFDataGetBytePtr(m_indicesData.get()));
+    m_coreTextIndicesData.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, m_glyphCount * sizeof(CFIndex)));
+    CFDataAppendBytes(m_coreTextIndicesData.get(), reinterpret_cast<const UInt8*>(indices.data()), m_glyphCount * sizeof(CFIndex));
+    m_coreTextIndices = reinterpret_cast<const CFIndex*>(CFDataGetBytePtr(m_coreTextIndicesData.get()));
 
     // Synthesize a run of missing glyphs.
     m_glyphsVector.fill(0, m_glyphCount);
@@ -99,7 +104,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* font
     m_advances = m_advancesVector.data();
 }
 
-void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
+void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData)
 {
     if (!fontData) {
         // Create a run of missing glyphs from the primary font.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list