Changeset 76674 in webkit
- Timestamp:
- Jan 25, 2011 10:08:41 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r76673 r76674 1 2011-01-25 Ned Holbrook <nholbrook@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 ComplexTextController incorrectly conflates string length and range of indexes 6 https://bugs.webkit.org/show_bug.cgi?id=52760 7 8 * fast/text/offsetForPosition-complex-fallback-expected.txt: Added. 9 * fast/text/offsetForPosition-complex-fallback.html: Added. 10 1 11 2011-01-25 Sam Weinig <sam@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r76669 r76674 1 2011-01-25 Ned Holbrook <nholbrook@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 ComplexTextController incorrectly conflates string length and range of indexes 6 https://bugs.webkit.org/show_bug.cgi?id=52760 7 8 Test: fast/text/offsetForPosition-complex-fallback.html 9 10 * platform/graphics/mac/ComplexTextController.cpp: 11 (WebCore::ComplexTextController::offsetForPosition): 12 (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): 13 (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic): 14 (WebCore::ComplexTextController::advance): 15 * platform/graphics/mac/ComplexTextController.h: 16 (WebCore::ComplexTextController::ComplexTextRun::create): 17 (WebCore::ComplexTextController::ComplexTextRun::indexEnd): 18 * platform/graphics/mac/ComplexTextControllerATSUI.cpp: 19 (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): 20 * platform/graphics/mac/ComplexTextControllerCoreText.cpp: 21 (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): 22 (WebCore::ComplexTextController::collectComplexTextRunsForCharactersCoreText): 23 1 24 2011-01-25 Sam Weinig <sam@webkit.org> 2 25 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r76170 r76674 119 119 CFIndex hitGlyphEnd; 120 120 if (m_run.ltr()) 121 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : static_cast<CFIndex>(complexTextRun. stringLength()));121 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j + 1 < complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : static_cast<CFIndex>(complexTextRun.indexEnd())); 122 122 else 123 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun. stringLength()));123 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTextRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun.indexEnd())); 124 124 125 125 // FIXME: Instead of dividing the glyph's advance equally between the characters, this … … 312 312 , m_stringLocation(stringLocation) 313 313 , m_stringLength(stringLength) 314 , m_indexEnd(stringLocation + stringLength) 314 315 , m_isMonotonic(true) 315 316 { … … 336 337 m_glyphEndOffsets.grow(m_glyphCount); 337 338 for (size_t i = 0; i < m_glyphCount; ++i) { 338 CFIndex nextMappedIndex = m_ stringLength;339 CFIndex nextMappedIndex = m_indexEnd; 339 340 for (size_t j = indexAt(i) + 1; j < m_stringLength; ++j) { 340 341 if (mappedIndices[j]) { … … 371 372 if (complexTextRun.isMonotonic()) { 372 373 if (ltr) 373 glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? static_cast<unsigned>(complexTextRun.indexAt(g + 1)) : complexTextRun. stringLength());374 glyphEndOffset = max<unsigned>(glyphStartOffset, g + 1 < glyphCount ? static_cast<unsigned>(complexTextRun.indexAt(g + 1)) : complexTextRun.indexEnd()); 374 375 else 375 glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? static_cast<unsigned>(complexTextRun.indexAt(g - 1)) : complexTextRun. stringLength());376 glyphEndOffset = max<unsigned>(glyphStartOffset, g > 0 ? static_cast<unsigned>(complexTextRun.indexAt(g - 1)) : complexTextRun.indexEnd()); 376 377 } else 377 378 glyphEndOffset = complexTextRun.endOffsetAt(g); … … 387 388 unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph; 388 389 m_characterInCurrentGlyph = min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset; 389 // FIXME: Instead of dividing the glyph's advance equ ially between the characters, this390 // FIXME: Instead of dividing the glyph's advance equally between the characters, this 390 391 // could use the glyph's "ligature carets". However, there is no Core Text API to get the 391 392 // ligature carets. -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h
r74169 r76674 73 73 public: 74 74 #if USE(CORE_TEXT) 75 static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength )75 static PassRefPtr<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) 76 76 { 77 return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength ));77 return adoptRef(new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange)); 78 78 } 79 79 #endif … … 95 95 size_t stringLength() const { return m_stringLength; } 96 96 ALWAYS_INLINE CFIndex indexAt(size_t i) const; 97 CFIndex indexEnd() const { return m_indexEnd; } 97 98 CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; } 98 99 const CGGlyph* glyphs() const { return m_glyphs; } … … 103 104 private: 104 105 #if USE(CORE_TEXT) 105 ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength );106 ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); 106 107 void createTextRunFromFontDataCoreText(bool ltr); 107 108 #endif … … 134 135 Vector<CFIndex, 64> m_atsuiIndices; 135 136 #endif 137 CFIndex m_indexEnd; 136 138 Vector<CFIndex, 64> m_glyphEndOffsets; 137 139 Vector<CGGlyph, 64> m_glyphsVector; -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp
r76170 r76674 147 147 , m_stringLocation(stringLocation) 148 148 , m_stringLength(stringLength) 149 , m_indexEnd(stringLocation + stringLength) 149 150 , m_directionalOverride(directionalOverride) 150 151 , m_isMonotonic(true) -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
r76170 r76674 43 43 namespace WebCore { 44 44 45 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength )45 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) 46 46 : m_coreTextRun(ctRun) 47 47 , m_fontData(fontData) … … 49 49 , m_stringLocation(stringLocation) 50 50 , m_stringLength(stringLength) 51 , m_indexEnd(runRange.location + runRange.length) 51 52 , m_isMonotonic(true) 52 53 { … … 166 167 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, r)); 167 168 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); 168 m_complexTextRuns.append(ComplexTextRun::create(ctRun, fontData, cp, stringLocation, length)); 169 CFRange runRange = CTRunGetStringRange(ctRun); 170 m_complexTextRuns.append(ComplexTextRun::create(ctRun, fontData, cp, stringLocation, length, runRange)); 169 171 } 170 172 }
Note: See TracChangeset
for help on using the changeset viewer.