Index: Source/core/html/HTMLTextFormControlElement.cpp |
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp |
index 1cfab17e841ced2e367b7ad2c8c31777f1636fdc..bcdd82a7d0d7d3dc4a4f6b27c5247945a490ef5b 100644 |
--- a/Source/core/html/HTMLTextFormControlElement.cpp |
+++ b/Source/core/html/HTMLTextFormControlElement.cpp |
@@ -266,7 +266,7 @@ void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigne |
setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection); |
} |
-void HTMLTextFormControlElement::setSelectionRange(int start, int end, const String& directionString) |
+void HTMLTextFormControlElement::setSelectionRange(unsigned start, unsigned end, const String& directionString) |
{ |
TextFieldSelectionDirection direction = SelectionHasNoDirection; |
if (directionString == "forward") |
@@ -346,15 +346,15 @@ static int indexForPosition(HTMLElement* innerEditor, const Position& passedPosi |
return index; |
} |
-void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, SelectionOption selectionOption) |
+void HTMLTextFormControlElement::setSelectionRange(unsigned start, unsigned end, TextFieldSelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, SelectionOption selectionOption) |
{ |
if (openShadowRoot() || !isTextFormControl() || !inDocument()) |
return; |
const int editorValueLength = static_cast<int>(innerEditorValue().length()); |
philipj_slow
2015/08/12 13:20:03
Making this unsigned now would make more sense.
tanay.c
2015/08/14 05:39:11
Done.
|
ASSERT(editorValueLength >= 0); |
- end = std::max(std::min(end, editorValueLength), 0); |
- start = std::min(std::max(start, 0), end); |
+ end = std::min<unsigned>(end, editorValueLength); |
+ start = std::min<unsigned>(start, end); |
cacheSelection(start, end, direction); |
if (selectionOption == NotChangeSelection || (selectionOption == ChangeSelectionIfFocused && document().focusedElement() != this)) { |
@@ -371,8 +371,8 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField |
Position startPosition = positionForIndex(innerEditor, start); |
Position endPosition = start == end ? startPosition : positionForIndex(innerEditor, end); |
- ASSERT(start == indexForPosition(innerEditor, startPosition)); |
- ASSERT(end == indexForPosition(innerEditor, endPosition)); |
+ ASSERT(start == (unsigned)indexForPosition(innerEditor, startPosition)); |
philipj_slow
2015/08/12 13:20:03
So indexForPosition() still returns int. It looks
tanay.c
2015/08/14 05:39:11
It may not be possible to find a clean cut boundar
|
+ ASSERT(end == (unsigned)indexForPosition(innerEditor, endPosition)); |
// startPosition and endPosition can be null position for example when |
// "-webkit-user-select: none" style attribute is specified. |