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

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

Issue 1229133004: Add SelectionMode enum for setRangeText() in HTMLInputElement and HTMLTextAreaElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix for failing tests Created 5 years, 5 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 | « Source/core/html/HTMLTextAreaElement.idl ('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 51618f9869b0adcc8d1723052a7ace42d41a51db..030a06aa139132c9400c43dced3c5a77cba9e655 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -208,7 +208,7 @@ void HTMLTextFormControlElement::dispatchFormControlChangeEvent()
void HTMLTextFormControlElement::setRangeText(const String& replacement, ExceptionState& exceptionState)
{
- setRangeText(replacement, selectionStart(), selectionEnd(), String(), exceptionState);
+ setRangeText(replacement, selectionStart(), selectionEnd(), "preserve", exceptionState);
}
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& exceptionState)
@@ -242,15 +242,15 @@ void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigne
subtreeHasChanged();
- if (equalIgnoringCase(selectionMode, "select")) {
+ if (selectionMode == "select") {
newSelectionStart = start;
newSelectionEnd = start + replacementLength;
- } else if (equalIgnoringCase(selectionMode, "start")) {
+ } else if (selectionMode == "start") {
newSelectionStart = newSelectionEnd = start;
- } else if (equalIgnoringCase(selectionMode, "end")) {
+ } else if (selectionMode == "end") {
newSelectionStart = newSelectionEnd = start + replacementLength;
} else {
- // Default is "preserve".
+ ASSERT(selectionMode == "preserve");
long delta = replacementLength - (end - start);
if (newSelectionStart > end)
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698