Index: Source/core/html/HTMLInputElement.cpp |
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp |
index 723a5e6292c8f63c82d1b651ebf7001d1b3dca7b..e2e6443f61cc18b2cd8b5d963cb5473f87cab909 100644 |
--- a/Source/core/html/HTMLInputElement.cpp |
+++ b/Source/core/html/HTMLInputElement.cpp |
@@ -521,17 +521,18 @@ bool HTMLInputElement::canHaveSelection() const |
int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) const |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
tkent
2013/12/13 00:07:29
We can just replace canHaveSelection() with m_inpu
Habib Virji
2013/12/13 12:05:04
Done.
|
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return 0; |
} |
+ |
tkent
2013/12/13 00:07:29
We don't need to add this blank line.
Habib Virji
2013/12/13 12:05:04
Done.
|
return HTMLTextFormControlElement::selectionStart(); |
} |
int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) const |
{ |
- if (!canHaveSelection()) { |
- exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
+ if (!canHaveSelection() || !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 +540,7 @@ int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con |
String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionState) const |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return String(); |
} |
@@ -548,7 +549,7 @@ String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS |
void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& exceptionState) |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return; |
} |
@@ -557,7 +558,7 @@ void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex |
void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& exceptionState) |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return; |
} |
@@ -566,7 +567,7 @@ void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& except |
void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionState& exceptionState) |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return; |
} |
@@ -575,7 +576,7 @@ void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, |
void HTMLInputElement::setSelectionRangeForBinding(int start, int end, ExceptionState& exceptionState) |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return; |
} |
@@ -584,7 +585,7 @@ void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception |
void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionState& exceptionState) |
{ |
- if (!canHaveSelection()) { |
+ if (!canHaveSelection() && !m_inputType->supportsSelectionAPI()) { |
exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
return; |
} |