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

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

Issue 100433008: Disable select api for input type number and email (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per code review Created 7 years 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 | « LayoutTests/fast/forms/selection-wrongtype-expected.txt ('k') | Source/core/html/forms/NumberInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 723a5e6292c8f63c82d1b651ebf7001d1b3dca7b..8c955cf8233933fe761f174a8184036e4b3e930e 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -521,7 +521,7 @@ bool HTMLInputElement::canHaveSelection() const
int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) const
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return 0;
}
@@ -530,8 +530,8 @@ int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c
int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) const
{
- if (!canHaveSelection()) {
- exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
+ if (!m_inputType->supportsSelectionAPI()) {
+ exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return 0;
}
return HTMLTextFormControlElement::selectionEnd();
@@ -539,7 +539,7 @@ int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con
String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionState) const
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return String();
}
@@ -548,7 +548,7 @@ String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS
void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& exceptionState)
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return;
}
@@ -557,7 +557,7 @@ void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex
void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& exceptionState)
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return;
}
@@ -566,7 +566,7 @@ void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& except
void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionState& exceptionState)
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return;
}
@@ -575,7 +575,7 @@ void HTMLInputElement::setSelectionDirectionForBinding(const String& direction,
void HTMLInputElement::setSelectionRangeForBinding(int start, int end, ExceptionState& exceptionState)
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return;
}
@@ -584,7 +584,7 @@ void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception
void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionState& exceptionState)
{
- if (!canHaveSelection()) {
+ if (!m_inputType->supportsSelectionAPI()) {
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
return;
}
« no previous file with comments | « LayoutTests/fast/forms/selection-wrongtype-expected.txt ('k') | Source/core/html/forms/NumberInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698