Bug 74639: Preserve frame state through form demotion, don't store uninitialized frame state, r=nisheeth@netscape.com, sr=jst@netscape.com

This commit is contained in:
pollmann@netscape.com
2001-04-24 08:33:57 +00:00
parent a9ac564e17
commit 41614822f1
12 changed files with 73 additions and 8 deletions

View File

@@ -655,12 +655,15 @@ NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext,
NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue)
{
// Return the value of the property from the widget it is not null.
// If widget is null, assume the widget is GFX-rendered and return a member variable instead.
aValue.Truncate(); // initialize out param
if (nsHTMLAtoms::value == aName) {
if (mTextFrame)
if (mTextFrame) {
mTextFrame->GetTextControlFrameState(aValue);
}
else if (mCachedState) {
aValue.Assign(*mCachedState);
}
}
return NS_OK;
}
@@ -699,6 +702,11 @@ nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aStat
{
NS_ENSURE_ARG_POINTER(aState);
// Don't save state before we are initialized
if (!mTextFrame && !mCachedState) {
return NS_OK;
}
// Get the value string
nsAutoString stateString;
nsresult res = GetProperty(nsHTMLAtoms::value, stateString);