| 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 f953a2630b0faab92dc3a4259336e58aded96745..afe553a213561b28d48b0aaab111e716ddc20792 100644
|
| --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
|
| @@ -4105,22 +4105,7 @@ PositionInFlatTree SkipWhitespace(const PositionInFlatTree& position) {
|
| return SkipWhitespaceAlgorithm(position);
|
| }
|
|
|
| -static void CollectAbsoluteBoundsForRange(unsigned start,
|
| - unsigned end,
|
| - const LayoutText& layout_text,
|
| - Vector<IntRect>& rects) {
|
| - layout_text.AbsoluteRectsForRange(rects, start, end);
|
| -}
|
| -
|
| -static void CollectAbsoluteBoundsForRange(unsigned start,
|
| - unsigned end,
|
| - const LayoutText& layout_text,
|
| - Vector<FloatQuad>& quads) {
|
| - layout_text.AbsoluteQuadsForRange(quads, start, end);
|
| -}
|
| -
|
| -template <typename RectType>
|
| -static Vector<RectType> ComputeTextBounds(const EphemeralRange& range) {
|
| +static Vector<FloatQuad> ComputeTextBounds(const EphemeralRange& range) {
|
| const Position& start_position = range.StartPosition();
|
| const Position& end_position = range.EndPosition();
|
| Node* const start_container = start_position.ComputeContainerNode();
|
| @@ -4128,7 +4113,7 @@ static Vector<RectType> ComputeTextBounds(const EphemeralRange& range) {
|
| Node* const end_container = end_position.ComputeContainerNode();
|
| DCHECK(end_container);
|
|
|
| - Vector<RectType> result;
|
| + Vector<FloatQuad> result;
|
| for (const Node& node : range.Nodes()) {
|
| LayoutObject* const layout_object = node.GetLayoutObject();
|
| if (!layout_object || !layout_object->IsText())
|
| @@ -4139,18 +4124,21 @@ static Vector<RectType> ComputeTextBounds(const EphemeralRange& range) {
|
| unsigned end_offset = node == end_container
|
| ? end_position.OffsetInContainerNode()
|
| : std::numeric_limits<unsigned>::max();
|
| - CollectAbsoluteBoundsForRange(start_offset, end_offset, *layout_text,
|
| - result);
|
| + layout_text->AbsoluteQuadsForRange(result, start_offset, end_offset);
|
| }
|
| return result;
|
| }
|
|
|
| -Vector<IntRect> ComputeTextRects(const EphemeralRange& range) {
|
| - return ComputeTextBounds<IntRect>(range);
|
| +IntRect ComputeTextRect(const EphemeralRange& range) {
|
| + IntRect result;
|
| + const Vector<FloatQuad>& rects = ComputeTextBounds(range);
|
| + for (const FloatQuad& rect : rects)
|
| + result.Unite(rect.EnclosingBoundingBox());
|
| + return result;
|
| }
|
|
|
| Vector<FloatQuad> ComputeTextQuads(const EphemeralRange& range) {
|
| - return ComputeTextBounds<FloatQuad>(range);
|
| + return ComputeTextBounds(range);
|
| }
|
|
|
| } // namespace blink
|
|
|