зеркало из https://github.com/mozilla/pjs.git
Bug 597519 - Attempting to add characters to a textarea filled to its maxlength with a trailing newline results in the caret to jump to the previous line; r=roc a=blocking-final+
This commit is contained in:
Родитель
a7b784d2cb
Коммит
3c12dc8e49
|
@ -658,8 +658,14 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
|||
|
||||
// handle docs with a max length
|
||||
// NOTE, this function copies inString into outString for us.
|
||||
nsresult res = TruncateInsertionIfNeeded(aSelection, inString, outString, aMaxLength, nsnull);
|
||||
PRBool truncated = PR_FALSE;
|
||||
nsresult res = TruncateInsertionIfNeeded(aSelection, inString, outString,
|
||||
aMaxLength, &truncated);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (truncated) {
|
||||
*aCancel = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 start = 0;
|
||||
PRUint32 end = 0;
|
||||
|
|
|
@ -104,6 +104,8 @@ _TEST_FILES = \
|
|||
bug512295-2-ref.html \
|
||||
bug585922.html \
|
||||
bug585922-ref.html \
|
||||
bug597519-1.html \
|
||||
bug597519-1-ref.html \
|
||||
test_bug514127.html \
|
||||
test_bug518777.html \
|
||||
test_bug548545.xhtml \
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE HTML><html><head>
|
||||
</head>
|
||||
<body>
|
||||
<textarea>ab
|
||||
</textarea>
|
||||
<script>
|
||||
var t = document.querySelector("textarea");
|
||||
t.focus();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML><html><head>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<textarea maxlength="3"></textarea>
|
||||
<script>
|
||||
var t = document.querySelector("textarea");
|
||||
t.focus();
|
||||
|
||||
synthesizeKey("a", {});
|
||||
synthesizeKey("b", {});
|
||||
synthesizeKey("VK_ENTER", {});
|
||||
synthesizeKey("c", {});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -93,7 +93,8 @@ var tests = [
|
|||
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
||||
[ 'bug512295-1.html' , 'bug512295-1-ref.html' ] ,
|
||||
[ 'bug512295-2.html' , 'bug512295-2-ref.html' ] ,
|
||||
[ 'bug585922.html' , 'bug585922-ref.html' ]
|
||||
[ 'bug585922.html' , 'bug585922-ref.html' ] ,
|
||||
[ 'bug597519-1.html' , 'bug597519-1-ref.html' ]
|
||||
];
|
||||
var testIndex = 0;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче