Changeset 211765 in webkit


Ignore:
Timestamp:
Feb 6, 2017 6:14:53 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

Migrate ComplexTextController to use platform-independent types
https://bugs.webkit.org/show_bug.cgi?id=167833

Reviewed by Brent Fulgham.

Source/WebCore:

ComplexTextController will eventually be used on all ports to perform complex text layout.
This is a mechanical patch which migrates the shared parts of ComplexTextController away from
using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
fix first.

No new tests because there is no behavior change.

  • platform/graphics/GlyphBuffer.h:

(WebCore::GlyphBufferAdvance::GlyphBufferAdvance):

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::ComplexTextController::offsetForPosition):
(WebCore::advanceByCombiningCharacterSequence):
(WebCore::ComplexTextController::ComplexTextRun::indexAt):
(WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
(WebCore::ComplexTextController::advance):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):

  • platform/graphics/mac/ComplexTextController.h:

(WebCore::ComplexTextController::ComplexTextRun::create):
(WebCore::ComplexTextController::ComplexTextRun::stringLength):
(WebCore::ComplexTextController::ComplexTextRun::indexBegin):
(WebCore::ComplexTextController::ComplexTextRun::indexEnd):
(WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
(WebCore::ComplexTextController::ComplexTextRun::glyphs):
(WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
(WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
(WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
(WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
(WebCore::ComplexTextController::glyphOrigin):
(WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.

  • platform/graphics/mac/ComplexTextControllerCoreText.mm:

(SOFT_LINK):
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

Tools:

Migrate tests away from platform-dependent types.

  • TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:

(TestWebKitAPI::TEST_F):

LayoutTests:

Rebaseline tiny rounding result.

  • platform/mac/fast/text/complex-text-opacity-expected.txt:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211758 r211765  
     12017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Migrate ComplexTextController to use platform-independent types
     4        https://bugs.webkit.org/show_bug.cgi?id=167833
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Rebaseline tiny rounding result.
     9
     10        * platform/mac/fast/text/complex-text-opacity-expected.txt:
     11
    1122017-02-06  Youenn Fablet  <youennf@gmail.com>
    213
  • trunk/LayoutTests/platform/mac/fast/text/complex-text-opacity-expected.txt

    r187126 r211765  
    2525        RenderText {#text} at (188,4) size 7x29
    2626          text run at (188,4) width 7: " "
    27         RenderText {#text} at (237,4) size 7x29
    28           text run at (237,4) width 7: " "
     27        RenderText {#text} at (236,4) size 8x29
     28          text run at (236,4) width 8: " "
    2929        RenderText {#text} at (285,4) size 7x29
    3030          text run at (285,4) width 7: " "
  • trunk/Source/WebCore/ChangeLog

    r211763 r211765  
     12017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Migrate ComplexTextController to use platform-independent types
     4        https://bugs.webkit.org/show_bug.cgi?id=167833
     5
     6        Reviewed by Brent Fulgham.
     7
     8        ComplexTextController will eventually be used on all ports to perform complex text layout.
     9        This is a mechanical patch which migrates the shared parts of ComplexTextController away from
     10        using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
     11        ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
     12        fix first.
     13
     14        No new tests because there is no behavior change.
     15
     16        * platform/graphics/GlyphBuffer.h:
     17        (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
     18        * platform/graphics/mac/ComplexTextController.cpp:
     19        (WebCore::ComplexTextController::offsetForPosition):
     20        (WebCore::advanceByCombiningCharacterSequence):
     21        (WebCore::ComplexTextController::ComplexTextRun::indexAt):
     22        (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
     23        (WebCore::ComplexTextController::advance):
     24        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
     25        * platform/graphics/mac/ComplexTextController.h:
     26        (WebCore::ComplexTextController::ComplexTextRun::create):
     27        (WebCore::ComplexTextController::ComplexTextRun::stringLength):
     28        (WebCore::ComplexTextController::ComplexTextRun::indexBegin):
     29        (WebCore::ComplexTextController::ComplexTextRun::indexEnd):
     30        (WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
     31        (WebCore::ComplexTextController::ComplexTextRun::glyphs):
     32        (WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
     33        (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
     34        (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
     35        (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
     36        (WebCore::ComplexTextController::glyphOrigin):
     37        (WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
     38        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
     39        (SOFT_LINK):
     40        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
     41        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
     42
    1432017-02-06  Brent Fulgham  <bfulgham@apple.com>
    244
  • trunk/Source/WebCore/platform/graphics/GlyphBuffer.h

    r211382 r211765  
    6363public:
    6464    GlyphBufferAdvance() : CGSize(CGSizeZero) { }
    65     GlyphBufferAdvance(CGSize size) : CGSize(size)
     65    GlyphBufferAdvance(CGSize size)
     66        : CGSize(size)
     67    {
     68    }
     69    GlyphBufferAdvance(float width, float height)
     70        : CGSize(CGSizeMake(width, height))
    6671    {
    6772    }
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r211382 r211765  
    176176        return m_run.ltr() ? 0 : m_end;
    177177
    178     CGFloat x = h;
     178    float x = h;
    179179
    180180    size_t runCount = m_complexTextRuns.size();
    181     size_t offsetIntoAdjustedGlyphs = 0;
     181    unsigned offsetIntoAdjustedGlyphs = 0;
    182182
    183183    for (size_t r = 0; r < runCount; ++r) {
    184184        const ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
    185185        for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) {
    186             size_t index = offsetIntoAdjustedGlyphs + j;
    187             CGFloat adjustedAdvance = m_adjustedBaseAdvances[index].width;
     186            unsigned index = offsetIntoAdjustedGlyphs + j;
     187            float adjustedAdvance = m_adjustedBaseAdvances[index].width();
    188188            if (x < adjustedAdvance) {
    189                 CFIndex hitGlyphStart = complexTextRun.indexAt(j);
    190                 CFIndex hitGlyphEnd;
     189                unsigned hitGlyphStart = complexTextRun.indexAt(j);
     190                unsigned hitGlyphEnd;
    191191                if (m_run.ltr())
    192                     hitGlyphEnd = std::max<CFIndex>(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : static_cast<CFIndex>(complexTextRun.indexEnd()));
     192                    hitGlyphEnd = std::max(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : complexTextRun.indexEnd());
    193193                else
    194                     hitGlyphEnd = std::max<CFIndex>(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun.indexEnd()));
     194                    hitGlyphEnd = std::max(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : complexTextRun.indexEnd());
    195195
    196196                // FIXME: Instead of dividing the glyph's advance equally between the characters, this
    197197                // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
    198                 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
    199                 int stringLength = complexTextRun.stringLength();
     198                unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
     199                unsigned stringLength = complexTextRun.stringLength();
    200200                UBreakIterator* cursorPositionIterator = cursorMovementIterator(StringView(complexTextRun.characters(), stringLength));
    201                 int clusterStart;
     201                unsigned clusterStart;
    202202                if (ubrk_isBoundary(cursorPositionIterator, hitIndex))
    203203                    clusterStart = hitIndex;
    204204                else {
    205                     clusterStart = ubrk_preceding(cursorPositionIterator, hitIndex);
    206                     if (clusterStart == UBRK_DONE)
    207                         clusterStart = 0;
     205                    int preceeding = ubrk_preceding(cursorPositionIterator, hitIndex);
     206                    clusterStart = preceeding == UBRK_DONE ? 0 : preceeding;
    208207                }
    209208
     
    211210                    return complexTextRun.stringLocation() + clusterStart;
    212211
    213                 int clusterEnd = ubrk_following(cursorPositionIterator, hitIndex);
    214                 if (clusterEnd == UBRK_DONE)
    215                     clusterEnd = stringLength;
    216 
    217                 CGFloat clusterWidth;
     212                int following = ubrk_following(cursorPositionIterator, hitIndex);
     213                unsigned clusterEnd = following == UBRK_DONE ? stringLength : following;
     214
     215                float clusterWidth;
    218216                // FIXME: The search stops at the boundaries of complexTextRun. In theory, it should go on into neighboring ComplexTextRuns
    219217                // derived from the same CTLine. In practice, we do not expect there to be more than one CTRun in a CTLine, as no
     
    221219                if (clusterEnd - clusterStart > 1) {
    222220                    clusterWidth = adjustedAdvance;
    223                     int firstGlyphBeforeCluster = j - 1;
    224                     while (firstGlyphBeforeCluster >= 0 && complexTextRun.indexAt(firstGlyphBeforeCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphBeforeCluster) < clusterEnd) {
    225                         CGFloat width = m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width;
    226                         clusterWidth += width;
    227                         x += width;
    228                         firstGlyphBeforeCluster--;
     221                    if (j) {
     222                        unsigned firstGlyphBeforeCluster = j - 1;
     223                        while (complexTextRun.indexAt(firstGlyphBeforeCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphBeforeCluster) < clusterEnd) {
     224                            float width = m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width();
     225                            clusterWidth += width;
     226                            x += width;
     227                            if (!firstGlyphBeforeCluster)
     228                                break;
     229                            firstGlyphBeforeCluster--;
     230                        }
    229231                    }
    230232                    unsigned firstGlyphAfterCluster = j + 1;
    231233                    while (firstGlyphAfterCluster < complexTextRun.glyphCount() && complexTextRun.indexAt(firstGlyphAfterCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphAfterCluster) < clusterEnd) {
    232                         clusterWidth += m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width;
     234                        clusterWidth += m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width();
    233235                        firstGlyphAfterCluster++;
    234236                    }
     
    239241                if (x <= clusterWidth / 2)
    240242                    return complexTextRun.stringLocation() + (m_run.ltr() ? clusterStart : clusterEnd);
    241                 else
    242                     return complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart);
     243                return complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart);
    243244            }
    244245            x -= adjustedAdvance;
     
    271272    while (iterator < end) {
    272273        UChar32 nextCharacter;
    273         int markLength = 0;
     274        unsigned markLength = 0;
    274275        bool shouldContinue = false;
    275         U16_NEXT(iterator, markLength, end - iterator, nextCharacter);
     276        ASSERT(end >= iterator);
     277        U16_NEXT(iterator, markLength, static_cast<unsigned>(end - iterator), nextCharacter);
    276278
    277279        if (isVariationSelector(nextCharacter) || isEmojiFitzpatrickModifier(nextCharacter))
     
    454456}
    455457
    456 CFIndex ComplexTextController::ComplexTextRun::indexAt(size_t i) const
     458unsigned ComplexTextController::ComplexTextRun::indexAt(unsigned i) const
    457459{
    458460    ASSERT(i < m_glyphCount);
     
    467469
    468470    Vector<bool, 64> mappedIndices(m_stringLength, false);
    469     for (size_t i = 0; i < m_glyphCount; ++i) {
    470         ASSERT(indexAt(i) < static_cast<CFIndex>(m_stringLength));
     471    for (unsigned i = 0; i < m_glyphCount; ++i) {
     472        ASSERT(indexAt(i) < m_stringLength);
    471473        mappedIndices[indexAt(i)] = true;
    472474    }
     
    474476    m_glyphEndOffsets.grow(m_glyphCount);
    475477    for (unsigned i = 0; i < m_glyphCount; ++i) {
    476         CFIndex nextMappedIndex = m_indexEnd;
    477         for (size_t j = indexAt(i) + 1; j < m_stringLength; ++j) {
     478        unsigned nextMappedIndex = m_indexEnd;
     479        for (unsigned j = indexAt(i) + 1; j < m_stringLength; ++j) {
    478480            if (mappedIndices[j]) {
    479481                nextMappedIndex = j;
     
    581583        const ComplexTextRun& complexTextRun = *m_complexTextRuns[currentRunIndex];
    582584        bool ltr = complexTextRun.isLTR();
    583         size_t glyphCount = complexTextRun.glyphCount();
     585        unsigned glyphCount = complexTextRun.glyphCount();
    584586        unsigned glyphIndexIntoCurrentRun = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun;
    585587        unsigned glyphIndexIntoComplexTextController = indexOfLeftmostGlyphInCurrentRun + glyphIndexIntoCurrentRun;
     
    591593        // account the text direction.
    592594        if (!indexOfLeftmostGlyphInCurrentRun && glyphBuffer)
    593             glyphBuffer->setInitialAdvance(complexTextRun.initialAdvance());
     595            glyphBuffer->setInitialAdvance(GlyphBufferAdvance(complexTextRun.initialAdvance().width(), complexTextRun.initialAdvance().height()));
    594596
    595597        while (m_glyphInCurrentRun < glyphCount) {
     
    598600            if (complexTextRun.isMonotonic()) {
    599601                if (ltr)
    600                     glyphEndOffset = std::max<unsigned>(glyphStartOffset, static_cast<unsigned>(glyphIndexIntoCurrentRun + 1 < glyphCount ? complexTextRun.indexAt(glyphIndexIntoCurrentRun + 1) : complexTextRun.indexEnd()));
     602                    glyphEndOffset = std::max(glyphStartOffset, glyphIndexIntoCurrentRun + 1 < glyphCount ? complexTextRun.indexAt(glyphIndexIntoCurrentRun + 1) : complexTextRun.indexEnd());
    601603                else
    602                     glyphEndOffset = std::max<unsigned>(glyphStartOffset, static_cast<unsigned>(glyphIndexIntoCurrentRun > 0 ? complexTextRun.indexAt(glyphIndexIntoCurrentRun - 1) : complexTextRun.indexEnd()));
     604                    glyphEndOffset = std::max(glyphStartOffset, glyphIndexIntoCurrentRun > 0 ? complexTextRun.indexAt(glyphIndexIntoCurrentRun - 1) : complexTextRun.indexEnd());
    603605            } else
    604606                glyphEndOffset = complexTextRun.endOffsetAt(glyphIndexIntoCurrentRun);
    605607
    606             CGSize adjustedBaseAdvance = m_adjustedBaseAdvances[glyphIndexIntoComplexTextController];
     608            FloatSize adjustedBaseAdvance = m_adjustedBaseAdvances[glyphIndexIntoComplexTextController];
    607609
    608610            if (glyphStartOffset + complexTextRun.stringLocation() >= m_currentCharacter)
     
    611613            if (glyphBuffer && !m_characterInCurrentGlyph) {
    612614                auto currentGlyphOrigin = glyphOrigin(glyphIndexIntoComplexTextController);
    613                 GlyphBufferAdvance paintAdvance = adjustedBaseAdvance;
     615                GlyphBufferAdvance paintAdvance(adjustedBaseAdvance);
    614616                if (!glyphIndexIntoCurrentRun) {
    615617                    // The first layout advance of every run includes the "initial layout advance." However, here, we need
    616618                    // paint advances, so subtract it out before transforming the layout advance into a paint advance.
    617                     paintAdvance.setWidth(paintAdvance.width() - (complexTextRun.initialAdvance().width - currentGlyphOrigin.x));
    618                     paintAdvance.setHeight(paintAdvance.height() - (complexTextRun.initialAdvance().height - currentGlyphOrigin.y));
     619                    paintAdvance.setWidth(paintAdvance.width() - (complexTextRun.initialAdvance().width() - currentGlyphOrigin.x()));
     620                    paintAdvance.setHeight(paintAdvance.height() - (complexTextRun.initialAdvance().height() - currentGlyphOrigin.y()));
    619621                }
    620                 paintAdvance.setWidth(paintAdvance.width() + glyphOrigin(glyphIndexIntoComplexTextController + 1).x - currentGlyphOrigin.x);
    621                 paintAdvance.setHeight(paintAdvance.height() + glyphOrigin(glyphIndexIntoComplexTextController + 1).y - currentGlyphOrigin.y);
     622                paintAdvance.setWidth(paintAdvance.width() + glyphOrigin(glyphIndexIntoComplexTextController + 1).x() - currentGlyphOrigin.x());
     623                paintAdvance.setHeight(paintAdvance.height() + glyphOrigin(glyphIndexIntoComplexTextController + 1).y() - currentGlyphOrigin.y());
    622624                if (glyphIndexIntoCurrentRun == glyphCount - 1 && currentRunIndex + 1 < runCount) {
    623625                    // Our paint advance points to the end of the run. However, the next run may have an
    624626                    // initial advance, and our paint advance needs to point to the location of the next
    625627                    // glyph. So, we need to add in the next run's initial advance.
    626                     paintAdvance.setWidth(paintAdvance.width() - glyphOrigin(glyphIndexIntoComplexTextController + 1).x + m_complexTextRuns[currentRunIndex + 1]->initialAdvance().width);
    627                     paintAdvance.setHeight(paintAdvance.height() - glyphOrigin(glyphIndexIntoComplexTextController + 1).y + m_complexTextRuns[currentRunIndex + 1]->initialAdvance().height);
     628                    paintAdvance.setWidth(paintAdvance.width() - glyphOrigin(glyphIndexIntoComplexTextController + 1).x() + m_complexTextRuns[currentRunIndex + 1]->initialAdvance().width());
     629                    paintAdvance.setHeight(paintAdvance.height() - glyphOrigin(glyphIndexIntoComplexTextController + 1).y() + m_complexTextRuns[currentRunIndex + 1]->initialAdvance().height());
    628630                }
    629631                paintAdvance.setHeight(-paintAdvance.height()); // Increasing y points down
     
    633635            unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
    634636            m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset;
    635             m_runWidthSoFar += adjustedBaseAdvance.width * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle);
     637            m_runWidthSoFar += adjustedBaseAdvance.width() * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle);
    636638
    637639            if (glyphEndOffset + complexTextRun.stringLocation() > m_currentCharacter)
     
    682684{
    683685    bool afterExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion;
    684     CGFloat widthSinceLastCommit = 0;
     686    float widthSinceLastCommit = 0;
    685687    size_t runCount = m_complexTextRuns.size();
    686688    bool hasExtraSpacing = (m_font.letterSpacing() || m_font.wordSpacing() || m_expansion) && !m_run.spacingDisabled();
     
    700702
    701703        const CGGlyph* glyphs = complexTextRun.glyphs();
    702         const CGSize* advances = complexTextRun.baseAdvances();
     704        const FloatSize* advances = complexTextRun.baseAdvances();
    703705
    704706        bool lastRun = runIndex + 1 == runCount;
    705707        float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
    706708        const UChar* cp = complexTextRun.characters();
    707         CGPoint glyphOrigin = CGPointZero;
    708         CFIndex lastCharacterIndex = m_run.ltr() ? std::numeric_limits<CFIndex>::min() : std::numeric_limits<CFIndex>::max();
     709        FloatPoint glyphOrigin;
     710        unsigned lastCharacterIndex = m_run.ltr() ? std::numeric_limits<unsigned>::min() : std::numeric_limits<unsigned>::max();
    709711        bool isMonotonic = true;
    710712
    711713        for (unsigned i = 0; i < glyphCount; i++) {
    712             CFIndex characterIndex = complexTextRun.indexAt(i);
     714            unsigned characterIndex = complexTextRun.indexAt(i);
    713715            if (m_run.ltr()) {
    714716                if (characterIndex < lastCharacterIndex)
     
    730732            bool treatAsSpace = FontCascade::treatAsSpace(ch);
    731733            CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
    732             CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
     734            FloatSize advance = treatAsSpace ? FloatSize(spaceWidth, advances[i].height()) : advances[i];
    733735
    734736            if (ch == '\t' && m_run.allowTabs())
    735                 advance.width = m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
     737                advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit));
    736738            else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
    737                 advance.width = 0;
     739                advance.setWidth(0);
    738740                glyph = font.spaceGlyph();
    739741            }
    740742
    741743            if (!i) {
    742                 advance.width += complexTextRun.initialAdvance().width;
    743                 advance.height += complexTextRun.initialAdvance().height;
    744                 if (auto* origins = complexTextRun.glyphOrigins()) {
    745                     advance.width -= origins[0].x;
    746                     advance.height -= origins[0].y;
    747                 }
    748             }
    749 
    750             advance.width += font.syntheticBoldOffset();
     744                advance.expand(complexTextRun.initialAdvance().width(), complexTextRun.initialAdvance().height());
     745                if (auto* origins = complexTextRun.glyphOrigins())
     746                    advance.expand(-origins[0].x(), -origins[0].y());
     747            }
     748
     749            advance.expand(font.syntheticBoldOffset(), 0);
    751750
    752751            if (hasExtraSpacing) {
    753752                // If we're a glyph with an advance, add in letter-spacing.
    754                 // That way we weed out zero width lurkers.  This behavior matches the fast text code path.
    755                 if (advance.width)
    756                     advance.width += m_font.letterSpacing();
     753                // That way we weed out zero width lurkers. This behavior matches the fast text code path.
     754                if (advance.width())
     755                    advance.expand(m_font.letterSpacing(), 0);
    757756
    758757                unsigned characterIndexInRun = characterIndex + complexTextRun.stringLocation();
    759758                bool isFirstCharacter = !(characterIndex + complexTextRun.stringLocation());
    760                 bool isLastCharacter = static_cast<unsigned>(characterIndexInRun + 1) == m_run.length() || (U16_IS_LEAD(ch) && static_cast<unsigned>(characterIndexInRun + 2) == m_run.length() && U16_IS_TRAIL(*(cp + characterIndex + 1)));
     759                bool isLastCharacter = characterIndexInRun + 1 == m_run.length() || (U16_IS_LEAD(ch) && characterIndexInRun + 2 == m_run.length() && U16_IS_TRAIL(*(cp + characterIndex + 1)));
    761760
    762761                bool forceLeadingExpansion = false; // On the left, regardless of m_run.ltr()
     
    780779                        std::tie(expandLeft, expandRight) = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), afterExpansion, forbidLeadingExpansion, forbidTrailingExpansion, forceLeadingExpansion, forceTrailingExpansion);
    781780                        m_expansion -= m_expansionPerOpportunity;
    782                         advance.width += m_expansionPerOpportunity;
     781                        advance.expand(m_expansionPerOpportunity, 0);
    783782                        if (expandLeft) {
    784783                            // Increase previous width
     
    786785                                complexTextRun.growInitialAdvanceHorizontally(m_expansionPerOpportunity);
    787786                            else
    788                                 m_adjustedBaseAdvances.last().width += m_expansionPerOpportunity;
     787                                m_adjustedBaseAdvances.last().expand(m_expansionPerOpportunity, 0);
    789788                        }
    790789                        if (expandRight)
     
    795794                    // Account for word-spacing.
    796795                    if (treatAsSpace && (ch != '\t' || !m_run.allowTabs()) && (characterIndex > 0 || runIndex > 0) && m_font.wordSpacing())
    797                         advance.width += m_font.wordSpacing();
     796                        advance.expand(m_font.wordSpacing(), 0);
    798797                } else
    799798                    afterExpansion = false;
    800799            }
    801800
    802             widthSinceLastCommit += advance.width;
     801            widthSinceLastCommit += advance.width();
    803802
    804803            // FIXME: Combining marks should receive a text emphasis mark if they are combine with a space.
     
    816815           
    817816            FloatRect glyphBounds = font.boundsForGlyph(glyph);
    818             glyphBounds.move(glyphOrigin.x, glyphOrigin.y);
     817            glyphBounds.move(glyphOrigin.x(), glyphOrigin.y());
    819818            m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x());
    820819            m_maxGlyphBoundingBoxX = std::max(m_maxGlyphBoundingBoxX, glyphBounds.maxX());
    821820            m_minGlyphBoundingBoxY = std::min(m_minGlyphBoundingBoxY, glyphBounds.y());
    822821            m_maxGlyphBoundingBoxY = std::max(m_maxGlyphBoundingBoxY, glyphBounds.maxY());
    823             glyphOrigin.x += advance.width;
    824             glyphOrigin.y += advance.height;
     822            glyphOrigin.move(advance);
    825823           
    826824            lastCharacterIndex = characterIndex;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r211382 r211765  
    2323 */
    2424
    25 #ifndef ComplexTextController_h
    26 #define ComplexTextController_h
    27 
     25#pragma once
     26
     27#include "FloatPoint.h"
    2828#include "GlyphBuffer.h"
    2929#include <wtf/HashSet.h>
     
    4040typedef const struct __CTLine * CTLineRef;
    4141
    42 namespace WTF {
    43 template<> struct VectorTraits<CGPoint> : SimpleClassVectorTraits { };
    44 }
    45 
    4642namespace WebCore {
    4743
     
    7975    class ComplexTextRun : public RefCounted<ComplexTextRun> {
    8076    public:
    81         static Ref<ComplexTextRun> create(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
     77        static Ref<ComplexTextRun> create(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
    8278        {
    83             return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, runRange));
     79            return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, indexBegin, indexEnd));
    8480        }
    8581
    86         static Ref<ComplexTextRun> create(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
     82        static Ref<ComplexTextRun> create(const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
    8783        {
    88             return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr));
     84            return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, indexBegin, indexEnd, ltr));
    8985        }
    9086
    91         static Ref<ComplexTextRun> createForTesting(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
     87        static Ref<ComplexTextRun> create(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
    9288        {
    93             return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, runRange, ltr));
     89            return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, indexBegin, indexEnd, ltr));
    9490        }
    9591
     
    9894        const UChar* characters() const { return m_characters; }
    9995        unsigned stringLocation() const { return m_stringLocation; }
    100         size_t stringLength() const { return m_stringLength; }
    101         ALWAYS_INLINE CFIndex indexAt(size_t i) const;
    102         CFIndex indexBegin() const { return m_indexBegin; }
    103         CFIndex indexEnd() const { return m_indexEnd; }
    104         CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
    105         const CGGlyph* glyphs() const { return m_glyphs; }
     96        unsigned stringLength() const { return m_stringLength; }
     97        ALWAYS_INLINE unsigned indexAt(unsigned) const;
     98        unsigned indexBegin() const { return m_indexBegin; }
     99        unsigned indexEnd() const { return m_indexEnd; }
     100        unsigned endOffsetAt(unsigned i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
     101        const CGGlyph* glyphs() const { return m_glyphs.data(); }
    106102
    107103        /*
     
    132128         * (text position ^)                (layout advance)                       (layout advance)           (layout advance)
    133129         */
    134         void growInitialAdvanceHorizontally(CGFloat delta) { m_initialAdvance.width += delta; }
    135         CGSize initialAdvance() const { return m_initialAdvance; }
    136         const CGSize* baseAdvances() const { return m_baseAdvances; }
    137         const CGPoint* glyphOrigins() const { return m_glyphOrigins.size() == glyphCount() ? m_glyphOrigins.data() : nullptr; }
     130        void growInitialAdvanceHorizontally(float delta) { m_initialAdvance.expand(delta, 0); }
     131        FloatSize initialAdvance() const { return m_initialAdvance; }
     132        const FloatSize* baseAdvances() const { return m_baseAdvances.data(); }
     133        const FloatPoint* glyphOrigins() const { return m_glyphOrigins.size() == glyphCount() ? m_glyphOrigins.data() : nullptr; }
    138134        bool isLTR() const { return m_isLTR; }
    139135        bool isMonotonic() const { return m_isMonotonic; }
     
    141137
    142138    private:
    143         ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
    144         ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
    145         WEBCORE_EXPORT ComplexTextRun(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr);
    146 
    147         Vector<CGSize, 64> m_baseAdvancesVector;
    148         Vector<CGPoint, 64> m_glyphOrigins;
    149         Vector<CGGlyph, 64> m_glyphsVector;
    150         Vector<CFIndex, 64> m_glyphEndOffsets;
    151         Vector<CFIndex, 64> m_coreTextIndicesVector;
    152         CGSize m_initialAdvance;
     139        ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd);
     140        ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
     141        WEBCORE_EXPORT ComplexTextRun(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
     142
     143        Vector<FloatSize, 64> m_baseAdvances;
     144        Vector<FloatPoint, 64> m_glyphOrigins;
     145        Vector<CGGlyph, 64> m_glyphs;
     146        Vector<unsigned, 64> m_glyphEndOffsets;
     147        Vector<unsigned, 64> m_coreTextIndices;
     148        FloatSize m_initialAdvance;
    153149        const Font& m_font;
    154150        const UChar* m_characters;
    155         size_t m_stringLength;
    156         const CFIndex* m_coreTextIndices;
    157         const CGGlyph* m_glyphs;
    158         const CGSize* m_baseAdvances;
    159         CFIndex m_indexBegin;
    160         CFIndex m_indexEnd;
     151        unsigned m_stringLength;
     152        unsigned m_indexBegin;
     153        unsigned m_indexEnd;
    161154        unsigned m_glyphCount;
    162155        unsigned m_stringLocation;
     
    181174    float runWidthSoFarFraction(unsigned glyphStartOffset, unsigned glyphEndOffset, unsigned oldCharacterInCurrentGlyph, GlyphIterationStyle) const;
    182175
    183     CGPoint glyphOrigin(unsigned index) const { return index < m_glyphOrigins.size() ? m_glyphOrigins[index] : CGPointZero; }
    184 
    185     Vector<CGSize, 256> m_adjustedBaseAdvances;
    186     Vector<CGPoint, 256> m_glyphOrigins;
     176    FloatPoint glyphOrigin(unsigned index) const { return index < m_glyphOrigins.size() ? m_glyphOrigins[index] : FloatPoint(); }
     177
     178    Vector<FloatSize, 256> m_adjustedBaseAdvances;
     179    Vector<FloatPoint, 256> m_glyphOrigins;
    187180    Vector<CGGlyph, 256> m_adjustedGlyphs;
    188181
     
    211204    const FontCascade& m_font;
    212205    const TextRun& m_run;
    213  
     206
    214207    unsigned m_currentCharacter { 0 };
    215208    unsigned m_end { 0 };
     
    235228
    236229} // namespace WebCore
    237 
    238 #endif // ComplexTextController_h
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

    r211308 r211765  
    4343#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 90000)
    4444SOFT_LINK_FRAMEWORK(CoreText);
    45 SOFT_LINK(CoreText, CTRunGetBaseAdvancesAndOrigins, void, (CTRunRef run, CFRange range, CGSize baseAdvances[], CGPoint origins[]), (run, range, baseAdvances, origins))
     45SOFT_LINK(CoreText, CTRunGetBaseAdvancesAndOrigins, void, (CTRunRef run, CFRange range, FloatSize baseAdvances[], FloatPoint origins[]), (run, range, baseAdvances, origins))
    4646#endif
    47 
    4847
    4948// Note: CTFontDescriptorRefs can live forever in caches inside CoreText, so this object can too.
     
    107106namespace WebCore {
    108107
    109 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
     108ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
    110109    : m_initialAdvance(CTRunGetInitialAdvance(ctRun))
    111110    , m_font(font)
    112111    , m_characters(characters)
    113112    , m_stringLength(stringLength)
    114     , m_coreTextIndices(CTRunGetStringIndicesPtr(ctRun))
    115     , m_glyphs(CTRunGetGlyphsPtr(ctRun))
    116     , m_indexBegin(runRange.location)
    117     , m_indexEnd(runRange.location + runRange.length)
     113    , m_indexBegin(indexBegin)
     114    , m_indexEnd(indexEnd)
    118115    , m_glyphCount(CTRunGetGlyphCount(ctRun))
    119116    , m_stringLocation(stringLocation)
    120117    , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft))
    121118{
    122     if (!m_coreTextIndices) {
    123         m_coreTextIndicesVector.grow(m_glyphCount);
    124         CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), m_coreTextIndicesVector.data());
    125         m_coreTextIndices = m_coreTextIndicesVector.data();
    126     }
    127 
    128     if (!m_glyphs) {
    129         m_glyphsVector.grow(m_glyphCount);
    130         CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), m_glyphsVector.data());
    131         m_glyphs = m_glyphsVector.data();
    132     }
     119    const CFIndex* coreTextIndicesPtr = CTRunGetStringIndicesPtr(ctRun);
     120    Vector<CFIndex> coreTextIndices;
     121    if (!coreTextIndicesPtr) {
     122        coreTextIndices.grow(m_glyphCount);
     123        CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), coreTextIndices.data());
     124        coreTextIndicesPtr = coreTextIndices.data();
     125    }
     126    m_coreTextIndices.reserveInitialCapacity(m_glyphCount);
     127    for (unsigned i = 0; i < m_glyphCount; ++i)
     128        m_coreTextIndices.uncheckedAppend(coreTextIndicesPtr[i]);
     129
     130    const CGGlyph* glyphsPtr = CTRunGetGlyphsPtr(ctRun);
     131    Vector<CGGlyph> glyphs;
     132    if (!glyphsPtr) {
     133        glyphs.grow(m_glyphCount);
     134        CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), glyphs.data());
     135        glyphsPtr = glyphs.data();
     136    }
     137    m_glyphs.reserveInitialCapacity(m_glyphCount);
     138    for (unsigned i = 0; i < m_glyphCount; ++i)
     139        m_glyphs.uncheckedAppend(glyphsPtr[i]);
    133140
    134141#if USE_LAYOUT_SPECIFIC_ADVANCES
    135142    if (CTRunGetStatus(ctRun) & kCTRunStatusHasOrigins) {
    136         m_baseAdvancesVector.grow(m_glyphCount);
    137         m_glyphOrigins.grow(m_glyphCount);
    138         CTRunGetBaseAdvancesAndOrigins(ctRun, CFRangeMake(0, 0), m_baseAdvancesVector.data(), m_glyphOrigins.data());
    139         m_baseAdvances = m_baseAdvancesVector.data();
     143        Vector<CGSize> baseAdvances(m_glyphCount);
     144        Vector<CGPoint> glyphOrigins(m_glyphCount);
     145        CTRunGetBaseAdvancesAndOrigins(ctRun, CFRangeMake(0, 0), baseAdvances.data(), glyphOrigins.data());
     146        m_baseAdvances.reserveInitialCapacity(m_glyphCount);
     147        m_glyphOrigins.reserveInitialCapacity(m_glyphCount);
     148        for (unsigned i = 0; i < m_glyphCount; ++i) {
     149            m_baseAdvances.uncheckedAppend(baseAdvances[i]);
     150            m_glyphOrigins.uncheckedAppend(glyphOrigins[i]);
     151        }
    140152    } else
    141153#endif
    142154    {
    143         m_baseAdvances = CTRunGetAdvancesPtr(ctRun);
    144         if (!m_baseAdvances) {
    145             m_baseAdvancesVector.grow(m_glyphCount);
    146             CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_baseAdvancesVector.data());
    147             m_baseAdvances = m_baseAdvancesVector.data();
     155        const CGSize* baseAdvances = CTRunGetAdvancesPtr(ctRun);
     156        Vector<CGSize> baseAdvancesVector;
     157        if (!baseAdvances) {
     158            baseAdvancesVector.grow(m_glyphCount);
     159            CTRunGetAdvances(ctRun, CFRangeMake(0, 0), baseAdvancesVector.data());
     160            baseAdvances = baseAdvancesVector.data();
    148161        }
     162        m_baseAdvances.reserveInitialCapacity(m_glyphCount);
     163        for (unsigned i = 0; i < m_glyphCount; ++i)
     164            m_baseAdvances.uncheckedAppend(baseAdvances[i]);
    149165    }
    150166}
     
    152168// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
    153169// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
    154 ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
    155     : m_initialAdvance(CGSizeZero)
    156     , m_font(font)
     170ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
     171    : m_font(font)
    157172    , m_characters(characters)
    158173    , m_stringLength(stringLength)
    159     , m_indexBegin(0)
    160     , m_indexEnd(stringLength)
     174    , m_indexBegin(indexBegin)
     175    , m_indexEnd(indexEnd)
    161176    , m_stringLocation(stringLocation)
    162177    , m_isLTR(ltr)
    163178{
    164     m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength);
    165     unsigned r = 0;
    166     while (r < m_stringLength) {
    167         m_coreTextIndicesVector.uncheckedAppend(r);
     179    auto runLengthInCodeUnits = m_indexEnd - m_indexBegin;
     180    m_coreTextIndices.reserveInitialCapacity(runLengthInCodeUnits);
     181    unsigned r = m_indexBegin;
     182    while (r < m_indexEnd) {
     183        m_coreTextIndices.uncheckedAppend(r);
    168184        UChar32 character;
    169185        U16_NEXT(m_characters, r, m_stringLength, character);
    170186    }
    171     m_glyphCount = m_coreTextIndicesVector.size();
     187    m_glyphCount = m_coreTextIndices.size();
    172188    if (!ltr) {
    173189        for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
    174             std::swap(m_coreTextIndicesVector[r], m_coreTextIndicesVector[end]);
    175     }
    176     m_coreTextIndices = m_coreTextIndicesVector.data();
     190            std::swap(m_coreTextIndices[r], m_coreTextIndices[end]);
     191    }
    177192
    178193    // Synthesize a run of missing glyphs.
    179     m_glyphsVector.fill(0, m_glyphCount);
    180     m_glyphs = m_glyphsVector.data();
    181     m_baseAdvancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
    182     m_baseAdvances = m_baseAdvancesVector.data();
    183 }
    184 
    185 
    186 ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
    187     : m_baseAdvancesVector(advances)
     194    m_glyphs.fill(0, m_glyphCount);
     195    m_baseAdvances.fill(FloatSize(m_font.widthForGlyph(0), 0), m_glyphCount);
     196}
     197
     198
     199ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
     200    : m_baseAdvances(advances)
    188201    , m_glyphOrigins(origins)
    189     , m_glyphsVector(glyphs)
    190     , m_coreTextIndicesVector(stringIndices)
     202    , m_glyphs(glyphs)
     203    , m_coreTextIndices(stringIndices)
    191204    , m_initialAdvance(initialAdvance)
    192205    , m_font(font)
    193206    , m_characters(characters)
    194207    , m_stringLength(stringLength)
    195     , m_coreTextIndices(m_coreTextIndicesVector.data())
    196     , m_glyphs(m_glyphsVector.data())
    197     , m_baseAdvances(m_baseAdvancesVector.data())
    198     , m_indexBegin(runRange.location)
    199     , m_indexEnd(runRange.location + runRange.length)
     208    , m_indexBegin(indexBegin)
     209    , m_indexEnd(indexEnd)
    200210    , m_glyphCount(glyphs.size())
    201211    , m_stringLocation(stringLocation)
     
    230240    if (!font) {
    231241        // Create a run of missing glyphs from the primary font.
    232         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr()));
     242        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, 0, length, m_run.ltr()));
    233243        return;
    234244    }
     
    314324                    RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runCTFont));
    315325                    if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
    316                         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
     326                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, runRange.location, runRange.location + runRange.length, m_run.ltr()));
    317327                        continue;
    318328                    }
     
    333343            m_fallbackFonts->add(font);
    334344
    335         m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange));
     345        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange.location, runRange.location + runRange.length));
    336346    }
    337347}
  • trunk/Tools/ChangeLog

    r211763 r211765  
     12017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Migrate ComplexTextController to use platform-independent types
     4        https://bugs.webkit.org/show_bug.cgi?id=167833
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Migrate tests away from platform-dependent types.
     9
     10        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
     11        (TestWebKitAPI::TEST_F):
     12
    1132017-02-06  Brent Fulgham  <bfulgham@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

    r211382 r211765  
    5656
    5757#if USE_LAYOUT_SPECIFIC_ADVANCES
    58     Vector<CGSize> advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
    59     Vector<CGPoint> origins = { CGPointMake(-15.15625, 18.046875), CGPointZero, CGPointZero, CGPointZero, CGPointZero };
     58    Vector<FloatSize> advances = { FloatSize(), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
     59    Vector<FloatPoint> origins = { FloatPoint(-15.15625, 18.046875), FloatPoint(), FloatPoint(), FloatPoint(), FloatPoint() };
    6060#else
    61     Vector<CGSize> advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
    62     Vector<CGPoint> origins = { };
     61    Vector<FloatSize> advances = { FloatSize(15.15625, -18.046875), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
     62    Vector<FloatPoint> origins = { };
    6363#endif
    6464
    65     CGSize initialAdvance = CGSizeMake(-15.15625, 18.046875);
     65    FloatSize initialAdvance = FloatSize(-15.15625, 18.046875);
    6666
    6767    UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b, 0x20 };
    6868    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    6969    TextRun textRun(StringView(characters, charactersLength));
    70     auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
    71     auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
     70    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(21.875, 0) }, { FloatPoint() }, { 5 }, { 5 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 5, 6, false);
     71    auto run2 = ComplexTextController::ComplexTextRun::create(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 5, false);
    7272    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    7373    runs.append(WTFMove(run1));
     
    7777    CGFloat totalWidth = 0;
    7878    for (size_t i = 1; i < advances.size(); ++i)
    79         totalWidth += advances[i].width;
     79        totalWidth += advances[i].width();
    8080    EXPECT_NEAR(controller.totalWidth(), spaceWidth + totalWidth, 0.0001);
    8181    GlyphBuffer glyphBuffer;
     
    8484    EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
    8585    controller.advance(1, &glyphBuffer);
    86     EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width, 0.0001);
     86    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width(), 0.0001);
    8787    controller.advance(6, &glyphBuffer);
    8888    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + totalWidth, 0.0001);
     
    9090    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), 0, 0.0001);
    9191    EXPECT_EQ(glyphBuffer.size(), 6U);
    92     EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width, 0.0001);
    93     EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width, 0.0001);
    94     EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width, 0.0001);
    95     EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width, 0.0001);
    96     EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width, 0.0001);
    97     EXPECT_NEAR(glyphBuffer.advanceAt(5).width(), spaceWidth + initialAdvance.width, 0.0001);
     92    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width(), 0.0001);
     93    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width(), 0.0001);
     94    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width(), 0.0001);
     95    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width(), 0.0001);
     96    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width(), 0.0001);
     97    EXPECT_NEAR(glyphBuffer.advanceAt(5).width(), spaceWidth + initialAdvance.width(), 0.0001);
    9898}
    9999
     
    107107
    108108#if USE_LAYOUT_SPECIFIC_ADVANCES
    109     Vector<CGSize> advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
    110     Vector<CGPoint> origins = { CGPointMake(-15.15625, 18.046875), CGPointZero, CGPointZero, CGPointZero, CGPointZero };
     109    Vector<FloatSize> advances = { FloatSize(), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
     110    Vector<FloatPoint> origins = { FloatPoint(-15.15625, 18.046875), FloatPoint(), FloatPoint(), FloatPoint(), FloatPoint() };
    111111#else
    112     Vector<CGSize> advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
    113     Vector<CGPoint> origins = { };
     112    Vector<FloatSize> advances = { FloatSize(15.15625, -18.046875), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
     113    Vector<FloatPoint> origins = { };
    114114#endif
    115115
    116     CGSize initialAdvance = CGSizeMake(-15.15625, 18.046875);
     116    FloatSize initialAdvance = FloatSize(-15.15625, 18.046875);
    117117
    118118    UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b };
    119119    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    120120    TextRun textRun(StringView(characters, charactersLength));
    121     auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
     121    auto run = ComplexTextController::ComplexTextRun::create(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 5, false);
    122122    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    123123    runs.append(WTFMove(run));
     
    126126    CGFloat totalWidth = 0;
    127127    for (size_t i = 1; i < advances.size(); ++i)
    128         totalWidth += advances[i].width;
     128        totalWidth += advances[i].width();
    129129    EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
    130130    GlyphBuffer glyphBuffer;
     
    133133    EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
    134134    controller.advance(1, &glyphBuffer);
    135     EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width, 0.0001);
     135    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width(), 0.0001);
    136136    controller.advance(5, &glyphBuffer);
    137137    EXPECT_NEAR(controller.runWidthSoFar(), totalWidth, 0.0001);
    138     EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
    139     EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
     138    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
     139    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
    140140    EXPECT_EQ(glyphBuffer.size(), 5U);
    141     EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width, 0.0001);
    142     EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width, 0.0001);
    143     EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width, 0.0001);
    144     EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width, 0.0001);
    145     EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width, 0.0001);
    146     EXPECT_NEAR(glyphBuffer.advanceAt(4).height(), initialAdvance.height, 0.0001);
     141    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width(), 0.0001);
     142    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width(), 0.0001);
     143    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width(), 0.0001);
     144    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width(), 0.0001);
     145    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width(), 0.0001);
     146    EXPECT_NEAR(glyphBuffer.advanceAt(4).height(), initialAdvance.height(), 0.0001);
    147147}
    148148
     
    157157
    158158#if USE_LAYOUT_SPECIFIC_ADVANCES
    159     Vector<CGSize> advances = { CGSizeMake(76.347656, 0.000000), CGSizeMake(0.000000, 0.000000) };
    160     Vector<CGPoint> origins = { CGPointZero, CGPointMake(-23.281250, -8.398438) };
     159    Vector<FloatSize> advances = { FloatSize(76.347656, 0.000000), FloatSize(0.000000, 0.000000) };
     160    Vector<FloatPoint> origins = { FloatPoint(), FloatPoint(-23.281250, -8.398438) };
    161161#else
    162     Vector<CGSize> advances = { CGSizeMake(53.066406, -8.398438), CGSizeMake(23.281250, 8.398438) };
    163     Vector<CGPoint> origins = { };
     162    Vector<FloatSize> advances = { FloatSize(53.066406, -8.398438), FloatSize(23.281250, 8.398438) };
     163    Vector<FloatPoint> origins = { };
    164164#endif
    165165
    166     CGSize initialAdvance = CGSizeMake(28.144531, 0);
     166    FloatSize initialAdvance = FloatSize(28.144531, 0);
    167167
    168168    UChar characters[] = { 0x20, 0x61, 0x20e3 };
    169169    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    170170    TextRun textRun(StringView(characters, charactersLength));
    171     auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
    172     auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
     171    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(spaceWidth, 0) }, { FloatPoint() }, { 5 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, true);
     172    auto run2 = ComplexTextController::ComplexTextRun::create(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 1, 3, true);
    173173    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    174174    runs.append(WTFMove(run1));
     
    176176    ComplexTextController controller(font, textRun, runs);
    177177
    178     EXPECT_NEAR(controller.totalWidth(), spaceWidth + 76.347656 + initialAdvance.width, 0.0001);
     178    EXPECT_NEAR(controller.totalWidth(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
    179179    GlyphBuffer glyphBuffer;
    180180    EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     
    184184    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth, 0.0001);
    185185    controller.advance(2, &glyphBuffer);
    186     EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + advances[0].width + initialAdvance.width, 0.0001);
     186    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + advances[0].width() + initialAdvance.width(), 0.0001);
    187187    controller.advance(3, &glyphBuffer);
    188     EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + 76.347656 + initialAdvance.width, 0.0001);
     188    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
    189189    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), 0, 0.0001);
    190190    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), 0, 0.0001);
    191191    EXPECT_EQ(glyphBuffer.size(), 3U);
    192     EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), spaceWidth + initialAdvance.width, 0.0001);
     192    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), spaceWidth + initialAdvance.width(), 0.0001);
    193193    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), 53.066406, 0.0001);
    194194    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), 23.281250, 0.0001);
     
    204204
    205205#if USE_LAYOUT_SPECIFIC_ADVANCES
    206     Vector<CGSize> advances = { CGSizeMake(76.347656, 0.000000), CGSizeMake(0.000000, 0.000000) };
    207     Vector<CGPoint> origins = { CGPointZero, CGPointMake(-23.281250, -8.398438) };
     206    Vector<FloatSize> advances = { FloatSize(76.347656, 0.000000), FloatSize(0.000000, 0.000000) };
     207    Vector<FloatPoint> origins = { FloatPoint(), FloatPoint(-23.281250, -8.398438) };
    208208#else
    209     Vector<CGSize> advances = { CGSizeMake(53.066406, -8.398438), CGSizeMake(23.281250, 8.398438) };
    210     Vector<CGPoint> origins = { };
     209    Vector<FloatSize> advances = { FloatSize(53.066406, -8.398438), FloatSize(23.281250, 8.398438) };
     210    Vector<FloatPoint> origins = { };
    211211#endif
    212212
    213     CGSize initialAdvance = CGSizeMake(28.144531, 0);
     213    FloatSize initialAdvance = FloatSize(28.144531, 0);
    214214
    215215    UChar characters[] = { 0x61, 0x20e3 };
    216216    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    217217    TextRun textRun(StringView(characters, charactersLength));
    218     auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
     218    auto run = ComplexTextController::ComplexTextRun::create(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 2, true);
    219219    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    220220    runs.append(WTFMove(run));
    221221    ComplexTextController controller(font, textRun, runs);
    222222
    223     EXPECT_NEAR(controller.totalWidth(), 76.347656 + initialAdvance.width, 0.0001);
    224     GlyphBuffer glyphBuffer;
    225     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
    226     controller.advance(0, &glyphBuffer);
    227     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
    228     controller.advance(1, &glyphBuffer);
    229     EXPECT_NEAR(controller.runWidthSoFar(), advances[0].width + initialAdvance.width, 0.0001);
     223    EXPECT_NEAR(controller.totalWidth(), 76.347656 + initialAdvance.width(), 0.0001);
     224    GlyphBuffer glyphBuffer;
     225    EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     226    controller.advance(0, &glyphBuffer);
     227    EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
     228    controller.advance(1, &glyphBuffer);
     229    EXPECT_NEAR(controller.runWidthSoFar(), advances[0].width() + initialAdvance.width(), 0.0001);
    230230    controller.advance(2, &glyphBuffer);
    231     EXPECT_NEAR(controller.runWidthSoFar(), 76.347656 + initialAdvance.width, 0.0001);
    232     EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
    233     EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
     231    EXPECT_NEAR(controller.runWidthSoFar(), 76.347656 + initialAdvance.width(), 0.0001);
     232    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
     233    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
    234234    EXPECT_EQ(glyphBuffer.size(), 2U);
    235235    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), 53.066406, 0.0001);
     
    245245    font.update();
    246246
    247     CGSize initialAdvance = CGSizeMake(4.33996383363472, 12.368896925859);
     247    FloatSize initialAdvance = FloatSize(4.33996383363472, 12.368896925859);
    248248
    249249    UChar characters[] = { 0x633, 0x20, 0x627, 0x650 };
    250250    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    251251    TextRun textRun(StringView(characters, charactersLength));
    252     auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(-4.33996383363472, -12.368896925859), CGSizeMake(14.0397830018083, 0) }, { }, { 884, 240 }, { 3, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(2, 2), false);
    253     auto run2 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(12.0, 0) }, { }, { 3 }, { 1 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 1), false);
    254     auto run3 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(43.8119349005425, 0) }, { }, { 276 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), false);
     252    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(-4.33996383363472, -12.368896925859), FloatSize(14.0397830018083, 0) }, { }, { 884, 240 }, { 3, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 2, 4, false);
     253    auto run2 = ComplexTextController::ComplexTextRun::create({ FloatSize(12.0, 0) }, { }, { 3 }, { 1 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 1, 2, false);
     254    auto run3 = ComplexTextController::ComplexTextRun::create({ FloatSize(43.8119349005425, 0) }, { }, { 276 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, false);
    255255    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    256256    runs.append(WTFMove(run1));
     
    273273    controller.advance(4, &glyphBuffer);
    274274    EXPECT_NEAR(controller.runWidthSoFar(), totalWidth, 0.0001);
    275     EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
    276     EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
     275    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
     276    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
    277277    EXPECT_EQ(glyphBuffer.size(), 4U);
    278278    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), 43.8119349005425, 0.0001);
     
    294294    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    295295    TextRun textRun(StringView(characters, charactersLength), 0, 100, ForceLeadingExpansion);
    296     auto run = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(24, 0) }, { }, { 16 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
     296    auto run = ComplexTextController::ComplexTextRun::create({ FloatSize(24, 0) }, { }, { 16 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, true);
    297297    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    298298    runs.append(WTFMove(run));
     
    324324    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    325325    TextRun textRun(StringView(characters, charactersLength));
    326     auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(0, 1), CGSizeMake(0, 2) }, { CGPointMake(0, 4), CGPointMake(0, 8) }, { 16, 17 }, { 0, 1 }, CGSizeMake(0, 16), font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
    327     auto run2 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(0, 32), CGSizeMake(0, 64) }, { CGPointMake(0, 128), CGPointMake(0, 256) }, { 18, 19 }, { 2, 3 }, CGSizeMake(0, 512), font.primaryFont(), characters, 0, charactersLength, CFRangeMake(2, 2), true);
     326    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(0, 1), FloatSize(0, 2) }, { FloatPoint(0, 4), FloatPoint(0, 8) }, { 16, 17 }, { 0, 1 }, FloatSize(0, 16), font.primaryFont(), characters, 0, charactersLength, 0, 2, true);
     327    auto run2 = ComplexTextController::ComplexTextRun::create({ FloatSize(0, 32), FloatSize(0, 64) }, { FloatPoint(0, 128), FloatPoint(0, 256) }, { 18, 19 }, { 2, 3 }, FloatSize(0, 512), font.primaryFont(), characters, 0, charactersLength, 2, 4, true);
    328328    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    329329    runs.append(WTFMove(run1));
Note: See TracChangeset for help on using the changeset viewer.