WebKit Bugzilla
Attachment 341469 Details for
Bug 186010
: REGRESSION (Mountain Lion-Mavericks): Incorrect font used to render decomposed grapheme cluster in some cases
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
bug-186010-20180528211911.patch (text/plain), 23.32 KB, created by
Myles C. Maxfield
on 2018-05-28 21:19:11 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-05-28 21:19:11 PDT
Size:
23.32 KB
patch
obsolete
>Subversion Revision: 232250 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 025b985e7ead2e0c2eec313c3dc7757480237b98..1e7a541540d14a6dc5c97664e2422bab33387193 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-28 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ REGRESSION (Mountain Lion-Mavericks): Incorrect font used to render decomposed grapheme cluster in some cases >+ https://bugs.webkit.org/show_bug.cgi?id=186010 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/spi/cf/CFStringSPI.h: >+ * wtf/text/TextBreakIterator.cpp: >+ (WTF::mapModeToBackingIterator): >+ * wtf/text/TextBreakIterator.h: >+ * wtf/text/cf/TextBreakIteratorCF.h: >+ (WTF::TextBreakIteratorCF::TextBreakIteratorCF): >+ * wtf/text/mac/TextBreakIteratorInternalICUMac.mm: >+ (WTF::mapModeToBackingIterator): >+ > 2018-05-27 Yusuke Suzuki <utatane.tea@gmail.com> > > [WTF] Add clz32 / clz64 for MSVC >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 32a42d1f98a15235c9eb70a2831e6fc42cefb89e..712fcfeb88b3dd245d68cc6553f584e2cc5f2fac 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-28 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ REGRESSION (Mountain Lion-Mavericks): Incorrect font used to render decomposed grapheme cluster in some cases >+ https://bugs.webkit.org/show_bug.cgi?id=186010 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * platform/graphics/ComplexTextController.cpp: >+ (WebCore::ComplexTextController::offsetForPosition): >+ (WebCore::ComplexTextController::normalizeStringForShaping): >+ (WebCore::ComplexTextController::collectComplexTextRuns): >+ (WebCore::ComplexTextController::advance): >+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances): >+ * platform/graphics/ComplexTextController.h: >+ * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: >+ (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): >+ (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): >+ > 2018-05-28 Zalan Bujtas <zalan@apple.com> > > [LFC] Add Rect interface to Display::Box >diff --git a/Source/WTF/wtf/spi/cf/CFStringSPI.h b/Source/WTF/wtf/spi/cf/CFStringSPI.h >index aae98dba4288f8a5c547152b2a7f7fdab05c7a2a..bdd8bf50e70f38b44d576290d173497dcffb73e2 100644 >--- a/Source/WTF/wtf/spi/cf/CFStringSPI.h >+++ b/Source/WTF/wtf/spi/cf/CFStringSPI.h >@@ -38,6 +38,7 @@ extern "C" { > > typedef CF_ENUM(CFIndex, CFStringCharacterClusterType) > { >+ kCFStringGraphemeCluster = 1, > kCFStringComposedCharacterCluster = 2, > kCFStringCursorMovementCluster = 3, > kCFStringBackwardDeletionCluster = 4 >diff --git a/Source/WTF/wtf/text/TextBreakIterator.cpp b/Source/WTF/wtf/text/TextBreakIterator.cpp >index 5b88b44578e47d823fb5888235d10103d0d5f46f..bacce11f0bd256c45755a12642bbd25c14164122 100644 >--- a/Source/WTF/wtf/text/TextBreakIterator.cpp >+++ b/Source/WTF/wtf/text/TextBreakIterator.cpp >@@ -44,6 +44,8 @@ static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBacking > return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data()); > case TextBreakIterator::Mode::Delete: > return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data()); >+ case TextBreakIterator::Mode::GraphemeCluster: >+ return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data()); > default: > ASSERT_NOT_REACHED(); > return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data()); >diff --git a/Source/WTF/wtf/text/TextBreakIterator.h b/Source/WTF/wtf/text/TextBreakIterator.h >index 392329de231ee83bb3ff380bcc83ef24d14290c1..7231fbcea917563e81155af81443326b460d707a 100644 >--- a/Source/WTF/wtf/text/TextBreakIterator.h >+++ b/Source/WTF/wtf/text/TextBreakIterator.h >@@ -47,7 +47,8 @@ public: > enum class Mode { > Line, > Caret, >- Delete >+ Delete, >+ GraphemeCluster, > }; > > TextBreakIterator() = delete; >diff --git a/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h b/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >index 27e50bce5075f9ddadc4fdb9b192f6e834065e66..a17666908791e98322fbce7259b87fa98e691963 100644 >--- a/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >+++ b/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h >@@ -29,7 +29,8 @@ class TextBreakIteratorCF { > public: > enum class Mode { > Caret, >- Delete >+ Delete, >+ GraphemeCluster, > }; > > TextBreakIteratorCF(StringView string, Mode mode) >@@ -42,6 +43,9 @@ public: > case Mode::Delete: > m_type = kCFStringBackwardDeletionCluster; > break; >+ case Mode::GraphemeCluster: >+ m_type = kCFStringGraphemeCluster; >+ break; > } > } > >diff --git a/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm b/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm >index 0cac4c9c56f364f885e77aac1528abb58a11cac0..e3d208d196d44b3f711986936d648a5f9d6fa773 100644 >--- a/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm >+++ b/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm >@@ -35,6 +35,8 @@ static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBacking > return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Caret); > case TextBreakIterator::Mode::Delete: > return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Delete); >+ case TextBreakIterator::Mode::GraphemeCluster: >+ return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::GraphemeCluster); > } > } > >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index f9f18a80fbd97ed33d2d609c3094ea5e15762649..fc634937e62056cfcb0fc9b257d4bcb674076011 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -32,6 +32,7 @@ > #include "RenderText.h" > #include "TextRun.h" > #include <unicode/ubrk.h> >+#include <unicode/unorm2.h> > #include <wtf/Optional.h> > #include <wtf/StdLibExtras.h> > #include <wtf/text/TextBreakIterator.h> >@@ -219,7 +220,7 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl > clusterStart = cursorPositionIterator.preceding(hitIndex).value_or(0); > > if (!includePartialGlyphs) >- return complexTextRun.stringLocation() + clusterStart; >+ return m_normalizedToInputStringOffsetMap[complexTextRun.stringLocation() + clusterStart]; > > unsigned clusterEnd = cursorPositionIterator.following(hitIndex).value_or(stringLength); > >@@ -250,8 +251,8 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl > x -= clusterWidth * (m_run.ltr() ? hitIndex - hitGlyphStart : hitGlyphEnd - hitIndex - 1); > } > if (x <= clusterWidth / 2) >- return complexTextRun.stringLocation() + (m_run.ltr() ? clusterStart : clusterEnd); >- return complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart); >+ return m_normalizedToInputStringOffsetMap[complexTextRun.stringLocation() + (m_run.ltr() ? clusterStart : clusterEnd)]; >+ return m_normalizedToInputStringOffsetMap[complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart)]; > } > x -= adjustedAdvance; > } >@@ -335,20 +336,78 @@ static bool shouldSynthesize(bool dontSynthesizeSmallCaps, const Font* nextFont, > return !nextFont->variantCapsSupportsCharacterForSynthesis(fontVariantCaps, baseCharacter); > } > >+void ComplexTextController::normalizeStringForShaping() >+{ >+ String stringFor8BitRun; >+ const UChar* sourceCharacters; >+ int32_t sourceLength; >+ if (m_run.is8Bit()) { >+ stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characters8(), m_run.length()); >+ ASSERT(!stringFor8BitRun.is8Bit()); >+ sourceCharacters = stringFor8BitRun.characters16(); >+ sourceLength = stringFor8BitRun.length(); >+ } else { >+ sourceCharacters = m_run.characters16(); >+ sourceLength = m_run.length(); >+ } >+ >+ UErrorCode errorCode = U_ZERO_ERROR; >+ const UNormalizer2* normalizer = unorm2_getNFCInstance(&errorCode); >+ ASSERT(U_SUCCESS(errorCode)); >+ ASSERT(normalizer); >+ if (!normalizer || U_FAILURE(errorCode)) { >+ m_normalizedCharacters.reserveInitialCapacity(sourceLength); >+ m_normalizedToInputStringOffsetMap.reserveInitialCapacity(sourceLength); >+ for (int32_t i = 0; i < sourceLength; ++i) { >+ m_normalizedCharacters.uncheckedAppend(sourceCharacters[i]); >+ m_normalizedToInputStringOffsetMap.uncheckedAppend(i); >+ } >+ return; >+ } >+ >+ CachedTextBreakIterator iterator(StringView(sourceCharacters, sourceLength), TextBreakIterator::Mode::GraphemeCluster, nullAtom()); >+ m_normalizedCharacters.resize(sourceLength); >+ size_t normalizedPosition = 0; >+ for (unsigned current = 0; current < static_cast<unsigned>(sourceLength); ) { >+ if (auto next = iterator.following(current)) { >+ for (unsigned i = current; i < *next; ++i) >+ m_inputToNormalizedStringOffsetMap.append(normalizedPosition); >+ int32_t normalizedLength; >+ while (true) { >+ normalizedLength = unorm2_normalize(normalizer, sourceCharacters + current, *next - current, m_normalizedCharacters.data() + normalizedPosition, m_normalizedCharacters.size() - normalizedPosition, &errorCode); >+ if (errorCode == U_BUFFER_OVERFLOW_ERROR) >+ m_normalizedCharacters.resize(m_normalizedCharacters.size() * 1.25 + 1); >+ else >+ break; >+ } >+ if (U_FAILURE(errorCode)) { >+ normalizedLength = *next - current; >+ if (m_normalizedCharacters.size() < normalizedPosition + normalizedLength) >+ m_normalizedCharacters.resize((normalizedPosition + normalizedLength) * 1.25 + 1); >+ std::copy_n(sourceCharacters + current, *next - current, m_normalizedCharacters.data() + normalizedPosition); >+ } else >+ ASSERT(U_SUCCESS(errorCode)); >+ for (unsigned i = 0; i < static_cast<unsigned>(normalizedLength); ++i) >+ m_normalizedToInputStringOffsetMap.append(current); >+ normalizedPosition += normalizedLength; >+ current = *next; >+ } else >+ break; >+ } >+ m_inputToNormalizedStringOffsetMap.append(normalizedPosition); >+ m_normalizedToInputStringOffsetMap.append(sourceLength); >+ m_normalizedCharacters.resize(normalizedPosition); >+} >+ > void ComplexTextController::collectComplexTextRuns() > { > if (!m_end) > return; > >- // We break up glyph run generation for the string by Font. >- const UChar* cp; >+ normalizeStringForShaping(); > >- if (m_run.is8Bit()) { >- String stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characters8(), m_run.length()); >- m_stringsFor8BitRuns.append(WTFMove(stringFor8BitRun)); >- cp = m_stringsFor8BitRuns.last().characters16(); >- } else >- cp = m_run.characters16(); >+ const UChar* curr = m_normalizedCharacters.data(); >+ const UChar* end = m_normalizedCharacters.data() + m_normalizedCharacters.size(); > > auto fontVariantCaps = m_font.fontDescription().variantCaps(); > bool dontSynthesizeSmallCaps = !static_cast<bool>(m_font.fontDescription().fontSynthesis() & FontSynthesisSmallCaps); >@@ -356,11 +415,9 @@ void ComplexTextController::collectComplexTextRuns() > bool engageSmallCapsProcessing = engageAllSmallCapsProcessing || fontVariantCaps == FontVariantCaps::Small || fontVariantCaps == FontVariantCaps::Petite; > > if (engageAllSmallCapsProcessing || engageSmallCapsProcessing) >- m_smallCapsBuffer.resize(m_end); >+ m_smallCapsBuffer.resize(m_normalizedCharacters.size()); > > unsigned indexOfFontTransition = 0; >- const UChar* curr = cp; >- const UChar* end = cp + m_end; > > const Font* font; > const Font* nextFont; >@@ -372,7 +429,7 @@ void ComplexTextController::collectComplexTextRuns() > if (!advanceByCombiningCharacterSequence(curr, end, baseCharacter, markCount)) > return; > >- nextFont = m_font.fontForCombiningCharacterSequence(cp, curr - cp); >+ nextFont = m_font.fontForCombiningCharacterSequence(m_normalizedCharacters.data(), curr - m_normalizedCharacters.data()); > > bool isSmallCaps = false; > bool nextIsSmallCaps = false; >@@ -381,18 +438,18 @@ void ComplexTextController::collectComplexTextRuns() > if (shouldSynthesize(dontSynthesizeSmallCaps, nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) { > synthesizedFont = &nextFont->noSynthesizableFeaturesFont(); > smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription()); >- UChar32 characterToWrite = capitalizedBase ? capitalizedBase.value() : cp[0]; >+ UChar32 characterToWrite = capitalizedBase ? capitalizedBase.value() : m_normalizedCharacters.data()[0]; > unsigned characterIndex = 0; > U16_APPEND_UNSAFE(m_smallCapsBuffer, characterIndex, characterToWrite); >- for (unsigned i = characterIndex; cp + i < curr; ++i) >- m_smallCapsBuffer[i] = cp[i]; >+ for (unsigned i = characterIndex; m_normalizedCharacters.data() + i < curr; ++i) >+ m_smallCapsBuffer[i] = m_normalizedCharacters[i]; > nextIsSmallCaps = true; > } > > while (curr < end) { > font = nextFont; > isSmallCaps = nextIsSmallCaps; >- unsigned index = curr - cp; >+ unsigned index = curr - m_normalizedCharacters.data(); > > if (!advanceByCombiningCharacterSequence(curr, end, baseCharacter, markCount)) > return; >@@ -402,12 +459,12 @@ void ComplexTextController::collectComplexTextRuns() > unsigned characterIndex = index; > U16_APPEND_UNSAFE(m_smallCapsBuffer, characterIndex, capitalizedBase.value()); > for (unsigned i = 0; i < markCount; ++i) >- m_smallCapsBuffer[i + characterIndex] = cp[i + characterIndex]; >+ m_smallCapsBuffer[i + characterIndex] = m_normalizedCharacters[i + characterIndex]; > nextIsSmallCaps = true; > } else { > if (engageAllSmallCapsProcessing) { >- for (unsigned i = 0; i < curr - cp - index; ++i) >- m_smallCapsBuffer[index + i] = cp[index + i]; >+ for (unsigned i = 0; i < curr - m_normalizedCharacters.data() - index; ++i) >+ m_smallCapsBuffer[index + i] = m_normalizedCharacters[index + i]; > } > nextIsSmallCaps = engageAllSmallCapsProcessing; > } >@@ -416,7 +473,7 @@ void ComplexTextController::collectComplexTextRuns() > if (baseCharacter == zeroWidthJoiner) > nextFont = font; > else >- nextFont = m_font.fontForCombiningCharacterSequence(cp + index, curr - cp - index); >+ nextFont = m_font.fontForCombiningCharacterSequence(m_normalizedCharacters.data() + index, curr - m_normalizedCharacters.data() - index); > > capitalizedBase = capitalized(baseCharacter); > if (!synthesizedFont && shouldSynthesize(dontSynthesizeSmallCaps, nextFont, baseCharacter, capitalizedBase, fontVariantCaps, engageAllSmallCapsProcessing)) { >@@ -424,7 +481,7 @@ void ComplexTextController::collectComplexTextRuns() > synthesizedFont = &nextFont->noSynthesizableFeaturesFont(); > smallSynthesizedFont = synthesizedFont->smallCapsFont(m_font.fontDescription()); > nextIsSmallCaps = true; >- curr = cp + indexOfFontTransition; >+ curr = m_normalizedCharacters.data() + indexOfFontTransition; > continue; > } > >@@ -436,9 +493,9 @@ void ComplexTextController::collectComplexTextRuns() > if (isSmallCaps) > collectComplexTextRunsForCharacters(m_smallCapsBuffer.data() + itemStart, itemLength, itemStart, smallSynthesizedFont); > else >- collectComplexTextRunsForCharacters(cp + itemStart, itemLength, itemStart, synthesizedFont); >+ collectComplexTextRunsForCharacters(m_normalizedCharacters.data() + itemStart, itemLength, itemStart, synthesizedFont); > } else >- collectComplexTextRunsForCharacters(cp + itemStart, itemLength, itemStart, font); >+ collectComplexTextRunsForCharacters(m_normalizedCharacters.data() + itemStart, itemLength, itemStart, font); > if (nextFont != font) { > synthesizedFont = nullptr; > smallSynthesizedFont = nullptr; >@@ -449,17 +506,17 @@ void ComplexTextController::collectComplexTextRuns() > } > } > >- ASSERT(m_end >= indexOfFontTransition); >- unsigned itemLength = m_end - indexOfFontTransition; >+ ASSERT(m_normalizedCharacters.size() >= indexOfFontTransition); >+ unsigned itemLength = m_normalizedCharacters.size() - indexOfFontTransition; > if (itemLength) { > unsigned itemStart = indexOfFontTransition; > if (synthesizedFont) { > if (nextIsSmallCaps) > collectComplexTextRunsForCharacters(m_smallCapsBuffer.data() + itemStart, itemLength, itemStart, smallSynthesizedFont); > else >- collectComplexTextRunsForCharacters(cp + itemStart, itemLength, itemStart, synthesizedFont); >+ collectComplexTextRunsForCharacters(m_normalizedCharacters.data() + itemStart, itemLength, itemStart, synthesizedFont); > } else >- collectComplexTextRunsForCharacters(cp + itemStart, itemLength, itemStart, nextFont); >+ collectComplexTextRunsForCharacters(m_normalizedCharacters.data() + itemStart, itemLength, itemStart, nextFont); > } > > if (!m_run.ltr()) >@@ -586,6 +643,9 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, G > > m_currentCharacter = offset; > >+ offset = m_inputToNormalizedStringOffsetMap[offset]; >+ auto endOffset = offset; >+ > size_t runCount = m_complexTextRuns.size(); > > unsigned indexOfLeftmostGlyphInCurrentRun = 0; // Relative to the beginning of ComplexTextController. >@@ -618,7 +678,7 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, G > > FloatSize adjustedBaseAdvance = m_adjustedBaseAdvances[glyphIndexIntoComplexTextController]; > >- if (glyphStartOffset + complexTextRun.stringLocation() >= m_currentCharacter) >+ if (glyphStartOffset + complexTextRun.stringLocation() >= endOffset) > return; > > if (glyphBuffer && !m_characterInCurrentGlyph) { >@@ -644,10 +704,10 @@ void ComplexTextController::advance(unsigned offset, GlyphBuffer* glyphBuffer, G > } > > unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph; >- m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset; >+ m_characterInCurrentGlyph = std::min(static_cast<unsigned>(endOffset) - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset; > m_runWidthSoFar += adjustedBaseAdvance.width() * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle); > >- if (glyphEndOffset + complexTextRun.stringLocation() > m_currentCharacter) >+ if (glyphEndOffset + complexTextRun.stringLocation() > endOffset) > return; > > m_numGlyphsSoFar++; >@@ -757,7 +817,8 @@ void ComplexTextController::adjustGlyphsAndAdvances() > > unsigned characterIndexInRun = characterIndex + complexTextRun.stringLocation(); > bool isFirstCharacter = !(characterIndex + complexTextRun.stringLocation()); >- bool isLastCharacter = characterIndexInRun + 1 == m_run.length() || (U16_IS_LEAD(ch) && characterIndexInRun + 2 == m_run.length() && U16_IS_TRAIL(*(cp + characterIndex + 1))); >+ auto length = m_inputToNormalizedStringOffsetMap[m_inputToNormalizedStringOffsetMap.size() - 1]; >+ bool isLastCharacter = characterIndexInRun + 1 == length || (U16_IS_LEAD(ch) && characterIndexInRun + 2 == length && U16_IS_TRAIL(*(cp + characterIndex + 1))); > > bool forceLeadingExpansion = false; // On the left, regardless of m_run.ltr() > bool forceTrailingExpansion = false; // On the right, regardless of m_run.ltr() >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.h b/Source/WebCore/platform/graphics/ComplexTextController.h >index d8f63bf22567f544c5f6525e2b7e17fc4b7b30f0..c8bc94813946b901cc5128c8c66b2a5efa8268fb 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.h >+++ b/Source/WebCore/platform/graphics/ComplexTextController.h >@@ -170,6 +170,7 @@ private: > static unsigned stringEnd(const ComplexTextRun& run) { return run.stringLocation() + run.indexEnd(); } > > void collectComplexTextRuns(); >+ void normalizeStringForShaping(); > > void collectComplexTextRunsForCharacters(const UChar*, unsigned length, unsigned stringLocation, const Font*); > void adjustGlyphsAndAdvances(); >@@ -205,7 +206,9 @@ private: > Vector<RetainPtr<CTLineRef>> m_coreTextLines; > #endif > >- Vector<String> m_stringsFor8BitRuns; >+ Vector<UChar, 256> m_normalizedCharacters; >+ Vector<size_t, 256> m_inputToNormalizedStringOffsetMap; >+ Vector<size_t, 256> m_normalizedToInputStringOffsetMap; > > HashSet<const Font*>* m_fallbackFonts { nullptr }; > >diff --git a/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >index 37f66b6ec63752c7cf1b6ea900ff9b129a4d387c..bccb861fb8e99ab17fe2f47423438d12517c916d 100644 >--- a/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >+++ b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >@@ -62,7 +62,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(hb_buffer_t* buffer, const > > // HarfBuzz returns the shaping result in visual order. We don't need to flip for RTL. > for (unsigned i = 0; i < m_glyphCount; ++i) { >- m_coreTextIndices[i] = glyphInfos[i].cluster; >+ m_coreTextIndices[i] = normalizedStringOffsetToInputStringOffset(glyphInfos[i].cluster); > > uint16_t glyph = glyphInfos[i].codepoint; > if (m_font.isZeroWidthSpaceGlyph(glyph)) { >@@ -213,7 +213,7 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cha > > HbUniquePtr<hb_font_t> harfBuzzFont(face.createFont()); > hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size()); >- m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex)); >+ m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, normalizedStringOffsetToInputStringOffsetMap.data(), run.startIndex, run.endIndex)); > hb_buffer_reset(buffer.get()); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186010
:
341407
|
341408
|
341418
|
341419
|
341447
| 341469 |
341470
|
341472
|
341476
|
341477
|
341481