Bug 766305 - WSFragment should use PRInt32 for offsets, not PRInt16; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-06-24 09:54:42 +03:00
parent 9989086b37
commit e8463207f1
5 changed files with 29 additions and 7 deletions

View File

@ -71,7 +71,7 @@ DeleteTextTxn::DoTransaction()
// get the text that we're about to delete
nsresult res = mCharData->SubstringData(mOffset, mNumCharsToDelete,
mDeletedText);
NS_ASSERTION(NS_SUCCEEDED(res), "could not get text to delete.");
MOZ_ASSERT(NS_SUCCEEDED(res));
res = mCharData->DeleteData(mOffset, mNumCharsToDelete);
NS_ENSURE_SUCCESS(res, res);

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var s = "x";
for (var i = 0; i < 15; ++i)
s = s + s;
var t = document.createTextNode(s);
document.body.appendChild(t);
window.getSelection().collapse(t, s.length);
document.execCommand("insertText", false, "a");
}
</script>
</head>
<body contenteditable="true" onload="boom();"></body>
</html>

View File

@ -28,3 +28,4 @@ load 682650-1.html
load 716456-1.html
load 759748.html
load 761861.html
load 766305.html

View File

@ -1171,7 +1171,7 @@ nsWSRunObject::GetPreviousWSNode(DOMPoint aPoint,
nsresult
nsWSRunObject::GetPreviousWSNode(nsIDOMNode *aStartNode,
PRInt16 aOffset,
PRInt32 aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aPriorNode)
{
@ -1279,7 +1279,7 @@ nsWSRunObject::GetNextWSNode(DOMPoint aPoint,
nsresult
nsWSRunObject::GetNextWSNode(nsIDOMNode *aStartNode,
PRInt16 aOffset,
PRInt32 aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aNextNode)
{

View File

@ -179,8 +179,8 @@ class NS_STACK_CLASS nsWSRunObject
{
nsCOMPtr<nsIDOMNode> mStartNode; // node where ws run starts
nsCOMPtr<nsIDOMNode> mEndNode; // node where ws run ends
PRInt16 mStartOffset; // offset where ws run starts
PRInt16 mEndOffset; // offset where ws run ends
PRInt32 mStartOffset; // offset where ws run starts
PRInt32 mEndOffset; // offset where ws run ends
PRInt16 mType, mLeftType, mRightType; // type of ws, and what is to left and right of it
WSFragment *mLeft, *mRight; // other ws runs to left or right. may be null.
@ -239,7 +239,7 @@ class NS_STACK_CLASS nsWSRunObject
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aPriorNode);
nsresult GetPreviousWSNode(nsIDOMNode *aStartNode,
PRInt16 aOffset,
PRInt32 aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aPriorNode);
nsresult GetPreviousWSNode(DOMPoint aPoint,
@ -249,7 +249,7 @@ class NS_STACK_CLASS nsWSRunObject
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aNextNode);
nsresult GetNextWSNode(nsIDOMNode *aStartNode,
PRInt16 aOffset,
PRInt32 aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aNextNode);
nsresult GetNextWSNode(DOMPoint aPoint,