Changeset 83251 in webkit


Ignore:
Timestamp:
Apr 7, 2011 9:38:37 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-07 Ned Holbrook <nholbrook@apple.com>

Reviewed by Dan Bernstein.

CTLine objects should outlive their CTRuns
https://bugs.webkit.org/show_bug.cgi?id=58063

  • platform/graphics/mac/ComplexTextController.h: Add m_coreTextLines, to be destroyed after m_complexTextRuns.
  • platform/graphics/mac/ComplexTextControllerCoreText.cpp: (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moot m_coreTextRun. (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Append line to m_coreTextLines.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83249 r83251  
     12011-04-07  Ned Holbrook  <nholbrook@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        CTLine objects should outlive their CTRuns
     6        https://bugs.webkit.org/show_bug.cgi?id=58063
     7
     8        * platform/graphics/mac/ComplexTextController.h: Add m_coreTextLines, to be destroyed after m_complexTextRuns.
     9        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
     10        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moot m_coreTextRun.
     11        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): Append line to m_coreTextLines.
     12
    1132011-04-07  Nat Duca  <nduca@chromium.org>
    214
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r82013 r83251  
    117117#endif
    118118
    119 #if USE(CORE_TEXT)
    120         RetainPtr<CTRunRef> m_coreTextRun;
    121 #endif
    122119        unsigned m_glyphCount;
    123120        const SimpleFontData* m_fontData;
     
    160157    Vector<UChar, 256> m_smallCapsBuffer;
    161158
     159#if USE(CORE_TEXT)
     160    // Retain lines rather than their runs for better performance.
     161    Vector<RetainPtr<CTLineRef> > m_coreTextLines;
     162#endif
    162163    Vector<RefPtr<ComplexTextRun>, 16> m_complexTextRuns;
    163164    Vector<CGSize, 256> m_adjustedAdvances;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp

    r80583 r83251  
    4444
    4545ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
    46     : m_coreTextRun(ctRun)
    47     , m_fontData(fontData)
     46    : m_fontData(fontData)
    4847    , m_characters(characters)
    4948    , m_stringLocation(stringLocation)
     
    5251    , m_isMonotonic(true)
    5352{
    54     m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
    55     m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
     53    m_glyphCount = CTRunGetGlyphCount(ctRun);
     54    m_coreTextIndices = CTRunGetStringIndicesPtr(ctRun);
    5655    if (!m_coreTextIndices) {
    5756        m_coreTextIndicesVector.grow(m_glyphCount);
    58         CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), m_coreTextIndicesVector.data());
     57        CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), m_coreTextIndicesVector.data());
    5958        m_coreTextIndices = m_coreTextIndicesVector.data();
    6059    }
    6160
    62     m_glyphs = CTRunGetGlyphsPtr(m_coreTextRun.get());
     61    m_glyphs = CTRunGetGlyphsPtr(ctRun);
    6362    if (!m_glyphs) {
    6463        m_glyphsVector.grow(m_glyphCount);
    65         CTRunGetGlyphs(m_coreTextRun.get(), CFRangeMake(0, 0), m_glyphsVector.data());
     64        CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), m_glyphsVector.data());
    6665        m_glyphs = m_glyphsVector.data();
    6766    }
    6867
    69     m_advances = CTRunGetAdvancesPtr(m_coreTextRun.get());
     68    m_advances = CTRunGetAdvancesPtr(ctRun);
    7069    if (!m_advances) {
    7170        m_advancesVector.grow(m_glyphCount);
    72         CTRunGetAdvances(m_coreTextRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
     71        CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_advancesVector.data());
    7372        m_advances = m_advancesVector.data();
    7473    }
     
    160159    }
    161160
     161    m_coreTextLines.append(line.get());
     162
    162163    CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
    163164
Note: See TracChangeset for help on using the changeset viewer.