| Index: Source/core/rendering/InlineTextBox.cpp
|
| diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
|
| index 5e6648ff1a7b37e4c277973f2be1ba9ff0381128..3eaf7191c84abdd5289a7a420ccb1211ef857e25 100644
|
| --- a/Source/core/rendering/InlineTextBox.cpp
|
| +++ b/Source/core/rendering/InlineTextBox.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/platform/graphics/DrawLooper.h"
|
| #include "core/platform/graphics/FontCache.h"
|
| #include "core/platform/graphics/GraphicsContextStateSaver.h"
|
| +#include "core/platform/graphics/WidthIterator.h"
|
| #include "core/rendering/EllipsisBox.h"
|
| #include "core/rendering/HitTestResult.h"
|
| #include "core/rendering/PaintInfo.h"
|
| @@ -1487,6 +1488,29 @@ bool InlineTextBox::containsCaretOffset(int offset) const
|
| return true;
|
| }
|
|
|
| +void InlineTextBox::characterWidths(float widths[]) const
|
| +{
|
| + FontCachePurgePreventer fontCachePurgePreventer;
|
| +
|
| + RenderText* textObj = textRenderer();
|
| + RenderStyle* styleToUse = textObj->style(isFirstLineStyle());
|
| + const Font& font = styleToUse->font();
|
| +
|
| + StringBuilder charactersWithHyphen;
|
| + TextRun textRun = constructTextRun(styleToUse, font, hasHyphen() ? &charactersWithHyphen : 0);
|
| +
|
| + GlyphBuffer glyphBuffer;
|
| + WidthIterator it(&font, textRun);
|
| + float lastWidth = 0;
|
| + for (unsigned i = 0; i < m_len; i++) {
|
| + it.advance(i + 1, &glyphBuffer);
|
| + widths[i] = it.m_runWidthSoFar - lastWidth;
|
| + if (textRun.rtl())
|
| + widths[i] = -widths[i];
|
| + lastWidth = it.m_runWidthSoFar;
|
| + }
|
| +}
|
| +
|
| TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, StringBuilder* charactersWithHyphen) const
|
| {
|
| ASSERT(style);
|
|
|