Index: Source/core/rendering/RenderText.cpp |
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp |
index b5f82e123980b614f1bd6358c6570710238ff02c..267fdc31f52ad0877923a0cb32c0175b60666718 100644 |
--- a/Source/core/rendering/RenderText.cpp |
+++ b/Source/core/rendering/RenderText.cpp |
@@ -1863,4 +1863,69 @@ void RenderText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacter |
secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
} |
+RenderText::AbstractInlineTextBox* RenderText::firstInlineTextBox() const |
+{ |
+ return m_firstTextBox; |
+} |
+ |
+RenderText::AbstractInlineTextBox* RenderText::nextInlineTextBox(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ return inlineTextBox->nextTextBox(); |
+} |
+ |
+LayoutRect RenderText::inlineTextBoxBounds(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ FloatRect boundaries = inlineTextBox->calculateBoundaries(); |
+ return localToAbsoluteQuad(boundaries).enclosingBoundingBox(); |
+} |
+ |
+unsigned RenderText::inlineTextBoxStart(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ return inlineTextBox->start(); |
+} |
+ |
+unsigned RenderText::inlineTextBoxLen(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ return inlineTextBox->len(); |
+} |
+ |
+RenderText::AbstractInlineTextBoxDirection RenderText::inlineTextBoxDirection(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ if (style()->isHorizontalWritingMode()) |
+ return (inlineTextBox->isRTL() ? AbstractInlineTextBoxDirectionRL : AbstractInlineTextBoxDirectionLR); |
+ return (inlineTextBox->isRTL() ? AbstractInlineTextBoxDirectionBT : AbstractInlineTextBoxDirectionTB); |
+} |
+ |
+void RenderText::inlineTextBoxCharacterWidths(RenderText::AbstractInlineTextBox* inlineTextBox, Vector<float>& widths) const |
+{ |
+ inlineTextBox->characterWidths(widths); |
+} |
+ |
+void RenderText::inlineTextBoxWordBoundaries(RenderText::AbstractInlineTextBox* inlineTextBox, Vector<WordBoundaries>& words) const |
+{ |
+ int start = inlineTextBox->start(); |
+ int len = inlineTextBox->len(); |
+ TextBreakIterator* iterator = wordBreakIterator(text(), start, len); |
+ int pos = textBreakFirst(iterator); |
+ while (pos >= 0 && pos < len) { |
+ pos = textBreakNext(iterator); |
+ if (isWordTextBreak(iterator)) |
+ words.append(WordBoundaries(textBreakPrevious(iterator), textBreakNext(iterator))); |
+ } |
+} |
+ |
+String RenderText::inlineTextBoxText(RenderText::AbstractInlineTextBox* inlineTextBox) const |
+{ |
+ unsigned start = inlineTextBox->start(); |
+ unsigned len = inlineTextBox->len(); |
+ if (Node* node = this->node()) { |
+ RefPtr<Range> range = Range::create(node->document()); |
+ range->setStart(node, start, IGNORE_EXCEPTION); |
+ range->setEnd(node, start + len, IGNORE_EXCEPTION); |
+ return plainText(range.get(), TextIteratorIgnoresStyleVisibility); |
+ } |
+ |
+ return text().substring(start, len); |
+} |
+ |
} // namespace WebCore |