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

Unified Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 330383004: Oilpan: Introduce TempRangeScope to avoid needless Range attaches on Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« Source/core/dom/Range.h ('K') | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 06a5579087d1bb2131efb3dd86802a41428cfacb..8c9fc9a6f7b1fd096474582d0235f4e7594a53d4 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -317,6 +317,7 @@ VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c
{
if (index <= 0)
return VisiblePosition(firstPositionInNode(innerEditorElement()), DOWNSTREAM);
+ TempRangeScope scope;
RefPtrWillBeRawPtr<Range> range = Range::create(document());
range->selectNodeContents(innerEditorElement(), ASSERT_NO_EXCEPTION);
CharacterIterator it(range.get());
@@ -329,6 +330,7 @@ int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& p
Position indexPosition = pos.deepEquivalent().parentAnchoredEquivalent();
if (enclosingTextFormControl(indexPosition) != this)
return 0;
+ TempRangeScope scope;
ASSERT(indexPosition.document());
RefPtrWillBeRawPtr<Range> range = Range::create(*indexPosition.document());
range->setStart(innerEditorElement(), 0, ASSERT_NO_EXCEPTION);
« Source/core/dom/Range.h ('K') | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698