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

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

Issue 2278373002: Fix selectionEnd value in a case of dragging out from an INPUT element. (Closed)
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
index aaebf9ab04d740383ab5f28989f4b9a5b29f9448..816cfb2f6835166cf9e314a41283840dd93c27d5 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
@@ -309,7 +309,7 @@ static Position positionForIndex(HTMLElement* innerEditor, int index)
return lastPositionInOrAfterNode(lastBrOrText);
}
-static int indexForPosition(HTMLElement* innerEditor, const Position& passedPosition)
+int HTMLTextFormControlElement::indexForPosition(HTMLElement* innerEditor, const Position& passedPosition)
{
if (!innerEditor || !innerEditor->contains(passedPosition.anchorNode()) || passedPosition.isNull())
return 0;
@@ -321,6 +321,8 @@ static int indexForPosition(HTMLElement* innerEditor, const Position& passedPosi
Node* startNode = passedPosition.computeNodeBeforePosition();
if (!startNode)
startNode = passedPosition.computeContainerNode();
+ if (startNode == innerEditor && passedPosition.isAfterAnchor())
+ startNode = innerEditor->lastChild();
DCHECK(startNode);
DCHECK(innerEditor->contains(startNode));

Powered by Google App Engine
This is Rietveld 408576698