OpenJDK / openjfx / 9-dev / rt
changeset 9495:765fd07f22fc
8146715: Input fields accepting characters beyond maxlength attribute
Reviewed-by: arajkumar, azvegint, kcr
author | mbilla |
---|---|
date | Wed, 13 Jan 2016 11:24:59 +0300 |
parents | 016699a35e07 |
children | e798692dff17 |
files | modules/web/src/main/native/Source/WebCore/html/TextFieldInputType.cpp |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/web/src/main/native/Source/WebCore/html/TextFieldInputType.cpp Wed Jan 13 14:13:35 2016 +1300 +++ b/modules/web/src/main/native/Source/WebCore/html/TextFieldInputType.cpp Wed Jan 13 11:24:59 2016 +0300 @@ -385,7 +385,10 @@ unsigned selectionLength = 0; if (element().focused()) { ASSERT(enclosingTextFormControl(element().document().frame()->selection().selection().start()) == &element()); - selectionLength = numGraphemeClusters(innerText.substring(element().selectionStart(), element().selectionEnd())); + int selectionStart = element().selectionStart(); + ASSERT(selectionStart <= element().selectionEnd()); + int selectionCodeUnitCount = element().selectionEnd() - selectionStart; + selectionLength = selectionCodeUnitCount ? numGraphemeClusters(innerText.substring(selectionStart, selectionCodeUnitCount)) : 0; } ASSERT(oldLength >= selectionLength);