Commit 4c749b2e authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83251 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1a7210bc
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.
2011-04-07 Nat Duca <nduca@chromium.org>
 
Reviewed by David Levin.
......@@ -116,9 +116,6 @@ private:
static OSStatus overrideLayoutOperation(ATSULayoutOperationSelector, ATSULineRef, URefCon, void*, ATSULayoutOperationCallbackStatus*);
#endif
#if USE(CORE_TEXT)
RetainPtr<CTRunRef> m_coreTextRun;
#endif
unsigned m_glyphCount;
const SimpleFontData* m_fontData;
const UChar* m_characters;
......@@ -159,6 +156,10 @@ private:
Vector<UChar, 256> m_smallCapsBuffer;
#if USE(CORE_TEXT)
// Retain lines rather than their runs for better performance.
Vector<RetainPtr<CTLineRef> > m_coreTextLines;
#endif
Vector<RefPtr<ComplexTextRun>, 16> m_complexTextRuns;
Vector<CGSize, 256> m_adjustedAdvances;
Vector<CGGlyph, 256> m_adjustedGlyphs;
......
......@@ -43,33 +43,32 @@ extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel;
namespace WebCore {
ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
: m_coreTextRun(ctRun)
, m_fontData(fontData)
: m_fontData(fontData)
, m_characters(characters)
, m_stringLocation(stringLocation)
, m_stringLength(stringLength)
, m_indexEnd(runRange.location + runRange.length)
, m_isMonotonic(true)
{
m_glyphCount = CTRunGetGlyphCount(m_coreTextRun.get());
m_coreTextIndices = CTRunGetStringIndicesPtr(m_coreTextRun.get());
m_glyphCount = CTRunGetGlyphCount(ctRun);
m_coreTextIndices = CTRunGetStringIndicesPtr(ctRun);
if (!m_coreTextIndices) {
m_coreTextIndicesVector.grow(m_glyphCount);
CTRunGetStringIndices(m_coreTextRun.get(), CFRangeMake(0, 0), m_coreTextIndicesVector.data());
CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), m_coreTextIndicesVector.data());
m_coreTextIndices = m_coreTextIndicesVector.data();
}
m_glyphs = CTRunGetGlyphsPtr(m_coreTextRun.get());
m_glyphs = CTRunGetGlyphsPtr(ctRun);
if (!m_glyphs) {
m_glyphsVector.grow(m_glyphCount);
CTRunGetGlyphs(m_coreTextRun.get(), CFRangeMake(0, 0), m_glyphsVector.data());
CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), m_glyphsVector.data());
m_glyphs = m_glyphsVector.data();
}
m_advances = CTRunGetAdvancesPtr(m_coreTextRun.get());
m_advances = CTRunGetAdvancesPtr(ctRun);
if (!m_advances) {
m_advancesVector.grow(m_glyphCount);
CTRunGetAdvances(m_coreTextRun.get(), CFRangeMake(0, 0), m_advancesVector.data());
CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_advancesVector.data());
m_advances = m_advancesVector.data();
}
}
......@@ -159,6 +158,8 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC
line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
}
m_coreTextLines.append(line.get());
CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
CFIndex runCount = CFArrayGetCount(runArray);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment