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
This commit is contained in:
kin%netscape.com
2000-07-28 13:53:26 +00:00
parent 00db0c5ed3
commit b200b0dc2d

View File

@@ -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);