зеркало из https://github.com/mozilla/pjs.git
Bug 606432. Check caret content for wrong document. r=roc a=roc
This commit is contained in:
Родитель
cb56a4bbc7
Коммит
c7737244d2
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function boom()
|
||||||
|
{
|
||||||
|
var t = document.getElementById("f").contentDocument.documentElement;
|
||||||
|
t.contentEditable = "true";
|
||||||
|
t.focus();
|
||||||
|
document.body.appendChild(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="setTimeout(boom, 200);"><iframe id="f" src="data:application/xhtml+xml,<html xmlns='http://www.w3.org/1999/xhtml'></html>"></iframe></body>
|
||||||
|
</html>
|
|
@ -313,4 +313,5 @@ load 572582-1.xhtml
|
||||||
load 579655.html
|
load 579655.html
|
||||||
load 580494-1.html
|
load 580494-1.html
|
||||||
load 580834-1.xhtml
|
load 580834-1.xhtml
|
||||||
|
load 606432-1.html
|
||||||
load 609821-1.xhtml
|
load 609821-1.xhtml
|
||||||
|
|
|
@ -741,6 +741,10 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode,
|
||||||
if (!presShell)
|
if (!presShell)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
if (!aContentNode || !aContentNode->IsInDoc() ||
|
||||||
|
presShell->GetDocument() != aContentNode->GetCurrentDoc())
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsFrameSelection> frameSelection = GetFrameSelection();
|
nsCOMPtr<nsFrameSelection> frameSelection = GetFrameSelection();
|
||||||
if (!frameSelection)
|
if (!frameSelection)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -893,6 +897,9 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(!theFrame || theFrame->PresContext()->PresShell() == presShell,
|
||||||
|
"caret frame is in wrong document");
|
||||||
*aReturnFrame = theFrame;
|
*aReturnFrame = theFrame;
|
||||||
*aReturnOffset = theFrameOffset;
|
*aReturnOffset = theFrameOffset;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1059,7 +1066,8 @@ void nsCaret::DrawCaret(PRBool aInvalidate)
|
||||||
mDrawn = PR_FALSE;
|
mDrawn = PR_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mLastContent->IsInDoc())
|
if (!mLastContent->IsInDoc() ||
|
||||||
|
presShell->GetDocument() != mLastContent->GetCurrentDoc())
|
||||||
{
|
{
|
||||||
mLastContent = nsnull;
|
mLastContent = nsnull;
|
||||||
mDrawn = PR_FALSE;
|
mDrawn = PR_FALSE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче