Changeset 205382 in webkit


Ignore:
Timestamp:
Sep 2, 2016 4:18:48 PM (8 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r205373.

This change causes LayoutTest crashes under GuardMalloc

Reverted changeset:

"[Cocoa] Distinguish between paint advances and base advances"
https://bugs.webkit.org/show_bug.cgi?id=160892
http://trac.webkit.org/changeset/205373

Location:
trunk
Files:
3 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r205381 r205382  
     12016-09-02  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r205373.
     4
     5        This change causes LayoutTest crashes under GuardMalloc
     6
     7        Reverted changeset:
     8
     9        "[Cocoa] Distinguish between paint advances and base advances"
     10        https://bugs.webkit.org/show_bug.cgi?id=160892
     11        http://trac.webkit.org/changeset/205373
     12
    1132016-09-02  Beth Dakin  <bdakin@apple.com>
    214
  • trunk/LayoutTests/platform/mac/css2.1/t051202-c26-psudo-nest-00-c-expected.txt

    r205373 r205382  
    5757          RenderText {#text} at (130,15) size 111x18
    5858            text run at (130,15) width 111: "two characters"
    59         RenderText {#text} at (240,15) size 451x18
    60           text run at (240,15) width 120: " in this paragraph "
    61           text run at (359,15) width 332: "(a double-quote mark and a capital 'T') should be "
    62         RenderInline {STRONG} at (0,0) size 90x18
    63           RenderText {#text} at (690,15) size 90x18
    64             text run at (690,15) width 45: "200% "
    65             text run at (734,15) width 46: "bigger"
     59        RenderText {#text} at (240,15) size 452x18
     60          text run at (240,15) width 121: " in this paragraph "
     61          text run at (360,15) width 332: "(a double-quote mark and a capital 'T') should be "
     62        RenderInline {STRONG} at (0,0) size 89x18
     63          RenderText {#text} at (691,15) size 89x18
     64            text run at (691,15) width 45: "200% "
     65            text run at (735,15) width 45: "bigger"
    6666        RenderText {#text} at (0,37) size 223x18
    6767          text run at (0,37) width 223: "than the rest of the paragraph, and "
  • trunk/LayoutTests/platform/mac/fast/inline/absolute-positioned-inline-in-centred-block-expected.txt

    r205373 r205382  
    77layer at (250,562) size 303x28
    88  RenderBlock (positioned) {FONT} at (250,562) size 303x28
    9     RenderText {#text} at (0,0) size 302x28
    10       text run at (0,0) width 302: "Hello World, And Stuff!"
     9    RenderText {#text} at (0,0) size 303x28
     10      text run at (0,0) width 303: "Hello World, And Stuff!"
  • trunk/Source/WebCore/ChangeLog

    r205381 r205382  
     12016-09-02  Ryan Haddad  <ryanhaddad@apple.com>
     2        Unreviewed, rolling out r205373.
     3
     4        This change causes LayoutTest crashes under GuardMalloc
     5
     6        Reverted changeset:
     7
     8        "[Cocoa] Distinguish between paint advances and base advances"
     9        https://bugs.webkit.org/show_bug.cgi?id=160892
     10        http://trac.webkit.org/changeset/205373
     11
    1122016-09-02  Beth Dakin  <bdakin@apple.com>
    213
  • trunk/Source/WebCore/platform/graphics/GlyphBuffer.h

    r205373 r205382  
    6868
    6969    void setWidth(CGFloat width) { this->CGSize::width = width; }
    70     void setHeight(CGFloat height) { this->CGSize::height = height; }
    7170    CGFloat width() const { return this->CGSize::width; }
    7271    CGFloat height() const { return this->CGSize::height; }
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r205373 r205382  
    515515
    516516    if (run.rtl()) {
    517         initialAdvance = controller.totalWidth() - afterWidth + controller.leadingExpansion();
     517        initialAdvance = controller.totalWidth() + controller.finalRoundingWidth() - afterWidth + controller.leadingExpansion();
    518518        glyphBuffer.reverse(0, glyphBuffer.size());
    519519    } else
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r205373 r205382  
    108108
    109109ComplexTextController::ComplexTextController(const FontCascade& font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
    110     : m_fallbackFonts(fallbackFonts)
    111     , m_font(font)
     110    : m_font(font)
    112111    , m_run(run)
    113     , m_end(run.length())
    114     , m_expansion(run.expansion())
     112    , m_isLTROnly(true)
    115113    , m_mayUseNaturalWritingDirection(mayUseNaturalWritingDirection)
    116114    , m_forTextEmphasis(forTextEmphasis)
     115    , m_currentCharacter(0)
     116    , m_end(run.length())
     117    , m_totalWidth(0)
     118    , m_runWidthSoFar(0)
     119    , m_numGlyphsSoFar(0)
     120    , m_currentRun(0)
     121    , m_glyphInCurrentRun(0)
     122    , m_characterInCurrentGlyph(0)
     123    , m_finalRoundingWidth(0)
     124    , m_expansion(run.expansion())
     125    , m_leadingExpansion(0)
     126    , m_fallbackFonts(fallbackFonts)
     127    , m_minGlyphBoundingBoxX(std::numeric_limits<float>::max())
     128    , m_maxGlyphBoundingBoxX(std::numeric_limits<float>::min())
     129    , m_minGlyphBoundingBoxY(std::numeric_limits<float>::max())
     130    , m_maxGlyphBoundingBoxY(std::numeric_limits<float>::min())
     131    , m_lastRoundingGlyph(0)
    117132{
    118133    if (!m_expansion)
     
    144159}
    145160
    146 unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)
     161int ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)
    147162{
    148163    if (h >= m_totalWidth)
     
    162177        for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) {
    163178            size_t index = offsetIntoAdjustedGlyphs + j;
    164             CGFloat adjustedAdvance = m_adjustedBaseAdvances[index].width;
     179            CGFloat adjustedAdvance = m_adjustedAdvances[index].width;
    165180            if (!index)
    166181                adjustedAdvance += complexTextRun.initialAdvance().width;
     
    174189
    175190                // FIXME: Instead of dividing the glyph's advance equally between the characters, this
    176                 // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
     191                // could use the glyph's "ligature carets". However, there is no Core Text API to get the
     192                // ligature carets.
    177193                CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
    178194                int stringLength = complexTextRun.stringLength();
     
    202218                    int firstGlyphBeforeCluster = j - 1;
    203219                    while (firstGlyphBeforeCluster >= 0 && complexTextRun.indexAt(firstGlyphBeforeCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphBeforeCluster) < clusterEnd) {
    204                         CGFloat width = m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width;
     220                        CGFloat width = m_adjustedAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width;
    205221                        clusterWidth += width;
    206222                        x += width;
     
    209225                    unsigned firstGlyphAfterCluster = j + 1;
    210226                    while (firstGlyphAfterCluster < complexTextRun.glyphCount() && complexTextRun.indexAt(firstGlyphAfterCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphAfterCluster) < clusterEnd) {
    211                         clusterWidth += m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width;
     227                        clusterWidth += m_adjustedAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width;
    212228                        firstGlyphAfterCluster++;
    213229                    }
     
    308324    const UChar* cp;
    309325
    310     Vector<String> stringsFor8BitRuns;
    311326    if (m_run.is8Bit()) {
    312327        String stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characters8(), m_run.length());
    313         stringsFor8BitRuns.append(WTFMove(stringFor8BitRun));
    314         cp = stringsFor8BitRuns.last().characters16();
     328        cp = stringFor8BitRun.characters16();
     329        m_stringsFor8BitRuns.append(stringFor8BitRun);
    315330    } else
    316331        cp = m_run.characters16();
     
    414429    }
    415430
    416     ASSERT(m_end >= indexOfFontTransition);
    417431    unsigned itemLength = m_end - indexOfFontTransition;
    418432    if (itemLength) {
     
    450464
    451465    m_glyphEndOffsets.grow(m_glyphCount);
    452     for (unsigned i = 0; i < m_glyphCount; ++i) {
     466    for (size_t i = 0; i < m_glyphCount; ++i) {
    453467        CFIndex nextMappedIndex = m_indexEnd;
    454468        for (size_t j = indexAt(i) + 1; j < m_stringLength; ++j) {
     
    517531}
    518532
    519 float ComplexTextController::runWidthSoFarFraction(unsigned glyphStartOffset, unsigned glyphEndOffset, unsigned oldCharacterInCurrentGlyph, GlyphIterationStyle iterationStyle) const
    520 {
    521     // FIXME: Instead of dividing the glyph's advance equally between the characters, this
    522     // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
    523     if (glyphStartOffset == glyphEndOffset) {
    524         // When there are multiple glyphs per character we need to advance by the full width of the glyph.
    525         ASSERT(m_characterInCurrentGlyph == oldCharacterInCurrentGlyph);
    526         return 1;
    527     }
    528 
    529     if (iterationStyle == ByWholeGlyphs) {
    530         if (!oldCharacterInCurrentGlyph)
    531             return 1;
    532         return 0;
    533     }
    534 
    535     return static_cast<float>(m_characterInCurrentGlyph - oldCharacterInCurrentGlyph) / (glyphEndOffset - glyphStartOffset);
    536 }
    537 
    538533void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const Font*>* fallbackFonts)
    539534{
    540     if (offset > m_end)
     535    if (static_cast<int>(offset) > m_end)
    541536        offset = m_end;
    542537
     
    568563        // account the text direction.
    569564        if (glyphBuffer && !leftmostGlyph) {
    570             CGSize initialAdvance = complexTextRun.initialAdvance();
    571 #if USE_LAYOUT_SPECIFIC_ADVANCES
    572             unsigned index = ltr ? 0 : m_glyphOrigins.size() - 1;
    573             initialAdvance.width += m_glyphOrigins[index].x;
    574             initialAdvance.height += m_glyphOrigins[index].y;
    575 #endif
    576             glyphBuffer->setInitialAdvance(initialAdvance);
    577 
     565            glyphBuffer->setInitialAdvance(complexTextRun.initialAdvance());
    578566            glyphBuffer->setLeadingExpansion(m_leadingExpansion);
    579567        }
     
    590578                glyphEndOffset = complexTextRun.endOffsetAt(g);
    591579
    592             CGSize adjustedBaseAdvance = m_adjustedBaseAdvances[k];
     580            CGSize adjustedAdvance = m_adjustedAdvances[k];
    593581
    594582            if (glyphStartOffset + complexTextRun.stringLocation() >= m_currentCharacter)
    595583                return;
    596584
    597             if (glyphBuffer && !m_characterInCurrentGlyph) {
    598                 GlyphBufferAdvance paintAdvance = adjustedBaseAdvance;
    599 #if USE_LAYOUT_SPECIFIC_ADVANCES
    600                 if (k + 1 < m_adjustedBaseAdvances.size()) {
    601                     paintAdvance.setWidth(paintAdvance.width() + m_glyphOrigins[k + 1].x - m_glyphOrigins[k].x);
    602                     paintAdvance.setHeight(paintAdvance.height() - m_glyphOrigins[k + 1].y + m_glyphOrigins[k].y);
    603                 }
    604 #endif
    605                 glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font(), paintAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
    606             }
     585            if (glyphBuffer && !m_characterInCurrentGlyph)
     586                glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.font(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
    607587
    608588            unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
    609589            m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset;
    610             m_runWidthSoFar += adjustedBaseAdvance.width * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle);
     590            // FIXME: Instead of dividing the glyph's advance equally between the characters, this
     591            // could use the glyph's "ligature carets". However, there is no Core Text API to get the
     592            // ligature carets.
     593            if (glyphStartOffset == glyphEndOffset) {
     594                // When there are multiple glyphs per character we need to advance by the full width of the glyph.
     595                ASSERT(m_characterInCurrentGlyph == oldCharacterInCurrentGlyph);
     596                m_runWidthSoFar += adjustedAdvance.width;
     597            } else if (iterationStyle == ByWholeGlyphs) {
     598                if (!oldCharacterInCurrentGlyph)
     599                    m_runWidthSoFar += adjustedAdvance.width;
     600            } else
     601                m_runWidthSoFar += adjustedAdvance.width * (m_characterInCurrentGlyph - oldCharacterInCurrentGlyph) / (glyphEndOffset - glyphStartOffset);
    611602
    612603            if (glyphEndOffset + complexTextRun.stringLocation() > m_currentCharacter)
     
    627618        m_glyphInCurrentRun = 0;
    628619    }
     620    if (!m_run.ltr() && m_numGlyphsSoFar == m_adjustedAdvances.size())
     621        m_runWidthSoFar += m_finalRoundingWidth;
    629622}
    630623
     
    664657    bool runForbidsLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion;
    665658    bool runForbidsTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForbidTrailingExpansion;
    666 
    667659    // We are iterating in glyph order, not string order. Compare this to WidthIterator::advanceInternal()
    668660    for (size_t r = 0; r < runCount; ++r) {
     
    673665        // Represent the initial advance for a text run by adjusting the advance
    674666        // of the last glyph of the previous text run in the glyph buffer.
    675         if (r && m_adjustedBaseAdvances.size()) {
    676             CGSize previousAdvance = m_adjustedBaseAdvances.last();
     667        if (r && m_adjustedAdvances.size()) {
     668            CGSize previousAdvance = m_adjustedAdvances.last();
    677669            previousAdvance.width += complexTextRun.initialAdvance().width;
    678670            previousAdvance.height -= complexTextRun.initialAdvance().height;
    679             m_adjustedBaseAdvances[m_adjustedBaseAdvances.size() - 1] = previousAdvance;
     671            m_adjustedAdvances[m_adjustedAdvances.size() - 1] = previousAdvance;
    680672        }
    681673        widthSinceLastCommit += complexTextRun.initialAdvance().width;
     
    685677
    686678        const CGGlyph* glyphs = complexTextRun.glyphs();
    687         const CGSize* advances = complexTextRun.baseAdvances();
     679        const CGSize* advances = complexTextRun.advances();
    688680
    689681        bool lastRun = r + 1 == runCount;
     
    759751                            m_expansion -= m_expansionPerOpportunity;
    760752                            m_totalWidth += m_expansionPerOpportunity;
    761                             if (m_adjustedBaseAdvances.isEmpty())
     753                            if (m_adjustedAdvances.isEmpty())
    762754                                m_leadingExpansion = m_expansionPerOpportunity;
    763755                            else
    764                                 m_adjustedBaseAdvances.last().width += m_expansionPerOpportunity;
     756                                m_adjustedAdvances.last().width += m_expansionPerOpportunity;
    765757                        }
    766758                        if (expandRight) {
     
    786778
    787779            advance.height *= -1;
    788             m_adjustedBaseAdvances.append(advance);
    789 #if USE_LAYOUT_SPECIFIC_ADVANCES
    790             m_glyphOrigins.append(complexTextRun.glyphOrigins()[i]);
    791 #endif
     780            m_adjustedAdvances.append(advance);
    792781            m_adjustedGlyphs.append(glyph);
    793782           
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r205373 r205382  
    3333#include <wtf/text/WTFString.h>
    3434
    35 #define USE_LAYOUT_SPECIFIC_ADVANCES ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000))
    36 
    3735typedef unsigned short CGGlyph;
    3836
     
    5957
    6058    // Compute the character offset for a given x coordinate.
    61     unsigned offsetForPosition(float x, bool includePartialGlyphs);
     59    int offsetForPosition(float x, bool includePartialGlyphs);
    6260
    6361    // Returns the width of everything we've consumed so far.
     
    6563
    6664    float totalWidth() const { return m_totalWidth; }
     65
     66    float finalRoundingWidth() const { return m_finalRoundingWidth; }
    6767
    6868    float minGlyphBoundingBoxX() const { return m_minGlyphBoundingBoxX; }
     
    9696        CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
    9797        const CGGlyph* glyphs() const { return m_glyphs; }
    98 
    99         /*
    100          *                                              X (Paint glyph position)   X (Paint glyph position)   X (Paint glyph position)
    101          *                                             7                          7                          7
    102          *                                            /                          /                          /
    103          *                                           / (Glyph origin)           / (Glyph origin)           / (Glyph origin)
    104          *                                          /                          /                          /
    105          *                                         /                          /                          /
    106          *                X-----------------------X--------------------------X--------------------------X---->...
    107          * (text position ^)  (initial advance)          (base advance)             (base advance)
    108          */
    10998        CGSize initialAdvance() const { return m_initialAdvance; }
    110         const CGSize* baseAdvances() const { return m_baseAdvances; }
    111         const CGPoint* glyphOrigins() const { return m_glyphOrigins.data(); }
     99        const CGSize* advances() const { return m_advances; }
    112100        bool isLTR() const { return m_isLTR; }
    113101        bool isMonotonic() const { return m_isMonotonic; }
     
    118106        ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
    119107
    120         Vector<CGSize, 64> m_baseAdvancesVector;
    121         Vector<CGPoint, 64> m_glyphOrigins;
    122         Vector<CGGlyph, 64> m_glyphsVector;
    123         Vector<CFIndex, 64> m_glyphEndOffsets;
    124         Vector<CFIndex, 64> m_coreTextIndicesVector;
    125         CGSize m_initialAdvance;
     108        unsigned m_glyphCount;
    126109        const Font& m_font;
    127110        const UChar* m_characters;
     111        unsigned m_stringLocation;
    128112        size_t m_stringLength;
     113        Vector<CFIndex, 64> m_coreTextIndicesVector;
    129114        const CFIndex* m_coreTextIndices;
    130         const CGGlyph* m_glyphs;
    131         const CGSize* m_baseAdvances;
    132115        CFIndex m_indexBegin;
    133116        CFIndex m_indexEnd;
    134         unsigned m_glyphCount;
    135         unsigned m_stringLocation;
     117        Vector<CFIndex, 64> m_glyphEndOffsets;
     118        Vector<CGGlyph, 64> m_glyphsVector;
     119        const CGGlyph* m_glyphs;
     120        CGSize m_initialAdvance;
     121        Vector<CGSize, 64> m_advancesVector;
     122        const CGSize* m_advances;
    136123        bool m_isLTR;
    137124        bool m_isMonotonic;
     
    149136    unsigned incrementCurrentRun(unsigned& leftmostGlyph);
    150137
    151     float runWidthSoFarFraction(unsigned glyphStartOffset, unsigned glyphEndOffset, unsigned oldCharacterInCurrentGlyph, GlyphIterationStyle) const;
     138    // The initial capacity of these vectors was selected as being the smallest power of two greater than
     139    // the average (3.5) plus one standard deviation (7.5) of nonzero sizes used on Arabic Wikipedia.
     140    Vector<unsigned, 16> m_runIndices;
     141    Vector<unsigned, 16> m_glyphCountFromStartToIndex;
    152142
    153     Vector<CGSize, 256> m_adjustedBaseAdvances;
    154     Vector<CGPoint, 256> m_glyphOrigins;
    155     Vector<CGGlyph, 256> m_adjustedGlyphs;
     143    const FontCascade& m_font;
     144    const TextRun& m_run;
     145    bool m_isLTROnly;
     146    bool m_mayUseNaturalWritingDirection;
     147    bool m_forTextEmphasis;
    156148
     149    Vector<String> m_stringsFor8BitRuns;
    157150    Vector<UChar, 256> m_smallCapsBuffer;
    158151
     
    164157    // its Line. ComplexTextRun::glyphs() and ComplexTextRun::advances() refer to glyphs relative to the ComplexTextRun.
    165158    // The length of the entire TextRun is m_run.length()
     159    Vector<RetainPtr<CTLineRef>> m_coreTextLines;
    166160    Vector<RefPtr<ComplexTextRun>, 16> m_complexTextRuns;
     161    Vector<CGSize, 256> m_adjustedAdvances;
     162    Vector<CGGlyph, 256> m_adjustedGlyphs;
     163 
     164    unsigned m_currentCharacter;
     165    int m_end;
    167166
    168     // The initial capacity of these vectors was selected as being the smallest power of two greater than
    169     // the average (3.5) plus one standard deviation (7.5) of nonzero sizes used on Arabic Wikipedia.
    170     Vector<unsigned, 16> m_runIndices;
    171     Vector<unsigned, 16> m_glyphCountFromStartToIndex;
     167    CGFloat m_totalWidth;
    172168
    173     Vector<RetainPtr<CTLineRef>> m_coreTextLines;
     169    float m_runWidthSoFar;
     170    unsigned m_numGlyphsSoFar;
     171    size_t m_currentRun;
     172    unsigned m_glyphInCurrentRun;
     173    unsigned m_characterInCurrentGlyph;
     174    float m_finalRoundingWidth;
     175    float m_expansion;
     176    float m_expansionPerOpportunity;
     177    float m_leadingExpansion;
    174178
    175     HashSet<const Font*>* m_fallbackFonts { nullptr };
     179    HashSet<const Font*>* m_fallbackFonts;
    176180
    177     const FontCascade& m_font;
    178     const TextRun& m_run;
    179  
    180     unsigned m_currentCharacter { 0 };
    181     unsigned m_end { 0 };
     181    float m_minGlyphBoundingBoxX;
     182    float m_maxGlyphBoundingBoxX;
     183    float m_minGlyphBoundingBoxY;
     184    float m_maxGlyphBoundingBoxY;
    182185
    183     float m_totalWidth { 0 };
    184     float m_runWidthSoFar { 0 };
    185     unsigned m_numGlyphsSoFar { 0 };
    186     unsigned m_currentRun { 0 };
    187     unsigned m_glyphInCurrentRun { 0 };
    188     unsigned m_characterInCurrentGlyph { 0 };
    189     float m_expansion { 0 };
    190     float m_expansionPerOpportunity { 0 };
    191     float m_leadingExpansion { 0 };
    192 
    193     float m_minGlyphBoundingBoxX { std::numeric_limits<float>::max() };
    194     float m_maxGlyphBoundingBoxX { std::numeric_limits<float>::min() };
    195     float m_minGlyphBoundingBoxY { std::numeric_limits<float>::max() };
    196     float m_maxGlyphBoundingBoxY { std::numeric_limits<float>::min() };
    197 
    198     bool m_isLTROnly { true };
    199     bool m_mayUseNaturalWritingDirection { false };
    200     bool m_forTextEmphasis { false };
     186    unsigned m_lastRoundingGlyph;
    201187};
    202188
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

    r205373 r205382  
    3030#include "FontCache.h"
    3131#include "FontCascade.h"
    32 #include "SoftLinking.h"
    3332#include "TextRun.h"
    3433#include "WebCoreSystemInterface.h"
     
    4039#include <ApplicationServices/ApplicationServices.h>
    4140#endif
    42 
    43 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 90000)
    44 SOFT_LINK_FRAMEWORK(CoreText);
    45 SOFT_LINK(CoreText, CTRunGetBaseAdvancesAndOrigins, void, (CTRunRef run, CFRange range, CGSize baseAdvances[], CGPoint origins[]), (run, range, baseAdvances, origins))
    46 #endif
    47 
    4841
    4942// Note: CTFontDescriptorRefs can live forever in caches inside CoreText, so this object can too.
     
    108101
    109102ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
    110     : m_initialAdvance(CTRunGetInitialAdvance(ctRun))
    111     , m_font(font)
     103    : m_font(font)
    112104    , m_characters(characters)
     105    , m_stringLocation(stringLocation)
    113106    , m_stringLength(stringLength)
    114107    , m_indexBegin(runRange.location)
    115108    , m_indexEnd(runRange.location + runRange.length)
    116     , m_stringLocation(stringLocation)
     109    , m_initialAdvance(CTRunGetInitialAdvance(ctRun))
    117110    , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft))
    118111    , m_isMonotonic(true)
     
    133126    }
    134127
    135 #if USE_LAYOUT_SPECIFIC_ADVANCES
    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();
    140 #else
    141     m_baseAdvances = CTRunGetAdvancesPtr(ctRun);
    142     if (!m_baseAdvances) {
    143         m_baseAdvancesVector.grow(m_glyphCount);
    144         CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_baseAdvancesVector.data());
    145         m_baseAdvances = m_baseAdvancesVector.data();
    146     }
    147 #endif
     128    m_advances = CTRunGetAdvancesPtr(ctRun);
     129    if (!m_advances) {
     130        m_advancesVector.grow(m_glyphCount);
     131        CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_advancesVector.data());
     132        m_advances = m_advancesVector.data();
     133    }
    148134}
    149135
     
    151137// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
    152138ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
    153     : m_initialAdvance(CGSizeZero)
    154     , m_font(font)
     139    : m_font(font)
    155140    , m_characters(characters)
     141    , m_stringLocation(stringLocation)
    156142    , m_stringLength(stringLength)
    157143    , m_indexBegin(0)
    158144    , m_indexEnd(stringLength)
    159     , m_stringLocation(stringLocation)
     145    , m_initialAdvance(CGSizeZero)
    160146    , m_isLTR(ltr)
    161147    , m_isMonotonic(true)
     
    165151    while (r < m_stringLength) {
    166152        m_coreTextIndicesVector.uncheckedAppend(r);
    167         UChar32 character;
    168         U16_NEXT(m_characters, r, m_stringLength, character);
     153        if (U_IS_LEAD(m_characters[r]) && r + 1 < m_stringLength && U_IS_TRAIL(m_characters[r + 1]))
     154            r += 2;
     155        else
     156            r++;
    169157    }
    170158    m_glyphCount = m_coreTextIndicesVector.size();
     
    178166    m_glyphsVector.fill(0, m_glyphCount);
    179167    m_glyphs = m_glyphsVector.data();
    180     m_baseAdvancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
    181     m_baseAdvances = m_baseAdvancesVector.data();
     168    m_advancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
     169    m_advances = m_advancesVector.data();
    182170}
    183171
  • trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h

    r205373 r205382  
    6969CGSize CTRunGetInitialAdvance(CTRunRef run);
    7070CTLineRef CTLineCreateWithUniCharProvider(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon);
    71 void CTRunGetBaseAdvancesAndOrigins(CTRunRef, CFRange, CGSize baseAdvances[], CGPoint origins[]);
    7271CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon, CFDictionaryRef options);
    7372bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar characters[], CGGlyph glyphs[], CFIndex count);
Note: See TracChangeset for help on using the changeset viewer.