Reviewed by Eric Seidel.
authorjeremy@chromium.org <jeremy@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Dec 2009 13:33:40 +0000 (13:33 +0000)
committerjeremy@chromium.org <jeremy@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Dec 2009 13:33:40 +0000 (13:33 +0000)
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

JavaScriptCore/ChangeLog
JavaScriptCore/wtf/Platform.h
WebCore/ChangeLog
WebCore/platform/graphics/SimpleFontData.h
WebCore/platform/graphics/mac/ComplexTextController.cpp
WebCore/platform/graphics/mac/ComplexTextController.h
WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp

index 1246a747a2ca2a1dcc3639e2bce8bf960c841ba8..705489707515f124f64f77d3cc6c135bad9a51de 100644 (file)
@@ -1,3 +1,17 @@
+2009-12-08  Jeremy Moskovich  <jeremy@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@apple.com>
 
         Reviewed by Oliver Hunt.
index 72ec4b8685561fb174df4095fa2c33b3f4b24a0c..b6d05c9663b99f7dfaf27c498988d0f6d17b1246 100644 (file)
 #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
index 402a33df9d8989a638f82e371b699439eb126d24..95a6d41f383c059c9571ae63b278f5cd8777d9dd 100644 (file)
@@ -1,3 +1,35 @@
+2009-12-08  Jeremy Moskovich  <jeremy@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@apple.com>
 
         No review, rolling out r52059 until I can generate new Tiger
index 387a5c77eb1dc38f3f721bbf5ff969074b3cc758..7d787566ee1f47f575212a988339d5510244b5c5 100644 (file)
@@ -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
 
index 265b2c3f5bd6c3a6398ed0dc8426651079049baa..4cfcbd5c6229ed0989eb0057262e94cdb5ab9f49 100644 (file)
 #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)
index 7a915e202b03e2ac3fe2a88523f2d6e7ee6ff863..3fec18aa11da7162ad229061e9da33a92e225b5d 100644 (file)
@@ -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;
index 78c588f1bd041e57ceed47ca51e452f1aa62d0a5..00c71344f3272d39e1ddf6337d4dcbdcec5f6499 100644 (file)
@@ -45,7 +45,7 @@ OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayo
     ComplexTextRun* complexTextRun = reinterpret_cast<ComplexTextRun*>(refCon);
     OSStatus status;
     ItemCount count;
-    ATSLayoutRecord *layoutRecords;
+    ATSLayoutRecordlayoutRecords;
 
     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.
index c9daf841164ed384ecdaef30605425542df20f47..4efe96a66ba95e78431d4d9cb325975169b8f668 100644 (file)
 
 #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.