Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: third_party/WebKit/Source/core/dom/Range.cpp

Issue 1409073004: Return EphemeralRange from Editor::findRangeOfString. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extract text bounds collecting to a function Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698