From bc616db59e65732650818a7c7f5a3b8169b57922 Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Mon, 28 Aug 2000 22:28:56 +0000 Subject: [PATCH] 47870: Don't copy if selection is collapsed. r=law git-svn-id: svn://10.0.0.236/trunk@77379 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 9 +++++++-- mozilla/layout/html/base/src/nsPresShell.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 34bb8a643b3..ec1926adfc5 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -369,7 +369,6 @@ StackArena::Push() StackMark* oldMarks = mMarks; PRUint32 oldLength = mMarkLength; mMarkLength += MARK_INCREMENT; - void* marks = 0; mMarks = new StackMark[mMarkLength]; nsCRT::memcpy(mMarks, oldMarks, sizeof(StackMark)*oldLength); @@ -1899,7 +1898,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) if (GetVerifyReflowEnable() && (VERIFY_REFLOW_DURING_RESIZE_REFLOW & gVerifyReflowFlags)) { mInVerifyReflow = PR_TRUE; - PRBool ok = VerifyIncrementalReflow(); + /*PRBool ok = */VerifyIncrementalReflow(); mInVerifyReflow = PR_FALSE; } #endif @@ -2905,6 +2904,12 @@ PresShell::DoCopy() if (NS_FAILED(rv) || !sel) return rv?rv:NS_ERROR_FAILURE; + // Now we have the selection. Make sure it's nonzero: + PRBool isCollapsed; + sel->GetIsCollapsed(&isCollapsed); + if (isCollapsed) + return NS_OK; + doc->CreateXIF(buffer,sel); // Get the Clipboard diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 34bb8a643b3..ec1926adfc5 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -369,7 +369,6 @@ StackArena::Push() StackMark* oldMarks = mMarks; PRUint32 oldLength = mMarkLength; mMarkLength += MARK_INCREMENT; - void* marks = 0; mMarks = new StackMark[mMarkLength]; nsCRT::memcpy(mMarks, oldMarks, sizeof(StackMark)*oldLength); @@ -1899,7 +1898,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) if (GetVerifyReflowEnable() && (VERIFY_REFLOW_DURING_RESIZE_REFLOW & gVerifyReflowFlags)) { mInVerifyReflow = PR_TRUE; - PRBool ok = VerifyIncrementalReflow(); + /*PRBool ok = */VerifyIncrementalReflow(); mInVerifyReflow = PR_FALSE; } #endif @@ -2905,6 +2904,12 @@ PresShell::DoCopy() if (NS_FAILED(rv) || !sel) return rv?rv:NS_ERROR_FAILURE; + // Now we have the selection. Make sure it's nonzero: + PRBool isCollapsed; + sel->GetIsCollapsed(&isCollapsed); + if (isCollapsed) + return NS_OK; + doc->CreateXIF(buffer,sel); // Get the Clipboard