Index: Source/core/rendering/InlineTextBox.cpp |
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp |
index daad21921ecb046cd8be32dc034dd96fd547ba79..2a18c09af9ad4cd90f521f6221aeb402cfd1130f 100644 |
--- a/Source/core/rendering/InlineTextBox.cpp |
+++ b/Source/core/rendering/InlineTextBox.cpp |
@@ -23,6 +23,7 @@ |
#include "config.h" |
#include "core/rendering/InlineTextBox.h" |
+#include "core/accessibility/AXObjectCache.h" |
#include "core/dom/Document.h" |
#include "core/dom/DocumentMarkerController.h" |
#include "core/dom/RenderedDocumentMarker.h" |
@@ -35,6 +36,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" |
@@ -69,6 +71,9 @@ static const int misspellingLineThickness = 3; |
void InlineTextBox::destroy() |
{ |
+ if (AXObjectCache* cache = renderer()->document().existingAXObjectCache()) |
+ cache->remove(this); |
+ |
if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow) |
gTextBoxesWithOverflow->remove(this); |
InlineBox::destroy(); |
@@ -1474,6 +1479,39 @@ bool InlineTextBox::containsCaretOffset(int offset) const |
return true; |
} |
+void InlineTextBox::characterWidths(Vector<float>& widths) const |
+{ |
+ FontCachePurgePreventer fontCachePurgePreventer; |
+ |
+ RenderText* textObj = textRenderer(); |
+ RenderStyle* styleToUse = textObj->style(isFirstLineStyle()); |
+ const Font& font = styleToUse->font(); |
+ |
+ TextRun textRun = constructTextRun(styleToUse, font); |
+ |
+ GlyphBuffer glyphBuffer; |
+ WidthIterator it(&font, textRun); |
+ float lastWidth = 0; |
+ widths.resize(m_len); |
+ for (unsigned i = 0; i < m_len; i++) { |
+ it.advance(i + 1, &glyphBuffer); |
+ widths[i] = it.m_runWidthSoFar - lastWidth; |
+ lastWidth = it.m_runWidthSoFar; |
+ } |
+} |
+ |
+bool InlineTextBox::isRTL() const |
igoroliveira
2013/10/03 03:11:55
InlineBox::direction() is not enough here?
dmazzoni
2013/10/03 03:22:33
Thanks, that's obviously what I was looking for.
|
+{ |
+ FontCachePurgePreventer fontCachePurgePreventer; |
+ |
+ RenderText* textObj = textRenderer(); |
+ RenderStyle* styleToUse = textObj->style(isFirstLineStyle()); |
+ const Font& font = styleToUse->font(); |
+ |
+ TextRun textRun = constructTextRun(styleToUse, font); |
+ return textRun.rtl(); |
+} |
+ |
TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, StringBuilder* charactersWithHyphen) const |
{ |
ASSERT(style); |