From 080354124d699e19359f2f8bb48768ef711b8049 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Sat, 22 Jul 2000 01:11:49 +0000 Subject: [PATCH] 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 --- mozilla/content/base/src/nsDocument.cpp | 22 ++++++++++++++++++++++ mozilla/layout/base/src/nsDocument.cpp | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 59c5f87e32d..dea5489818b 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -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 domText(do_QueryInterface(focus)); + if (domText) + { + nsCOMPtr parent; + result = focus->GetParentNode(getter_AddRefs(parent)); + if (NS_SUCCEEDED(result) && parent) + focus = parent; + } + domText = do_QueryInterface(anchor); + if (domText) + { + nsCOMPtr 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 diff --git a/mozilla/layout/base/src/nsDocument.cpp b/mozilla/layout/base/src/nsDocument.cpp index 59c5f87e32d..dea5489818b 100644 --- a/mozilla/layout/base/src/nsDocument.cpp +++ b/mozilla/layout/base/src/nsDocument.cpp @@ -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 domText(do_QueryInterface(focus)); + if (domText) + { + nsCOMPtr parent; + result = focus->GetParentNode(getter_AddRefs(parent)); + if (NS_SUCCEEDED(result) && parent) + focus = parent; + } + domText = do_QueryInterface(anchor); + if (domText) + { + nsCOMPtr 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