Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
index 79c58d5dec8115e276f266d62685a090e5609cfb..ac5f6cf6f5f5fe51c4bedc92584d7cf0dfed3410 100644 |
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
@@ -4004,4 +4004,36 @@ VisiblePositionInFlatTree previousPositionOf( |
visiblePosition.deepEquivalent(), rule); |
} |
+template <typename Strategy> |
+void textQuads(Vector<FloatQuad>& quad, |
+ const EphemeralRangeTemplate<Strategy>& range) { |
+ const PositionTemplate<Strategy> startPosition = range.startPosition(); |
+ const PositionTemplate<Strategy> endPosition = range.endPosition(); |
+ Node* startContainer = startPosition.computeContainerNode(); |
+ DCHECK(startContainer); |
+ Node* endContainer = endPosition.computeContainerNode(); |
+ DCHECK(endContainer); |
+ |
+ for (Node& node : range.nodes()) { |
+ LayoutObject* layoutObject = node.layoutObject(); |
+ if (!layoutObject || !layoutObject->isText()) |
+ continue; |
+ LayoutText* layoutText = toLayoutText(layoutObject); |
+ unsigned startOffset = |
+ node == startContainer ? startPosition.offsetInContainerNode() : 0; |
+ unsigned endOffset = node == endContainer |
+ ? endPosition.offsetInContainerNode() |
+ : std::numeric_limits<unsigned>::max(); |
+ layoutText->absoluteQuadsForRange(quad, startOffset, endOffset); |
+ } |
+} |
+ |
+void textQuad(Vector<FloatQuad>& quad, const EphemeralRange& range) { |
+ textQuads(quad, range); |
+} |
+ |
+void textQuad(Vector<FloatQuad>& quad, const EphemeralRangeInFlatTree& range) { |
+ textQuads(quad, range); |
+} |
+ |
} // namespace blink |