Changeset 205382 in webkit
- Timestamp:
- Sep 2, 2016 4:18:48 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205381 r205382 1 2016-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 1 13 2016-09-02 Beth Dakin <bdakin@apple.com> 2 14 -
trunk/LayoutTests/platform/mac/css2.1/t051202-c26-psudo-nest-00-c-expected.txt
r205373 r205382 57 57 RenderText {#text} at (130,15) size 111x18 58 58 text run at (130,15) width 111: "two characters" 59 RenderText {#text} at (240,15) size 45 1x1860 text run at (240,15) width 12 0: " in this paragraph "61 text run at (3 59,15) width 332: "(a double-quote mark and a capital 'T') should be "62 RenderInline {STRONG} at (0,0) size 90x1863 RenderText {#text} at (69 0,15) size 90x1864 text run at (69 0,15) width 45: "200% "65 text run at (73 4,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" 66 66 RenderText {#text} at (0,37) size 223x18 67 67 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 7 7 layer at (250,562) size 303x28 8 8 RenderBlock (positioned) {FONT} at (250,562) size 303x28 9 RenderText {#text} at (0,0) size 30 2x2810 text run at (0,0) width 30 2: "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 1 2016-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 1 12 2016-09-02 Beth Dakin <bdakin@apple.com> 2 13 -
trunk/Source/WebCore/platform/graphics/GlyphBuffer.h
r205373 r205382 68 68 69 69 void setWidth(CGFloat width) { this->CGSize::width = width; } 70 void setHeight(CGFloat height) { this->CGSize::height = height; }71 70 CGFloat width() const { return this->CGSize::width; } 72 71 CGFloat height() const { return this->CGSize::height; } -
trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
r205373 r205382 515 515 516 516 if (run.rtl()) { 517 initialAdvance = controller.totalWidth() - afterWidth + controller.leadingExpansion();517 initialAdvance = controller.totalWidth() + controller.finalRoundingWidth() - afterWidth + controller.leadingExpansion(); 518 518 glyphBuffer.reverse(0, glyphBuffer.size()); 519 519 } else -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r205373 r205382 108 108 109 109 ComplexTextController::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) 112 111 , m_run(run) 113 , m_end(run.length()) 114 , m_expansion(run.expansion()) 112 , m_isLTROnly(true) 115 113 , m_mayUseNaturalWritingDirection(mayUseNaturalWritingDirection) 116 114 , 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) 117 132 { 118 133 if (!m_expansion) … … 144 159 } 145 160 146 unsignedComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)161 int ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs) 147 162 { 148 163 if (h >= m_totalWidth) … … 162 177 for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) { 163 178 size_t index = offsetIntoAdjustedGlyphs + j; 164 CGFloat adjustedAdvance = m_adjusted BaseAdvances[index].width;179 CGFloat adjustedAdvance = m_adjustedAdvances[index].width; 165 180 if (!index) 166 181 adjustedAdvance += complexTextRun.initialAdvance().width; … … 174 189 175 190 // 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. 177 193 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance); 178 194 int stringLength = complexTextRun.stringLength(); … … 202 218 int firstGlyphBeforeCluster = j - 1; 203 219 while (firstGlyphBeforeCluster >= 0 && complexTextRun.indexAt(firstGlyphBeforeCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphBeforeCluster) < clusterEnd) { 204 CGFloat width = m_adjusted BaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width;220 CGFloat width = m_adjustedAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width; 205 221 clusterWidth += width; 206 222 x += width; … … 209 225 unsigned firstGlyphAfterCluster = j + 1; 210 226 while (firstGlyphAfterCluster < complexTextRun.glyphCount() && complexTextRun.indexAt(firstGlyphAfterCluster) >= clusterStart && complexTextRun.indexAt(firstGlyphAfterCluster) < clusterEnd) { 211 clusterWidth += m_adjusted BaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width;227 clusterWidth += m_adjustedAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width; 212 228 firstGlyphAfterCluster++; 213 229 } … … 308 324 const UChar* cp; 309 325 310 Vector<String> stringsFor8BitRuns;311 326 if (m_run.is8Bit()) { 312 327 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); 315 330 } else 316 331 cp = m_run.characters16(); … … 414 429 } 415 430 416 ASSERT(m_end >= indexOfFontTransition);417 431 unsigned itemLength = m_end - indexOfFontTransition; 418 432 if (itemLength) { … … 450 464 451 465 m_glyphEndOffsets.grow(m_glyphCount); 452 for ( unsignedi = 0; i < m_glyphCount; ++i) {466 for (size_t i = 0; i < m_glyphCount; ++i) { 453 467 CFIndex nextMappedIndex = m_indexEnd; 454 468 for (size_t j = indexAt(i) + 1; j < m_stringLength; ++j) { … … 517 531 } 518 532 519 float ComplexTextController::runWidthSoFarFraction(unsigned glyphStartOffset, unsigned glyphEndOffset, unsigned oldCharacterInCurrentGlyph, GlyphIterationStyle iterationStyle) const520 {521 // FIXME: Instead of dividing the glyph's advance equally between the characters, this522 // 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 538 533 void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, GlyphIterationStyle iterationStyle, HashSet<const Font*>* fallbackFonts) 539 534 { 540 if ( offset> m_end)535 if (static_cast<int>(offset) > m_end) 541 536 offset = m_end; 542 537 … … 568 563 // account the text direction. 569 564 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()); 578 566 glyphBuffer->setLeadingExpansion(m_leadingExpansion); 579 567 } … … 590 578 glyphEndOffset = complexTextRun.endOffsetAt(g); 591 579 592 CGSize adjusted BaseAdvance = m_adjustedBaseAdvances[k];580 CGSize adjustedAdvance = m_adjustedAdvances[k]; 593 581 594 582 if (glyphStartOffset + complexTextRun.stringLocation() >= m_currentCharacter) 595 583 return; 596 584 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)); 607 587 608 588 unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph; 609 589 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); 611 602 612 603 if (glyphEndOffset + complexTextRun.stringLocation() > m_currentCharacter) … … 627 618 m_glyphInCurrentRun = 0; 628 619 } 620 if (!m_run.ltr() && m_numGlyphsSoFar == m_adjustedAdvances.size()) 621 m_runWidthSoFar += m_finalRoundingWidth; 629 622 } 630 623 … … 664 657 bool runForbidsLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion; 665 658 bool runForbidsTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForbidTrailingExpansion; 666 667 659 // We are iterating in glyph order, not string order. Compare this to WidthIterator::advanceInternal() 668 660 for (size_t r = 0; r < runCount; ++r) { … … 673 665 // Represent the initial advance for a text run by adjusting the advance 674 666 // of the last glyph of the previous text run in the glyph buffer. 675 if (r && m_adjusted BaseAdvances.size()) {676 CGSize previousAdvance = m_adjusted BaseAdvances.last();667 if (r && m_adjustedAdvances.size()) { 668 CGSize previousAdvance = m_adjustedAdvances.last(); 677 669 previousAdvance.width += complexTextRun.initialAdvance().width; 678 670 previousAdvance.height -= complexTextRun.initialAdvance().height; 679 m_adjusted BaseAdvances[m_adjustedBaseAdvances.size() - 1] = previousAdvance;671 m_adjustedAdvances[m_adjustedAdvances.size() - 1] = previousAdvance; 680 672 } 681 673 widthSinceLastCommit += complexTextRun.initialAdvance().width; … … 685 677 686 678 const CGGlyph* glyphs = complexTextRun.glyphs(); 687 const CGSize* advances = complexTextRun. baseAdvances();679 const CGSize* advances = complexTextRun.advances(); 688 680 689 681 bool lastRun = r + 1 == runCount; … … 759 751 m_expansion -= m_expansionPerOpportunity; 760 752 m_totalWidth += m_expansionPerOpportunity; 761 if (m_adjusted BaseAdvances.isEmpty())753 if (m_adjustedAdvances.isEmpty()) 762 754 m_leadingExpansion = m_expansionPerOpportunity; 763 755 else 764 m_adjusted BaseAdvances.last().width += m_expansionPerOpportunity;756 m_adjustedAdvances.last().width += m_expansionPerOpportunity; 765 757 } 766 758 if (expandRight) { … … 786 778 787 779 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); 792 781 m_adjustedGlyphs.append(glyph); 793 782 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h
r205373 r205382 33 33 #include <wtf/text/WTFString.h> 34 34 35 #define USE_LAYOUT_SPECIFIC_ADVANCES ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000))36 37 35 typedef unsigned short CGGlyph; 38 36 … … 59 57 60 58 // Compute the character offset for a given x coordinate. 61 unsignedoffsetForPosition(float x, bool includePartialGlyphs);59 int offsetForPosition(float x, bool includePartialGlyphs); 62 60 63 61 // Returns the width of everything we've consumed so far. … … 65 63 66 64 float totalWidth() const { return m_totalWidth; } 65 66 float finalRoundingWidth() const { return m_finalRoundingWidth; } 67 67 68 68 float minGlyphBoundingBoxX() const { return m_minGlyphBoundingBoxX; } … … 96 96 CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; } 97 97 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 7102 * / / /103 * / (Glyph origin) / (Glyph origin) / (Glyph origin)104 * / / /105 * / / /106 * X-----------------------X--------------------------X--------------------------X---->...107 * (text position ^) (initial advance) (base advance) (base advance)108 */109 98 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; } 112 100 bool isLTR() const { return m_isLTR; } 113 101 bool isMonotonic() const { return m_isMonotonic; } … … 118 106 ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); 119 107 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; 126 109 const Font& m_font; 127 110 const UChar* m_characters; 111 unsigned m_stringLocation; 128 112 size_t m_stringLength; 113 Vector<CFIndex, 64> m_coreTextIndicesVector; 129 114 const CFIndex* m_coreTextIndices; 130 const CGGlyph* m_glyphs;131 const CGSize* m_baseAdvances;132 115 CFIndex m_indexBegin; 133 116 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; 136 123 bool m_isLTR; 137 124 bool m_isMonotonic; … … 149 136 unsigned incrementCurrentRun(unsigned& leftmostGlyph); 150 137 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; 152 142 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; 156 148 149 Vector<String> m_stringsFor8BitRuns; 157 150 Vector<UChar, 256> m_smallCapsBuffer; 158 151 … … 164 157 // its Line. ComplexTextRun::glyphs() and ComplexTextRun::advances() refer to glyphs relative to the ComplexTextRun. 165 158 // The length of the entire TextRun is m_run.length() 159 Vector<RetainPtr<CTLineRef>> m_coreTextLines; 166 160 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; 167 166 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; 172 168 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; 174 178 175 HashSet<const Font*>* m_fallbackFonts { nullptr };179 HashSet<const Font*>* m_fallbackFonts; 176 180 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; 182 185 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; 201 187 }; 202 188 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
r205373 r205382 30 30 #include "FontCache.h" 31 31 #include "FontCascade.h" 32 #include "SoftLinking.h"33 32 #include "TextRun.h" 34 33 #include "WebCoreSystemInterface.h" … … 40 39 #include <ApplicationServices/ApplicationServices.h> 41 40 #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 #endif47 48 41 49 42 // Note: CTFontDescriptorRefs can live forever in caches inside CoreText, so this object can too. … … 108 101 109 102 ComplexTextController::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) 112 104 , m_characters(characters) 105 , m_stringLocation(stringLocation) 113 106 , m_stringLength(stringLength) 114 107 , m_indexBegin(runRange.location) 115 108 , m_indexEnd(runRange.location + runRange.length) 116 , m_ stringLocation(stringLocation)109 , m_initialAdvance(CTRunGetInitialAdvance(ctRun)) 117 110 , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft)) 118 111 , m_isMonotonic(true) … … 133 126 } 134 127 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 } 148 134 } 149 135 … … 151 137 // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path. 152 138 ComplexTextController::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) 155 140 , m_characters(characters) 141 , m_stringLocation(stringLocation) 156 142 , m_stringLength(stringLength) 157 143 , m_indexBegin(0) 158 144 , m_indexEnd(stringLength) 159 , m_ stringLocation(stringLocation)145 , m_initialAdvance(CGSizeZero) 160 146 , m_isLTR(ltr) 161 147 , m_isMonotonic(true) … … 165 151 while (r < m_stringLength) { 166 152 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++; 169 157 } 170 158 m_glyphCount = m_coreTextIndicesVector.size(); … … 178 166 m_glyphsVector.fill(0, m_glyphCount); 179 167 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(); 182 170 } 183 171 -
trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h
r205373 r205382 69 69 CGSize CTRunGetInitialAdvance(CTRunRef run); 70 70 CTLineRef CTLineCreateWithUniCharProvider(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon); 71 void CTRunGetBaseAdvancesAndOrigins(CTRunRef, CFRange, CGSize baseAdvances[], CGPoint origins[]);72 71 CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon, CFDictionaryRef options); 73 72 bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar characters[], CGGlyph glyphs[], CFIndex count);
Note: See TracChangeset
for help on using the changeset viewer.