Make input type=file work with display: none (bug 152844), r=sicking@bigfoot.com, sr=jst@netscape.com

This commit is contained in:
jkeiser@netscape.com
2002-12-20 05:40:37 +00:00
parent 5a2ab0cb33
commit f7f6a9e720
4 changed files with 38 additions and 0 deletions

View File

@@ -71,6 +71,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIScriptGlobalObject.h"
#include "nsILocalFile.h"
#include "nsITextControlElement.h"
#include "nsContentCID.h"
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
@@ -116,6 +117,23 @@ nsFileControlFrame::~nsFileControlFrame()
}
}
NS_IMETHODIMP
nsFileControlFrame::Destroy(nsIPresContext* aPresContext)
{
// Toss the value into the control from the anonymous content, which is about
// to get lost.
if (mTextContent) {
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(mTextContent);
nsAutoString value;
input->GetValue(value);
// Have it take the value, just like when input type=text goes away
nsCOMPtr<nsITextControlElement> fileInput = do_QueryInterface(mContent);
fileInput->TakeTextFrameValue(value);
}
return nsAreaFrame::Destroy(aPresContext);
}
NS_IMETHODIMP
nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList)