Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2062)

Unified Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 1133853006: Elements whose contents start with an astral Unicode symbol disappear when CSS `::first-letter` is … Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed UAF failures for ASan Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/FirstLetterPseudoElement.cpp ('k') | Source/platform/text/TextBreakIterator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index 895bb6c77785f5c555e36a190bee8022ab77db0b..a9de6cdb9864eebfa05e207a4246040f87d5456d 100644
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -212,27 +212,6 @@ float ShapeResult::fillGlyphBufferForRun(GlyphBuffer* glyphBuffer,
return advanceSoFar - initialAdvance;
}
-static inline unsigned countGraphemesInCluster(const UChar* str,
- unsigned strLength, uint16_t startIndex, uint16_t endIndex)
-{
- if (startIndex > endIndex) {
- uint16_t tempIndex = startIndex;
- startIndex = endIndex;
- endIndex = tempIndex;
- }
- uint16_t length = endIndex - startIndex;
- ASSERT(static_cast<unsigned>(startIndex + length) <= strLength);
- TextBreakIterator* cursorPosIterator = cursorMovementIterator(&str[startIndex], length);
-
- int cursorPos = cursorPosIterator->current();
- int numGraphemes = -1;
- while (0 <= cursorPos) {
- cursorPos = cursorPosIterator->next();
- numGraphemes++;
- }
- return numGraphemes < 0 ? 0 : numGraphemes;
-}
-
static inline void addEmphasisMark(GlyphBuffer* buffer,
const GlyphData* emphasisData, FloatPoint glyphCenter,
float midGlyphOffset)
@@ -310,7 +289,7 @@ float ShapeResult::fillGlyphBufferForTextEmphasisRun(GlyphBuffer* glyphBuffer,
else
clusterEnd = isRunEnd ? run->m_startIndex + run->m_numCharacters + runOffset : run->glyphToCharacterIndex(i + 1) + runOffset;
- graphemesInCluster = countGraphemesInCluster(textRun.characters16(), textRun.charactersLength(), clusterStart, clusterEnd);
+ graphemesInCluster = countCharactersAndGraphemesInCluster(textRun.characters16(), textRun.charactersLength(), clusterStart, clusterEnd).graphemes;
if (!graphemesInCluster || !clusterAdvance)
continue;
« no previous file with comments | « Source/core/dom/FirstLetterPseudoElement.cpp ('k') | Source/platform/text/TextBreakIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698