From b200b0dc2dd7cff1b73fb7ab2fe8e7e71fa26982 Mon Sep 17 00:00:00 2001 From: "kin%netscape.com" Date: Fri, 28 Jul 2000 13:53:26 +0000 Subject: [PATCH] Fix for bug #46657: an Undo past default text value in a TextWidget Modified CreateAnonymousContent() to disable editor undo before setting the default value, and then reenable it afterwards. r=brade@netscape.com git-svn-id: svn://10.0.0.236/trunk@75066 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/forms/src/nsGfxTextControlFrame2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index dacb77846eb..c5cabf89054 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -1714,9 +1714,22 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext, // Now call SetTextControlFrameState() which will make the // neccessary editor calls to set the default value. + // Make sure to turn off undo before setting the default + // value, and turn it back on afterwards. This will make + // sure we can't undo past the default value. + + rv = mEditor->EnableUndo(PR_FALSE); + + if (NS_FAILED(rv)) + return rv; SetTextControlFrameState(defaultValue); + rv = mEditor->EnableUndo(PR_TRUE); + + if (NS_FAILED(rv)) + return rv; + // Now restore the original editor flags. rv = mEditor->SetFlags(editorFlags);