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

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

Issue 258063005: Blink does not respect input.selectionStart and input.selectionEnd for some cases (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 03bb788a82123d35f12d842f94d1dfe6c684e543..543f5c433bda21bd089ff9d83eab54ae06ab7a0b 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -510,7 +510,10 @@ int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return 0;
}
- return HTMLTextFormControlElement::selectionStart();
+
+ if (!isEmptyValue())
tkent 2014/04/29 23:55:44 This looks weird. If we need such check, we should
harpreet.sk 2014/04/30 14:36:27 Move the check to selectionStart()
+ return HTMLTextFormControlElement::selectionStart();
+ return 0;
}
int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) const
@@ -519,7 +522,10 @@ int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return 0;
}
- return HTMLTextFormControlElement::selectionEnd();
+
+ if (!isEmptyValue())
+ return HTMLTextFormControlElement::selectionEnd();
+ return 0;
}
String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionState) const

Powered by Google App Engine
This is Rietveld 408576698