Index: Source/core/editing/VisibleUnits.cpp |
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp |
index 64518ec2174effabb75b274eda7c18bbd87dbaac..482ae8105286da36d7f846e0dd048aa262c26b20 100644 |
--- a/Source/core/editing/VisibleUnits.cpp |
+++ b/Source/core/editing/VisibleUnits.cpp |
@@ -1386,4 +1386,26 @@ VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire |
return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
} |
+LayoutRect localCaretRectOfPosition(const PositionWithAffinity& position, RenderObject*& renderer) |
+{ |
+ if (position.position().isNull()) { |
+ renderer = nullptr; |
+ return IntRect(); |
+ } |
+ Node* node = position.position().anchorNode(); |
+ |
+ renderer = node->renderer(); |
+ if (!renderer) |
+ return LayoutRect(); |
+ |
+ InlineBox* inlineBox; |
+ int caretOffset; |
+ position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, caretOffset); |
+ |
+ if (inlineBox) |
+ renderer = &inlineBox->renderer(); |
+ |
+ return renderer->localCaretRect(inlineBox, caretOffset); |
+} |
+ |
} |