[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:44:11 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit be7b06b01b77f1fcc39231d0202f1e88302b372d
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 11:54:34 2010 +0000

    2010-08-05  Ned Holbrook  <nholbrook at apple.com>
    
            Reviewed by Darin Adler.
    
            ~5% complex layout performance improvement.
            https://bugs.webkit.org/show_bug.cgi?id=43436
    
            * platform/graphics/mac/ComplexTextController.h:
            * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
            (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Use Vector rather than CFMutableData.
            (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText): Ditto.
            (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Avoid typesetter allocation unless using typesetter options.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64734 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 403e16f..93d0c5c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-05  Ned Holbrook  <nholbrook at apple.com>
+
+        Reviewed by Darin Adler.
+
+        ~5% complex layout performance improvement.
+        https://bugs.webkit.org/show_bug.cgi?id=43436
+
+        * platform/graphics/mac/ComplexTextController.h:
+        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Use Vector rather than CFMutableData.
+        (WebCore::ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText): Ditto.
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Avoid typesetter allocation unless using typesetter options.
+
 2010-08-05  Steve Block  <steveblock at google.com>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.h b/WebCore/platform/graphics/mac/ComplexTextController.h
index b520d33..85407c7 100644
--- a/WebCore/platform/graphics/mac/ComplexTextController.h
+++ b/WebCore/platform/graphics/mac/ComplexTextController.h
@@ -127,7 +127,7 @@ private:
         unsigned m_stringLocation;
         size_t m_stringLength;
 #if USE(CORE_TEXT)
-        RetainPtr<CFMutableDataRef> m_coreTextIndicesData;
+        Vector<CFIndex, 64> m_coreTextIndicesVector;
         const CFIndex* m_coreTextIndices;
 #endif
 #if USE(ATSUI)
diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
index fba3d4b..744e6d4 100644
--- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
+++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
@@ -51,10 +51,9 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
     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_coreTextIndicesVector.grow(m_glyphCount);
+        CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), m_coreTextIndicesVector.data());
+        m_coreTextIndices = m_coreTextIndicesVector.data();
     }
 
     m_glyphs = CTRunGetGlyphsPtr(m_coreTextRun.get());
@@ -70,17 +69,16 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Simp
         CTRunGetAdvances(m_coreTextRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
         m_advances = m_advancesVector.data();
     }
-
 }
 
 // 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.
 void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bool ltr)
 {
-    Vector<CFIndex, 16> indices;
+    m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength);
     unsigned r = 0;
     while (r < m_stringLength) {
-        indices.append(r);
+        m_coreTextIndicesVector.uncheckedAppend(r);
         if (U_IS_SURROGATE(m_characters[r])) {
             ASSERT(r + 1 < m_stringLength);
             ASSERT(U_IS_SURROGATE_LEAD(m_characters[r]));
@@ -89,14 +87,12 @@ void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bo
         } else
             r++;
     }
-    m_glyphCount = indices.size();
+    m_glyphCount = m_coreTextIndicesVector.size();
     if (!ltr) {
         for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
-            std::swap(indices[r], indices[end]);
+            std::swap(m_coreTextIndicesVector[r], m_coreTextIndicesVector[end]);
     }
-    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()));
+    m_coreTextIndices = m_coreTextIndicesVector.data();
 
     // Synthesize a run of missing glyphs.
     m_glyphsVector.fill(0, m_glyphCount);
@@ -120,7 +116,7 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
 
     RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures())));
 
-    RetainPtr<CTTypesetterRef> typesetter;
+    RetainPtr<CTLineRef> line;
 
     if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) {
         static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLevel };
@@ -130,11 +126,11 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
         static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) };
         static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
         static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-        typesetter.adoptCF(CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
-    } else
-        typesetter.adoptCF(CTTypesetterCreateWithAttributedString(attributedString.get()));
+        RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
 
-    RetainPtr<CTLineRef> line(AdoptCF, CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
+        line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
+    } else
+        line.adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
 
     CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list