Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Range.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp |
| index 61ef7b0754660f77c4a9c521bd2175fef1fa8efc..5ebd18a71a50dbecf31920927fa57ee0c0cb794d 100644 |
| --- a/third_party/WebKit/Source/core/dom/Range.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Range.cpp |
| @@ -1447,6 +1447,13 @@ static void CollectAbsoluteBoundsForRange(unsigned start, |
| 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) { |
| const Position& start_position = range.StartPosition(); |
| @@ -1473,37 +1480,25 @@ static Vector<RectType> ComputeTextBounds(const EphemeralRange& range) { |
| return result; |
| } |
| -static Vector<IntRect> computeTextRects(const EphemeralRange& range) { |
| +static Vector<IntRect> ComputeTextRects(const EphemeralRange& range) { |
| return ComputeTextBounds<IntRect>(range); |
| } |
| +static Vector<FloatQuad> ComputeTextQuads(const EphemeralRange& range) { |
|
yosin_UTC9
2017/05/08 09:14:19
Let's add TODO for ComputeTextQuads() will replace
|
| + return ComputeTextBounds<FloatQuad>(range); |
| +} |
| + |
| IntRect Range::BoundingBox() const { |
| IntRect result; |
| - const Vector<IntRect>& rects = computeTextRects(EphemeralRange(this)); |
| + const Vector<IntRect>& rects = ComputeTextRects(EphemeralRange(this)); |
| for (const IntRect& rect : rects) |
| result.Unite(rect); |
| return result; |
| } |
| void Range::TextQuads(Vector<FloatQuad>& quads) const { |
| - Node* start_container = &start_.Container(); |
| - DCHECK(start_container); |
| - Node* end_container = &end_.Container(); |
| - DCHECK(end_container); |
| - |
| - Node* stop_node = PastLastNode(); |
| - for (Node* node = FirstNode(); node != stop_node; |
| - node = NodeTraversal::Next(*node)) { |
| - LayoutObject* r = node->GetLayoutObject(); |
| - if (!r || !r->IsText()) |
| - continue; |
| - LayoutText* layout_text = ToLayoutText(r); |
| - unsigned start_offset = node == start_container ? start_.Offset() : 0; |
| - unsigned end_offset = node == end_container |
| - ? end_.Offset() |
| - : std::numeric_limits<unsigned>::max(); |
| - layout_text->AbsoluteQuadsForRange(quads, start_offset, end_offset); |
| - } |
| + const Vector<FloatQuad>& result = ComputeTextQuads(EphemeralRange(this)); |
|
yosin_UTC9
2017/05/08 09:14:18
nit: We don't need to use variable |result|.
|
| + quads.AppendVector(result); |
| } |
| bool AreRangesEqual(const Range* a, const Range* b) { |