awful regression of not copypasting from textareas! fixed.r=akkana,anthonyd

git-svn-id: svn://10.0.0.236/trunk@74622 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mjudge%netscape.com 2000-07-22 01:11:49 +00:00
parent 18fee83bdd
commit 080354124d
2 changed files with 44 additions and 0 deletions

View File

@ -3446,6 +3446,28 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
if (NS_SUCCEEDED(aSelection->GetFocusNode(getter_AddRefs(focus))))
{
//check to see if these are text nodes if so there is still a chance at optimization
//from checking their respective parents
if (focus.get() != anchor.get())
{
nsCOMPtr<nsIDOMText> domText(do_QueryInterface(focus));
if (domText)
{
nsCOMPtr<nsIDOMNode> parent;
result = focus->GetParentNode(getter_AddRefs(parent));
if (NS_SUCCEEDED(result) && parent)
focus = parent;
}
domText = do_QueryInterface(anchor);
if (domText)
{
nsCOMPtr<nsIDOMNode> parent;
result = anchor->GetParentNode(getter_AddRefs(parent));
if (NS_SUCCEEDED(result) && parent)
anchor = parent;
}
}//end parent checking
if (focus.get() == anchor.get())
{
rootElement = do_QueryInterface(focus);//set root to top of selection

View File

@ -3446,6 +3446,28 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
{
if (NS_SUCCEEDED(aSelection->GetFocusNode(getter_AddRefs(focus))))
{
//check to see if these are text nodes if so there is still a chance at optimization
//from checking their respective parents
if (focus.get() != anchor.get())
{
nsCOMPtr<nsIDOMText> domText(do_QueryInterface(focus));
if (domText)
{
nsCOMPtr<nsIDOMNode> parent;
result = focus->GetParentNode(getter_AddRefs(parent));
if (NS_SUCCEEDED(result) && parent)
focus = parent;
}
domText = do_QueryInterface(anchor);
if (domText)
{
nsCOMPtr<nsIDOMNode> parent;
result = anchor->GetParentNode(getter_AddRefs(parent));
if (NS_SUCCEEDED(result) && parent)
anchor = parent;
}
}//end parent checking
if (focus.get() == anchor.get())
{
rootElement = do_QueryInterface(focus);//set root to top of selection