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

Unified Diff: Source/core/accessibility/AXRenderObject.cpp

Issue 560333002: Avoid more temporary ranges in connection with various TextIterators. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months 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
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.cpp » ('j') | Source/core/editing/TextIterator.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/accessibility/AXRenderObject.cpp
diff --git a/Source/core/accessibility/AXRenderObject.cpp b/Source/core/accessibility/AXRenderObject.cpp
index 48f8af107b7377f187f18f784f1cc8cebc3941bf..68d9f18c3145c551a1a122107843a9f8978a99d2 100644
--- a/Source/core/accessibility/AXRenderObject.cpp
+++ b/Source/core/accessibility/AXRenderObject.cpp
@@ -1738,12 +1738,12 @@ VisiblePosition AXRenderObject::visiblePositionForIndex(int index) const
if (index <= 0)
return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
- RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document());
- range->selectNodeContents(node, IGNORE_EXCEPTION);
- CharacterIterator it(range.get());
+ Position start, end;
+ bool selected = Range::selectNodeContents(node, start, end);
yosin_UTC9 2014/09/12 01:02:24 It seems utilizing |selected| makes cleaner. if (
Mads Ager (chromium) 2014/09/12 10:52:08 Done.
+ ASSERT_UNUSED(selected, selected);
+ CharacterIterator it(start, end);
it.advance(index - 1);
- return VisiblePosition(Position(it.range()->endContainer(), it.range()->endOffset(), Position::PositionIsOffsetInAnch\
-or), UPSTREAM);
+ return VisiblePosition(Position(it.endContainer(), it.endOffset(), Position::PositionIsOffsetInAnchor), UPSTREAM);
}
int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.cpp » ('j') | Source/core/editing/TextIterator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698