Changeset 71795 in webkit


Ignore:
Timestamp:
Nov 10, 2010 9:18:54 PM (13 years ago)
Author:
mitz@apple.com
Message:

Allow for the possibility of CoreText generating multiple runs for a single text run.
https://bugs.webkit.org/show_bug.cgi?id=49353

Patch by Ned Holbrook <nholbrook@apple.com> on 2010-11-10
Reviewed by Dan Bernstein.

  • platform/graphics/mac/ComplexTextController.h:

(WebCore::ComplexTextController::ComplexTextRun::create):

  • platform/graphics/mac/ComplexTextControllerCoreText.cpp:

(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
(WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71791 r71795  
     12010-11-10  Ned Holbrook  <nholbrook@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Allow for the possibility of CoreText generating multiple runs for a single text run.
     6        https://bugs.webkit.org/show_bug.cgi?id=49353
     7
     8        * platform/graphics/mac/ComplexTextController.h:
     9        (WebCore::ComplexTextController::ComplexTextRun::create):
     10        * platform/graphics/mac/ComplexTextControllerCoreText.cpp:
     11        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
     12        (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText):
     13
    1142010-10-15  Martin Robinson  <mrobinson@igalia.com>
    215
  • trunk/WebCore/platform/graphics/mac/ComplexTextController.h

    r71787 r71795  
    7373    public:
    7474#if USE(CORE_TEXT)
    75         static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength)
     75        static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, CFRange runRange)
    7676        {
    77             return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength));
     77            return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, runRange));
    7878        }
    7979#endif
     
    103103    private:
    104104#if USE(CORE_TEXT)
    105         ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength);
     105        ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, CFRange runRange);
    106106        void createTextRunFromFontDataCoreText(bool ltr);
    107107#endif
  • trunk/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp

    r71598 r71795  
    4242namespace WebCore {
    4343
    44 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength)
     44ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, CFRange runRange)
    4545    : m_coreTextRun(ctRun)
    4646    , m_fontData(fontData)
    47     , m_characters(characters)
    48     , m_stringLocation(stringLocation)
    49     , m_stringLength(stringLength)
     47    , m_characters(characters + runRange.location)
     48    , m_stringLocation(stringLocation + runRange.location)
     49    , m_stringLength(runRange.length)
    5050    , m_isMonotonic(true)
    5151{
    5252    m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
    53     m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
     53    m_coreTextIndices = runRange.location ? 0 : CTRunGetStringIndicesPtr(m_coreTextRun.get());
    5454    if (!m_coreTextIndices) {
    5555        m_coreTextIndicesVector.grow(m_glyphCount);
    5656        CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), m_coreTextIndicesVector.data());
     57        if (runRange.location)
     58            for (unsigned i = 0; i < m_glyphCount; ++i)
     59                m_coreTextIndicesVector[i] -= runRange.location;
    5760        m_coreTextIndices = m_coreTextIndicesVector.data();
    5861    }
     
    165168        CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, r));
    166169        ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID());
    167         m_complexTextRuns.append(ComplexTextRun::create(ctRun, fontData, cp, stringLocation, length));
     170        CFRange runRange = CTRunGetStringRange(ctRun);
     171        m_complexTextRuns.append(ComplexTextRun::create(ctRun, fontData, cp, stringLocation, runRange));
    168172    }
    169173}
Note: See TracChangeset for help on using the changeset viewer.