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 c6a2518eeb5e451c0d8d8d5e60a915bd1f05f80b..1a33ef97b6325948f640f4c9c0d2e00ca8c73d2a 100644 |
--- a/third_party/WebKit/Source/core/dom/Range.cpp |
+++ b/third_party/WebKit/Source/core/dom/Range.cpp |
@@ -1300,27 +1300,12 @@ IntRect Range::boundingBox() const |
void Range::textRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed) const |
{ |
- Node* startContainer = m_start.container(); |
- ASSERT(startContainer); |
- Node* endContainer = m_end.container(); |
- ASSERT(endContainer); |
- |
bool allFixed = true; |
bool someFixed = false; |
- |
- Node* stopNode = pastLastNode(); |
- for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) { |
- LayoutObject* r = node->layoutObject(); |
- if (!r || !r->isText()) |
- continue; |
- LayoutText* layoutText = toLayoutText(r); |
- int startOffset = node == startContainer ? m_start.offset() : 0; |
- int endOffset = node == endContainer ? m_end.offset() : std::numeric_limits<int>::max(); |
- bool isFixed = false; |
- layoutText->absoluteRectsForRange(rects, startOffset, endOffset, useSelectionHeight, &isFixed); |
- allFixed &= isFixed; |
- someFixed |= isFixed; |
- } |
+ collectTextBoundsInRange( |
+ m_start.container(), m_start.offset(), m_end.container(), m_end.offset(), |
+ firstNode(), pastLastNode(), &NodeTraversal::next, |
+ rects, useSelectionHeight, &allFixed, &someFixed); |
if (inFixed) |
*inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixedPosition : NotFixedPosition); |
@@ -1328,27 +1313,12 @@ void Range::textRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFi |
void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeInFixedPosition* inFixed) const |
{ |
- Node* startContainer = m_start.container(); |
- ASSERT(startContainer); |
- Node* endContainer = m_end.container(); |
- ASSERT(endContainer); |
- |
bool allFixed = true; |
bool someFixed = false; |
- |
- Node* stopNode = pastLastNode(); |
- for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) { |
- LayoutObject* r = node->layoutObject(); |
- if (!r || !r->isText()) |
- continue; |
- LayoutText* layoutText = toLayoutText(r); |
- int startOffset = node == startContainer ? m_start.offset() : 0; |
- int endOffset = node == endContainer ? m_end.offset() : std::numeric_limits<int>::max(); |
- bool isFixed = false; |
- layoutText->absoluteQuadsForRange(quads, startOffset, endOffset, useSelectionHeight, &isFixed); |
- allFixed &= isFixed; |
- someFixed |= isFixed; |
- } |
+ collectTextBoundsInRange( |
+ m_start.container(), m_start.offset(), m_end.container(), m_end.offset(), |
+ firstNode(), pastLastNode(), &NodeTraversal::next, |
+ quads, useSelectionHeight, &allFixed, &someFixed); |
if (inFixed) |
*inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixedPosition : NotFixedPosition); |